[SQLObject] fromDatabase with Schemas under Postgres not working
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Ben B. <be...@gr...> - 2005-08-23 22:42:21
|
I'm having difficulty getting SQLObject to properly pull the column info from the database using fromDatabase = True. This only seems to occur if the table is under a schema in Postgres. If the table is in the "public" schema for the database, it has no problem. Is there some extra configuration I need to add to indicate that its in a schema other than the sqlmeta->table option? Here's the error it gives me (I DO have a Primary Key, so I'm guessing its not looking in the right place): Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/local/www/gamma.parachute.com/lib/College.py", line 10, in ? class Signup(SQLObject): File "/usr/local/lib/python2.3/site-packages/SQLObject-0.7dev_r935- py2.3.egg/sqlobject/declarative.py", line 94, in __new__ cls.__classinit__(cls, new_attrs) File "/usr/local/lib/python2.3/site-packages/SQLObject-0.7dev_r935- py2.3.egg/sqlobject/main.py", line 765, in __classinit__ cls.sqlmeta.addColumnsFromDatabase() File "/usr/local/lib/python2.3/site-packages/SQLObject-0.7dev_r935- py2.3.egg/sqlobject/main.py", line 417, in addColumnsFromDatabase for columnDef in conn.columnsFromSchema(sqlmeta.table, soClass): File "/usr/local/lib/python2.3/site-packages/SQLObject-0.7dev_r935- py2.3.egg/sqlobject/postgres/pgconnection.py", line 197, in columnsFromSchema assert primaryKey, "No primary key found in table %r" % tableName AssertionError: No primary key found in table 'college.signups' From the database for the table: id | integer | not null default nextval ('college.signups_id_seq'::text) Indexes: "signups_pkey" primary key, btree (id) All standard stuff.If anyone has some advice on how to make this work with postgres schema's, I'd hate to have to write out all the column info. :) Thanks, Ben |