Contents:
We're now using Subversion instead of CVS. The repository is located at svn://colorstudy.com/trunk/SQLObject
Released: 12-Nov-2003
Released: 1-Nov-2003
You can specify columns in a new, preferred manner:
class SomeObject(SQLObject): someColumn = Col()
Equivalent to:
class SomeObject(SQLObject): _columns = [Col('someColumn')]
Ditto joins.
Cache objects have a clear method, which empties all objects. However, weak references to objects are maintained, so the integrity of the cache can be ensured.
SQLObject subclasses can be further subclassed, adding or removing column definitions (as well as changing settings like connection, style, etc). Each class still refers to a single concrete table in the database -- the class hierarchy is not represented in the database.
Each SQLObject subclass can have an associated style, as given in the _style attribute. This object is used to map between Python and database names (e.g., the column name for a Python attribute). Some samples are available in the Style module.
Postgres support for _fromDatabase (reading a table definition from the database, and creating a class from that).
Postgres id columns more permissive, you don't have to create a specially named sequence (or implicitly create that sequence through SERIAL). lastoid is used instead.
MySQL uses localhost as the default host, and the empty string as the default password.
Added functions for use with queries: ISNULL, ISNOTNULL. == and != can be used with None, and is translated into ISNULL, ISNOTNULL.
Classes can be part of a specific registry. Since classes are referred to by name in several places, the names have to be unique. This can be problematic, so you can add a class variable _registry, the value of which should be a string. Classes references are assumed to be inside that registry, and class names need only be unique among classes in that registry.
SomeClass.select() selects all, instead of using SomeClass.select('all'). You can also use None instead of 'all'.
Trying to fetch non-existent objects raises SQLObjectNotFound, which is a subclass of the builtin exception LookupError. This may not be raised if _cacheValues is False and you use the ID to fetch an object (but alternateID fetches will raise the exception in either case).
Can order by descending order, with the reversed option to the select method, or by prefixing the column with a "-".
Ordering with joins works better -- you can order with multiple columns, as well as descending ordering.