SQLAlchemy is propably the most advanced and well engineered OR/M for Python, while Vertabelo is a database design tool that works in a web browser. The Vertabelo code generator is an pythonic script called vertabelo-sqlalchemy. As you can see, the script is open source and hosted on GitHub.
Here we go:
Download the SQLAlchemy models generator from GitHub.
git clone https://github.com/Vertabelo/vertabelo-sqlalchemy.git
Sign in to Vertabelo.
Create a new database model.
You may use an example database structure for a simple online store:
Here is a sample model. You may make changes or leave the model untouched.
Download diagram as an XML file.
Generate SQLAlchemy models (notice: XML file name will be different).
./vertabelo_sqlalchemy.py -i Example_2014-12-01_13-02.xml \ -o model.py
That’s all. You’ve got model classes that correspond the database tables.
Vertabelo_sqlalchemy is still in alpha stage. Patches or pull request are highly welcome and don’t hesitate to raise an issue on GitHub :).
In the next blog article, I’ll write more details about code generation, including what is supported and what is not.