foreign key reflection across schemas is implemented for MySQL, and
the Table object itself takes a "schema" argument - no need to add
this to external methods. What version of MySQL are you running and
what is the output of SHOW CREATE TABLE for the tables in question ?
On Jan 5, 2009, at 6:02 AM, Joakim Lundborg wrote:
> Hi!
>
> I have a database with foreign keys in tables not in the default
> schema. when reflecting these tables, sqlalchemy only looks in the
> default schema for the fk tables, so it can't find them. is there a
> way to tell sqlalchemy to look for fk tables in another schema than
> the default?
>
> i.e. I have a database with schema A and schema B, A is the default
> schema. In B I have defined Ba and Bb. Ba has a foreign key to Bb.
> When doing sqlalchemy.Table("Ba", metadata, autoload = True, schema =
> "B") I get NoSuchTableError: Bb
>
> Is this a bug or am I missing something?
>
> I have written a patch that fixes the problem for me, probably not the
> best way to fix the problem, but I don't know much about SQLAlchemy
> internals to do it nicely. Any suggestions on how to fix this
> properly?
>
> -- Joakim Lundborg
>
> >
> <fk_non-default_schema_reflection>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---