Using sqlacodegen

Using sqlacodegen #

Setup mysql, create user ants ###

shell> mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
mysql> CREATE USER ‘ants'@'localhost' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON angir.* TO 'ants'@'localhost' WITH GRANT OPTION;

Import schema from a mwb file ### Open the mwb file in MySQLWorkbench and export the schema as angir.sql. Replace default_schema with angir.

shell> mysql -u ants
mysql> create database angir;
mysql> use angir;
mysql> source path/to/angir.sql;

Install sqlacodegen, oursql###

pip install sqlacodegen
pip install oursql

Make models code from the created schema ###

sqlacodegen mysql+oursql://ants:some_pass@localhost/angir > generated_models.py

Recommended Posts

Using sqlacodegen
Try using Tkinter
Try using docker-py
Try using PDFMiner
Start using Python
Try using geopandas
Try using Selenium
Try using scipy
Try using django-swiftbrowser
Try using matplotlib
Try using tf.metrics
Try using PyODE
Scraping using Python
Modulo without using%