pallets-eco / flask-sqlalchemy

Adds SQLAlchemy support to Flask
https://flask-sqlalchemy.readthedocs.io
BSD 3-Clause "New" or "Revised" License
4.22k stars 899 forks source link

NoForeignKeysError in cross-schema ForeignKeyConstraint after upgrading from Flask-SQLAlchemy 2.5.1 to 3.0.0 #1337

Closed andreasc-kuehn closed 4 months ago

andreasc-kuehn commented 4 months ago

After upgrading from Flask-SQLAlchemy 2.5.1 to 3.0.0 with unchanged dependencies (same Flask 2.2.0, same SQLAlchemy 1.4.51, Python 3.9), I am getting NoForeignKeysError on formerly working foreign key definition in cases where the foreign key in a table points to a table field in a different schema.

My recent bug report on this issue was converted to a discussion without any explanation. Therefore I cannot understand if I submitted this error in the wrong way, if I missed something or if there were any other complaints about my bug report that make it reasonable to ignore it without commenting. I now tried to refactor the title in a wording that seems to be more SQLAlchemy language like to draw again your attention.

Although the runtime error occurs in SQLAlchemy, the origin of the issue must have to do with Flask-SQLAlchemy. If something in my (declarative) table definitions is outdated or wrong, you could maybe find the time to give a comment.

davidism commented 4 months ago

Duplicate of https://github.com/pallets-eco/flask-sqlalchemy/discussions/1331