hi there
I'm new to SQLObject and I have spent the last couple of hours
struggling with ForeignKey()
Here's the standard setup:
class Person(SQLObject):
firstName = StringCol()
middleInitial = StringCol(length=1, default=None)
lastName = StringCol()
addresses = MultipleJoin('Address')
class Address(SQLObject):
person = ForeignKey("Person", alternateID=True, cascade=True)
street1 = StringCol(length=64)
street2 = StringCol(length=64)
street3 = StringCol(length=64)
city = StringCol(length=64)
postCode = StringCol(length=10)
Now if I do this:
Address.createTable()
I get one of these:
psycopg2.ProgrammingError: relation "person" does not exist
However if I do this:
Person.createTable()
Address.createTable()
Everything is fine.
I've been up for a while so I could be missing something obvious but I
didn't see anything in the documentation that said that when I'm dealing
with one-to-many relationships I have to create the "one" table before I
created the "many" table.
Is this the case? Or is there something else going on here that I'm not
aware of?
thanks
-jachin
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss