Hi, that example code works for me in PostgreSQL, after adding unique=True on the name attribute of User, and reversing the order of the drop calls. I don't have a MySQL to try against. Did you get the exact same error from it when running against MySQL?
As for your actual app: 1. the log output suggests that some of your tables already exist: the ROLLBACKs are presumably to clear the does-not-exist error condition. There's no ROLLBACK after DESCRIBE `games` and DESCRIBE `dependencies`, so those tables probably exist already, and maybe they don't match the schema of your current declarative setup. create_all does not modify existing tables, so creating a new table with a foreign key against them may fail with a mismatch. That might be what the "errno 150" from MySQL means. 2. that decoupled configuration may be right, but not dead-obviously so :) ... to confirm, you could check that all the tables you expect the metadata to know about are really there, and have the proper foreign keys, just before calling create_all. Something like: import pprint pprint.pprint(dict( (tn, [ (c.name, c.foreign_keys) for c in t.c if c.foreign_keys ]) for tn, t in metadata.tables.items() )) Regards, - Gulli -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.