SQLAlchemy, how does it connect to an existing MYSQL database created in mysql workbench?

I am trying to create simple python GUI applications to populate an existing MYSQL database. Should I use sqlalchemy to connect to the server? I'm just wondering how Alchemy can connect to an existing database that has been created with the MYSQL toolkit? I usually create database and tables using sqlalchemy so I can query and edit it. But for this case, the database has already been created. I guess the question would be, how do I create the SQLAlchemy code of an existing DB? Sorry for the lack of better words to explain my problem. I am not familiar with the database.


source to share

1 answer

You can use sqlacodegen to generate python code for models in an existing database. You can also use SQLAlchemy's built in ability to mirror tables, or even map to classes , to dynamically load everything at runtime. SQLAlchemy doesn't care about where the database came from, where it is or what it looks like.



All Articles