SQLAlchemy seems to have an issue reflecting MySQL tables that have foreign keys when the table being reflected is not in the database specified in the connection string.
Let's say I'm working on an app to manage a database named "library", but that I also need access to the tables in the "people" database on the same MySQL server. This shouldn't be a problem, since the SQLAlchemy's table type takes a "schema" keyword argument, so I do something like the following: from sqlalchemy import * from sqlalchemy.orm import * engine = create_engine('mysql://localhost/library') metadata = MetaData(bind=engine) # ... table = Table('child', metadata, autoload=True, schema='people') # error raised: sqlalchemy.exceptions.NoSuchTableError: parent The table "child" is using InnoDB, and it contains a column with a foreign key constraint that refers to a column on the table "parent". The problem is that SQLAlchemy is not resolving the table name relative to the database in which the constraint occurs: it sees that the constraint refers to a table called "parent", treats "parent" as the full name, and as a result, looks for "parent" at "library.parent" instead of "people.parent", resulting in a failure to autoload. --~--~---------~--~----~------------~-------~--~----~ 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 sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---