From: Mike Bayer Date: Mon, 5 Jan 2009 16:08:12 +0000 (+0000) Subject: assume table.schema, not None, when constraint reflection has no explicit schema... X-Git-Tag: rel_0_5_0~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=29df16432d4cf8ed522c1172578fc8c2f95da6f2;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git assume table.schema, not None, when constraint reflection has no explicit schema. unit test TBD. --- diff --git a/CHANGES b/CHANGES index f26d70e412..ebf0f75a2b 100644 --- a/CHANGES +++ b/CHANGES @@ -375,6 +375,9 @@ CHANGES - Fixed bug in exception raise when FK columns not present during reflection. [ticket:1241] + + - Fixed bug involving reflection of a remote-schema table with + a foreign key ref to another table in that schema. - associationproxy - The association proxy properties are make themselves available diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py index 1b977dce90..045225c93e 100644 --- a/lib/sqlalchemy/databases/mysql.py +++ b/lib/sqlalchemy/databases/mysql.py @@ -2306,7 +2306,7 @@ class MySQLSchemaReflector(object): 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: