Mon, 16 Jan 2006
Forcing Table Creation Order in SQLObject
A note for posterity, since it took me a while to track this bit of info down: when Ian Bicking's excellent SQLObject has trouble creating your tables because they have a complicated set of interdependencies, you can specify the order they should be created by defining a list called soClasses. Before doing that, feeding the following model to SQLObject 0.7 would produce this error: psycopg.ProgrammingError: ERROR: relation "source" does not exist.

Example of soClasses in action:
from sqlobject import *

soClasses = ('Source','Content')

class Source(SQLObject):
    name = UnicodeCol()
    contents = MultipleJoin('Content')

class Content(SQLObject):
    body = UnicodeCol()
    source = ForeignKey('Source')

[/code]