Python 的 ORM 框架 SQLObject 1.2.0 發布

jopen 13年前發布 | 14K 次閱讀 Python

SQLObject 是一個流行的Python 數據庫對象映射框架,映射的規則就是表->類、字段->屬性

SQLObject還包含一個基于Python對象的查詢語言,makes SQL more abstract, and provides substantial database independence for applications。

示例代碼:

>>> from sqlobject import *
>>>
>>> sqlhub.processConnection = connectionForURI('sqlite:/:memory:')
>>>
>>> class Person(SQLObject):
...     fname = StringCol()
...     mi = StringCol(length=1, default=None)
...     lname = StringCol()
...
>>> Person.createTable()

項目地址:http://www.sqlobject.org/

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

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!