SQLObject is a popular and open source ORM (Object Relational Manager) that can be used as an object interface to a database, with tables as classes, columns as attributes and rows as instances.
>>> from sqlobject import *
>>> sqlhub.processConnection = connectionForURI('sqlite:/:memory:')
>>> class Person(SQLObject):
... fname = StringCol()
... mi = StringCol(length=1, default=None)
... lname = StringCol()
Here's how you would use the object:
>>> p = Person(fname="John", lname="Doe")
>>> p.mi = 'Q'
>>> p2 = Person.get(1)
>>> p is p2
What's New in This Release: [ read full changelog ]
· PostgresConnection was optimized.
· SQLObject now uses INSERT...RETURNING id to get the autoincremented ID in one query instead of two (INSERT + SELECT id) (PostgreSQL 8.2 required).
· SQLObject now generates NCHAR/NVARCHAR and N''-quoted strings for MS SQL.