From: Tom Arnett <sqlobject@ta...> - 2005-07-10 22:03:44
I'm trying to use SQLObject 0.6.1 with a schema containing non-integer
primary keys. I'd like to offer the option of using SQLite, but I
don't see how to construct the classes in that case. _fromDatabase
isn't supported. Declaring a column named 'id' fails at col.py line
>>> class Foo(SQLObject):
... id = StringCol(length=42)
AssertionError: The column name "id" is reserved for SQLObject use (and
is implicitly created).
But it really doesn't matter what it's called:
>>> class Bar(SQLObject):
... _idName = 'baz'
... _idType = str
... baz = StringCol(length=42)
1/Query : CREATE TABLE bar (
baz INTEGER PRIMARY KEY,
_sqlite.DatabaseError: duplicate column name: baz
Also, the documentation seems to be outdated and contradictory in some
places. For example, the FAQ states that non-int PKs are available
only from CVS, but the news lists this as a new feature of 0.5.