pip install sqlacodegen pymysql
Then you can generate models like this:
sqlacodegen mysql+pymysql://<user>:<password>@localhost:3306/<db>
Remember to replace placeholders like <user>
.
If you don't need indexes in the output, use --noindexes
option:
sqlacodegen --noindexes mysql+pymysql://<user>:<password>@localhost:3306/<db>