[SQLObject] Newbie Problem w/ PostgreSQL
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Mike H. <th...@bi...> - 2003-04-10 20:42:09
|
I'm not only new to SQLObject, but to the whole DB realm in general.
I made a table in PostgreSQL called Site, then I created a class not too
dissimilar from the example in the documentation:
>>> class Site(SQLObject):
... _columns = [StringCol('url'),
... DateTimeCol('modified'),
... StringCol('etag')]
...
But, when I tried to make a new object, it crashed:
>>> s = Site.new(url=lst[0],modified=lst[1],etag=lst[2])
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.2/site-packages/SQLObject/SQLObject.py", line
713, in new
inst._SO_finishCreate()
File "/usr/lib/python2.2/site-packages/SQLObject/SQLObject.py", line
732, in _SO_finishCreate
id = self._connection.queryInsertID(self._table, self._idName,
AttributeError: 'Site' object has no attribute '_connection'
>>> Site._connection = c
>>> s = Site.new(url=lst[0],modified=lst[1],etag=lst[2])
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.2/site-packages/SQLObject/SQLObject.py", line
713, in new
inst._SO_finishCreate()
File "/usr/lib/python2.2/site-packages/SQLObject/SQLObject.py", line
733, in _SO_finishCreate
names, values)
File "/usr/lib/python2.2/site-packages/SQLObject/DBConnection.py", line
126, in queryInsertID
return self._runWithConnection(self._queryInsertID, table, idName,
names, values)
File "/usr/lib/python2.2/site-packages/SQLObject/DBConnection.py", line
72, in _runWithConnection
val = meth(conn, *args)
File "/usr/lib/python2.2/site-packages/SQLObject/DBConnection.py", line
437, in _queryInsertID
c.execute('SELECT nextval(\'%s_id_seq\')' % table)
psycopg.ProgrammingError: ERROR: Relation "site_id_seq" does not exist
SELECT nextval('site_id_seq')
Can anyone shed some light on a poor newbie?
-- mikeh
--
|