I wrote a tentative patch that tries to make SQLObject a little smarter
with regards to the tables creation order. I attached it to this
ticket:

http://trac.turbogears.org/turbogears/ticket/279

Should solve your problem.



Cheers,

--
Yves-Eric


Olli wrote:
> Hi, folks. I run "create sql create" fine with SQLite and MySQL, but
> after I set postgresql uri and run this instruction. I got:
>
> Using database URI postgres://olliwang:[EMAIL PROTECTED]/house
> Traceback (most recent call last):
>   File "/usr/bin/tg-admin", line 7, in ?
>     sys.exit(
>   File
> "/usr/lib64/python2.4/site-packages/TurboGears-0.9a8-py2.4.egg/turbogears/command/base.py",
> line 346, in main
>     command.run()
>   File
> "/usr/lib64/python2.4/site-packages/TurboGears-0.9a8-py2.4.egg/turbogears/command/base.py",
> line 143, in run
>     command.the_runner.run(sys.argv)
>   File
> "/usr/lib64/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/manager/command.py",
> line 102, in run
>     runner.run()
>   File
> "/usr/lib64/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/manager/command.py",
> line 233, in run
>     self.command()
>   File
> "/usr/lib64/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/manager/command.py",
> line 569, in command
>     soClass.createTable()
>   File
> "/usr/lib64/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/main.py",
> line 1322, in createTable
>     conn.createTable(cls)
>   File
> "/usr/lib64/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/dbconnection.py",
> line 522, in createTable
>     self.query(self.createTableSQL(soClass))
>   File
> "/usr/lib64/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/dbconnection.py",
> line 303, in query
>     return self._runWithConnection(self._query, s)
>   File
> "/usr/lib64/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/dbconnection.py",
> line 217, in _runWithConnection
>     val = meth(conn, *args)
>   File
> "/usr/lib64/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/dbconnection.py",
> line 300, in _query
>     self._executeRetry(conn, conn.cursor(), s)
>   File
> "/usr/lib64/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/dbconnection.py",
> line 295, in _executeRetry
>     return cursor.execute(query)
> psycopg2.ProgrammingError: relation "address_city" does not exist
>
>
> #The related code in model is:
> class Address(SQLObject):
>     city = ForeignKey("AddressCity")
>     area = ForeignKey("AddressArea")
>     rest = UnicodeCol(length=50)
>     house = ForeignKey("House")
>
>
> class AddressCity(SQLObject):
>     name = UnicodeCol(length=5)
>     areas = MultipleJoin("AddressArea", joinColumn="city_id")
>     address = MultipleJoin("Address", joinColumn="city_id")
>
>
> class AddressArea(SQLObject):
>     name = UnicodeCol(length=5)
>     city = ForeignKey("AddressCity")
>     address = MultipleJoin("Address", joinColumn="area_id")
>
> Is there anything wrong? It's really strange working fine with SQLite
> and MySQL but isn't with PostgreSQL.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to