SQLObject 1.4.0 发布了,改进内容包括:
- 优化 PostgresConnection
- SQLObject 使用 INSERT...RETURNING id 来获取自增长 ID,要求 PostgreSQL 8.2 支持
- SQLObject now generates NCHAR/NVARCHAR and N''-quoted strings for MS SQL
SQLObject 是一个流行的Python 数据库对象映射框架,映射的规则就是表->类、字段->属性
示例代码:
01 | >>> from sqlobject import * |
02 | >>> |
03 | >>> sqlhub.processConnection = connectionForURI( 'sqlite:/:memory:' ) |
04 | >>> |
05 | >>> class Person(SQLObject): |
06 | ... fname = StringCol() |
07 | ... mi = StringCol(length = 1 , default = None ) |
08 | ... lname = StringCol() |
09 | ... |
10 | >>> Person.createTable() |