MySQL Reflection: Support for inter-database Foreign Keys

Issue #1405 resolved
Anonymous created an issue

Hello everyone,

I haven't worked with MSSQL yet, but I guess this ticket somehow relates to #1341 and #594: In MySQL you can have Foreign Keys referencing tables of a different database on the same database server. When using reflection, those inter-database FK constraints are being ignored, as they do not match the appropriate constraint regular expression.

I might not grasp every aspect of such inter-database constraints in SA yet, but a change to this regular expression seems to suffice in order for relations to be set up correctly between mapped objects of different databases without specifying primaryjoin arguments or overloading column definitions (to include self-made ForeignKey constraints) on reflected tables.

I have attached a diff to databases/

Best Regards, Thomas Wiebe

Comments (4)

  1. Michael Bayer repo owner

    I'm kind of amazed we don't have tests for this ? tests will need to be added to tests/dialect/ resembling those of test/dialect/ test_schema_reflection.

  2. Log in to comment