SQLObject 1.2.0 发布了,该版本主要改进包括:
- Strings are treated specially in Select to allow Select(['id, 'name'], where='value = 42').
- ForeignKey('Table', refColumn='refcol_id') allows ForeignKey to point to a non-id column.
- Support for PostgreSQL 7.* is dropped; the minimal supported version of PostgreSQL is 8.1.
- Quoting rules have changed for PostgreSQL: SQLObject uses the E'' escape string.
- A bug caused by psycopg2 recently adding a new Boolean non-callable autocommit attribute was fixed.
- sqlobject.__doc__ and main.__doc__ no longer contain the version number: use sqlobject.version or version_info
SQLObject 是一个流行的Python 数据库对象映射框架,映射的规则就是表->类、字段->属性
示例代码:
>>> from sqlobject import *
>>>
>>> sqlhub.processConnection = connectionForURI('sqlite:/:memory:')
>>>
>>> class Person(SQLObject):
... fname = StringCol()
... mi = StringCol(length=1, default=None)
... lname = StringCol()
...
>>> Person.createTable()
