Re: [sqlalchemy] Error 1005 (errno 150) trying to create related tables using InnoDB

2013-08-22 Thread Michael Bayer
On Aug 22, 2013, at 6:08 AM, Gerald Thibault wrote: > I looked into the AddConstraint class, and added some debugging info and > found it wasn't being hit, because the fk was part of a CREATE. So I'd need > to use @compiles to override both of those to ensure both of them render the > referen

Re: [sqlalchemy] Error 1005 (errno 150) trying to create related tables using InnoDB

2013-08-22 Thread Gerald Thibault
I looked into the AddConstraint class, and added some debugging info and found it wasn't being hit, because the fk was part of a CREATE. So I'd need to use @compiles to override both of those to ensure both of them render the references correctly. The single point where the magic happens is in

Re: [sqlalchemy] Error 1005 (errno 150) trying to create related tables using InnoDB

2013-08-21 Thread Michael Bayer
On Aug 21, 2013, at 5:37 PM, Gerald Thibault wrote: > To make it sqlalchemy specific, how do i cause generated CREATE statements to > use absolute schema.table names for foreign key references? you either need to specify "schema" in your referenced Table def, or you'd otherwise have to interc

Re: [sqlalchemy] Error 1005 (errno 150) trying to create related tables using InnoDB

2013-08-21 Thread Gerald Thibault
To make it sqlalchemy specific, how do i cause generated CREATE statements to use absolute schema.table names for foreign key references? I realized the reason MyISAM had no issue with it was because it ignores all those lines, so even if they were wrong (which they seem to be), it wouldn't car

Re: [sqlalchemy] Error 1005 (errno 150) trying to create related tables using InnoDB

2013-08-21 Thread Michael Bayer
you might try asking this as a generic MySQL question on stackoverflow, I don't really know how MySQL does cross-schema work. my rough understanding was "not much". On Aug 21, 2013, at 4:17 PM, Gerald Thibault wrote: > I have a User class, and a Registration class with a FK to User.id. >

[sqlalchemy] Error 1005 (errno 150) trying to create related tables using InnoDB

2013-08-21 Thread Gerald Thibault
I have a User class, and a Registration class with a FK to User.id. When I try to create these on a db using InnoDB as default, I get this error: sqlalchemy.exc.OperationalError: (OperationalError) (1005, "Can't create table 'test2.registrations' (errno: 150)") '\nCREATE TABLE test2.registrati