Noufal wrote: > On Sep 20, 10:34 pm, Noufal <[EMAIL PROTECTED]> wrote: > [..] >> I create the tables using SQLAlchemy. I'll send you the output in a >> day, I'm away from the machine where this code is right now. > > The output of the create table column looks like this > > CREATE TABLE `stats` ( > `sid` int(11) NOT NULL auto_increment, > `rid` int(11) default NULL, > `stagename` varchar(50) default NULL, > `description` varchar(250) default NULL, > `starttime` timestamp NOT NULL default CURRENT_TIMESTAMP on update > CURRENT_TIMESTAMP, > `endtime` timestamp NOT NULL default '0000-00-00 00:00:00', > PRIMARY KEY (`sid`) > ) ENGINE=MyISAM DEFAULT CHARSET=latin1
The MyISAM storage engine doesn't retain foreign key information- to autoload FKs you must create the table with a storage engine that supports FKs such as InnoDB. That looks like: Table('stats', metadata, ..columns.., mysql_engine='InnodB') You can also use ALTER TABLE via mysql to change the storage engine and add foreign keys if you've already got these MyISAM tables in production (see the mysql docs.) Supplying an explicit ForeignKeyConstraint clause for an autoloaded MyISAM table is just fine too, if you want to keep using that storage engine. Cheers, Jason --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---