confirmed this specific case has a bug, here's the patch, test passes  
on my end.  plz confirm this works for you and we'll try to get a full  
unit test going.

Index: lib/sqlalchemy/databases/mysql.py
===================================================================
--- lib/sqlalchemy/databases/mysql.py   (revision 5603)
+++ lib/sqlalchemy/databases/mysql.py   (working copy)
@@ -2306,7 +2306,7 @@
          for spec in constraints:
              # only FOREIGN KEYs
              ref_name = spec['table'][-1]
-            ref_schema = len(spec['table']) > 1 and spec['table'][-2]  
or None
+            ref_schema = len(spec['table']) > 1 and spec['table'][-2]  
or table.schema

              if not ref_schema:
                  if default_schema is None:



On Jan 5, 2009, at 10:22 AM, Joakim wrote:

> CREATE TABLE  `r`.`sources` (
>  `Source_ID` int(11) NOT NULL default '0',
>  PRIMARY KEY  (`Source_ID`),
>  UNIQUE KEY `pn` (`Source`)
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
>
> CREATE TABLE  `r`.`products` (
>  `ID` int(11) NOT NULL auto_increment,
>  `Source_id` int(11) NOT NULL default '0',
>  `ProductName` varchar(150) collate utf8_unicode_ci NOT NULL default
> '',
>  PRIMARY KEY  (`ID`),
>  UNIQUE KEY `uidx_products_pn_s` USING BTREE
> (`Source_id`,`ProductName`),
>  CONSTRAINT `FK_products_sid` FOREIGN KEY (`Source_id`) REFERENCES
> `sources` (`Source_ID`) ON UPDATE CASCADE
> ) ENGINE=InnoDB AUTO_INCREMENT=27583192 DEFAULT CHARSET=utf8
> COLLATE=utf8_unicode_ci


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to