[SQLObject] Problem with longID = True and sequences
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Marc S. <mar...@gm...> - 2004-11-04 20:49:10
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
I scanned the mailing-list archive but found no answer to my problem, so
here it is:
I try to access an externaly created PostgrSQL-database via SQLObject
class ProgramOs(SQLObject):
~ _fromDatabase = True
~ [...]
but get the following error:
Traceback (most recent call last):
[...]
~ File
"/usr/lib/python2.3/site-packages/sqlobject/postgres/pgconnection.py",
line 67, in _queryInsertID
~ c.execute("SELECT NEXTVAL('%s')" % sequenceName)
psycopg.ProgrammingError: ERROR: relation "program_os_id_seq" does not
exist
SELECT NEXTVAL('program_os_id_seq')
this is obviously because:
1. I try to use
conn = connectionForURI('postgres://user@localhost/dbname')
conn.style = MixedCaseUnderscoreStyle(longID = True)
which (I hope) should give me londIDs with otherwise standard
SQLObject-behaviour (if not please correct me).
2. "sequenceName" as seen in the traceback is a sequence named
"program_os_id_seq" (but by standard convention this should be
"<table>_<field>_seq", i.e. "program_os_program_os_id_seq"), so it is
clear why it fails (there is no such sequence in the database, it would
only be there if longID would be false and the id would simply be "id"
not "program_os_id").
The question now is: Why? Is my conn.style-statement wrong? Is this a
bug? Am I doing something stupid here? I would not want to change the
primary key to "id" instead of "program_os_id", so this would be the
last option.
Thanks in advance.
- --
Bye,
Marc Saric
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFBioe9vKxJUF29wRIRAjVgAKCAPqTUa1VWQLQ3JwprzroxpoqtYwCfdyp3
07Z04fTZnZK39//ohs/vQu4=
=jufH
-----END PGP SIGNATURE-----
|