Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any database model designer that can output SQLAlchemy models?

I am implementing a database model to store the 20+ fields of the iCal calendar format and am faced with tediously typing in all these into an SQLAlchemy model.py file. Is there a smarter approach? I am looking for a GUI or model designer that can create the model.py file for me. I would specify the column names and some attributes, e.g, type, length, etc.

At the minimum, I need this designer to output a model for one table. Additional requirements, in decreasing order of priority:

  • Create multiple tables
  • Support basic relationships between the multiple tables (1:1, 1:n)
  • Support constraints on the columns.

I am also open to other ways of achieving the goal, perhaps using a GUI to create the tables in the database and then reflecting them back into a model.

I appreciate your feedback in advance.

like image 653
Kevin P. Avatar asked Dec 01 '10 23:12

Kevin P.


1 Answers

There's another way yet to generate an SQLAlchemy model. You can use Vertabelo - it's an online tool for visual database designing. It's completely free for small projects.

After you created your model in Vertabelo, you will have to convert it to SQLAlchemy mapping classes by using a script available on GitHub.

Simply follow provided below steps:

  • Download diagram as XML file (simply press an XML icon on the toolbar menu)

  • Generate SQLAlchemy models

./vertabelo_sqlalchemy.py -i your_diagram.xml -o model.py

I know this is not a direct and perfect way, but hope it will suit you.

like image 104
corleone Avatar answered Sep 24 '22 21:09

corleone