Thursday, March 1, 2007

Database libraries

Monday - Wednesday was spent redoing the database access layer. I'd been using web.py's built in database libraries, but that's not suitable for the production site, because it uses a global database connection. If we need to move to multiple databases, it'll be a royal mess.

I considered using SQLAlchemy and spent much of last week researching that, but IMHO it's overkill. I don't need a full object/relational mapping layer; I'm quite happy with SQL and don't need to write my SQL statements in Python. So I ended up writing a thin wrapper on top of raw DBAPI classes. It basically provides convenience methods similar to PEAR DB for querying (using SQL), along with direct SQL generation for INSERT, UPDATE, and DELETE.

Am very grateful for unit tests. They let me change everything globally and let me know instantly where I'd broken things. Just need to flesh them out; a couple pages don't yet have tests.

This morning, I got a comment box to appear on the game page. Wrote the database schema for comments on the subway. I'll integrate it in and write the code when I get home.

2 comments:

tn requin said...

sleeping bag
tablecloth
travel luggage
car gps
car parts
GPS navigation
portable GPS
lcd tv
flat tv
digital picture frames
unlocked cell phones
wedding dresses
wedding jewelry
chaussures mode
chaussures Femmes
women's shoes
round tablecloth
discount handbags
chaussures sport
chaussures pas cher
fashion bedding
id lanyard
lanyard
creative gadgets
gift ideas
kids wall stickers
wall stickers
bath curtains
kitchen faucet
bathroom faucet

shopping online said...

Adsense of Jordan Shoes : just do it!
Adsense of Moncler Jackets : sends to warm, give you more comforts of life!
Adsense of NFL Jerseys : everything is possible!
Adsense of Christian Louboutin : choice me is choice beautiful foot and body!
Adsense of Puma Shoes : champion is in the first line!
Adsense of Gucci Shoes : Allows you to enjoy the leisure life in the fun!
Adsense of Vibram Fivefingers : taste original life, wear the most morden and comfortable shoes!
Adsense of GHD Hair straighteners : why make our hair so beautiful and lots stylers, for choice me is choice happy!
Adsense of Michael Jordan Shoes : just do it!