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()