0

I have 2 databases in my server and i want to join tables between those databases let say db1.animal and db2.breed. I created the bindings in models using bind_key as the documentation says, but dont get to make work the joins between those tables. When i tried it end with cant find table a breed in db1

Greyzor
  • 1
  • 1
  • Does this answer your question? [Join tables in two databases using SQLAlchemy](https://stackoverflow.com/questions/44564369/join-tables-in-two-databases-using-sqlalchemy) – KJTHoward Mar 09 '20 at 15:42
  • i saw that post early but i think the anser is based on sqlalchemy and not flask sqlalchemy i know that flask sqlalchemy in build based on the other but i want to know it has a native way to do in flask sqlalchemy. I want to know if there is other way to do it – Greyzor Mar 09 '20 at 15:53
  • @Greyzor, what makes you think this won't work with flask-sqlalchemy? – Jon Mar 09 '20 at 16:02
  • i am not saying this won't work, I just want to know if there is a flask-sqlalchemy way using the models – Greyzor Mar 09 '20 at 16:33
  • I'm having the same problem traying joins two tables from different databases defined in it's class Models like this Model1 __bind_key__ = 'db1' and Model2 __bind_key__ = 'db2' using ODBC Driver 17 MSSQL. And issuing the query "Model1.query.join(Model2, Model2.id == Model1.id).limit(1).first()" that give me error Models2 not found. I would like someone help us. – Felix Ramirez Apr 27 '22 at 13:08

0 Answers0