From Mysql table to flask_sqlalchemy db.Model

Ok ok the table already exists....

Is there any utility to transform a mysql table into a flask-sqlalchemy db.Model without typing?

Upvotes: 1

Views: 2030

Answers (1)

MOCKBA
MOCKBA

Reputation: 1790

yes, I personally like sqlacodegen, see https://pypi.python.org/pypi/sqlacodegen

to install:

pip install sqlacodegen

to generate ORM code (using MySQL as an example, root user with no password):

sqlacodegen mysql+pymysql://root@localhost/your_database_name

Upvotes: 2

Related Questions