ezSqlObject


A convenience wrapper for the excellent SQLObject object-relational mapping package.


ezSqlObject wraps the main classes of SQLObject, adding conveniences such as:
Example:

>>> import ezsqlobject
>>> db = ezsqlobject.EzMysqlDb(db='test', user='test', passwd='test')
>>> db.tables
['addr', 'pers']

>>> db.addr
<ezsqlobject.EzSqlTab instance for table 'addr'>

>>> db.addr.columns
['city', 'zip', 'persID', 'state', 'street']
>>> db.addr.dump()
<addr 1 city='Minnesota' zip='23212' persID=None state='MI' street='42 Elm St'>
<addr 2 city='London' zip='23222' persID=1L state='UK' street='21 Jackson Grove'>
<addr 3 city='Sydney' zip='2001' persID=None state='NS' street='131 Pitt St'>

>>> from SQLObject import StringCol, ForeignKey
>>> db.defTable('cars', \
     make=StringCol(), model=StringCol(), rego=StringCol(), \
owner=ForeignKey('pers', default=None))
>>> db.cars.new(make='Ford', model='Falcon', rego='KFK-833', owner=db.pers.select(db.pers.q.firstName=='John')[0])
>>> (and so on)