[PYTHON] Verwenden von 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

Verwenden von sqlacodegen
Versuchen Sie es mit Tkinter
Versuchen Sie es mit Docker-Py
Versuchen Sie es mit PDFMiner
Starten Sie Python
Versuchen Sie es mit Geopandas
Versuchen Sie es mit Selen
Versuchen Sie es mit scipy
Versuchen Sie es mit Django-Swiftbrowser
Versuchen Sie es mit matplotlib
Versuchen Sie es mit tf.metrics
Versuchen Sie es mit PyODE
Scraping mit Python
Ãœberschussberechnung ohne Verwendung von%