Making Flask connection to existing Postgres tables based on Django models
Question:
I am developing a Flask app that queries on an existing Postgres DB. This DB had been created with Django models. Do i need to reverse engineer so my models would be compatible with SQLAlchemy or will that already be. Is raw queries the way to go? I don’t want to create new DBs just query and update some values in the existing ones, that had been created in Postgres using my django models.
Answers:
Go check out sqlalchemy’s AMAZING automap
feature: http://docs.sqlalchemy.org/en/latest/orm/extensions/automap.html
Used it once in my personal project for similar purpose, it works great.
I am developing a Flask app that queries on an existing Postgres DB. This DB had been created with Django models. Do i need to reverse engineer so my models would be compatible with SQLAlchemy or will that already be. Is raw queries the way to go? I don’t want to create new DBs just query and update some values in the existing ones, that had been created in Postgres using my django models.
Go check out sqlalchemy’s AMAZING automap
feature: http://docs.sqlalchemy.org/en/latest/orm/extensions/automap.html
Used it once in my personal project for similar purpose, it works great.