Re: [SQLObject] BUG: ForeignKey in another database
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Ian B. <ia...@co...> - 2003-11-19 01:23:12
|
On Nov 17, 2003, at 5:59 PM, J-P Lee wrote:
> Hi All,
>
> I just switched from v0.4 to v0.51 and my app broke. It looks like=20
> there's a bug in the current release. =A0 I'm doing this:
>
> Common.py
> __connection__ =3D PostgresConnection('dbname=3Dcommon ...')
> class User(SQLObject):
> =A0=A0=A0 name =3D StringCol()
> =A0=A0=A0 ...
>
> App.py
> __connection__ =3D PostgresConnection('dbname=3Dapp ...')
> from Common import User
>
> class Notes(SQLObject):
> =A0=A0=A0 ...
> =A0=A0=A0 user =3D ForeignKey('User')
> =A0=A0=A0 ...
>
> This use to work and I use to be able to do Notes(1).user.name.=A0 Now =
I=20
> get the following error:
>
> Traceback (most recent call last):
> =A0 File "../../external/lib/python/SQLObject/SQLObject.py", line 815,=20=
> in _SO_foreignKey
> =A0 File "../../external/lib/python/SQLObject/SQLObject.py", line 407,=20=
> in __new__
> =A0 File "../../external/lib/python/SQLObject/SQLObject.py", line 667,=20=
> in _init
> =A0 File "../../external/lib/python/SQLObject/DBConnection.py", line=20=
> 306, in _SO_selectOne
> =A0 File "../../external/lib/python/SQLObject/DBConnection.py", line=20=
> 149, in queryOne
> =A0 File "../../external/lib/python/SQLObject/DBConnection.py", line =
72,=20
> in _runWithConnection
> =A0 File "../../external/lib/python/SQLObject/DBConnection.py", line=20=
> 142, in _queryOne
> psycopg.ProgrammingError: ERROR:=A0 Relation "user" does not exist
>
> SELECT name, ... FROM user WHERE id =3D xx
>
> Is there another way to do this?
Hmm... I'm not really sure. It sounds like you haven't created the=20
table like you should have. Though I also feel like "user" is a=20
reserved word, so it shouldn't even work anyway. To test -- what=20
happens when you do __connection__.queryAll('SELECT * FROM user')?
--
Ian Bicking | ia...@co... | http://blog.ianbicking.org
|