Forums

Foreign key error

I am using SQLALCHEMY_BINDS for multiple databases in a flask microservices app. But the foreign key fails from other db table SQLALCHEMY_DATABASE_URI = "mysql+pymysql://goalBioOil:qwerty01@goalBioOil.mysql.pythonanywhere-services.com/goalBioOil$openarc_db" SQLALCHEMY_BINDS = { "jobs_db": "mysql+pymysql://goalBioOil:qwerty01@goalBioOil.mysql.pythonanywhere-services.com/goalBioOil$openarc_jobs_db", "subscriptions_db" : "mysql+pymysql://goalBioOil:qwerty01@goalBioOil.mysql.pythonanywhere-services.com/goalBioOil$openarc_subscriptions_db", "chats_db" : "mysql+pymysql://goalBioOil:qwerty01@goalBioOil.mysql.pythonanywhere-services.com/goalBioOil$openarc_chats_db" }

I am getting foreign key error Kindly help asap

If you're getting a foreign key error, that is related to the structure of your database and how sqlalchemy is interpreting it. Try to work out from the text of the foreign key error that you're getting what field/table is involved and then check the database structure to see what the issue with that field is.