On Wed, Dec 03, 2008 at 06:47:07PM -0500, inhahe wrote: > ----tablestest.py--- > from sqlobject import * > class Houses(SQLObject): > pass > class Bathrooms(SQLObject): > house = ForeignKey("Houses") > index1 = DatabaseIndex(house) > > ----the file i invoke--- > from sqlobject import * > from connectstr import connectstr > connection = connectionForURI(connectstr) > sqlhub.processConnection = connection > import tablestest > for name in dir(tablestest): > obj = getattr(tablestest, name) > if hasattr(obj, "createTable"): > print obj > obj.createTable()
dir() returns objects in a random order. It could be that dir() returns 'Bathrooms' before 'Houses', and MySQL reports it cannot create a FOREIGN KEY that points to a non-existing table. Solution: create the tables in the proper order - Houses first. Oleg. -- Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED] Programmers don't die, they just GOSUB without RETURN. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss