Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate Database Schema using Python

I want to generate a basic DB schema for my django project to display all my Apps with Models and Model Fields with boundary conditions etc. Is there already any DB schema generator for django in python? Or otherwise how should i go about doing it.

like image 233
D_D Avatar asked Jun 22 '11 09:06

D_D


2 Answers

If your talking about needing to see the SQL schema, run ./manage.py sqlall <appname>

If you want a visualisation of the schema you can get django-extensions and run ./manage.py graph_models -a -g -o my_project.png. This will produce a pretty schema graph for you, but generally omits border conditions. you may want to check the options to add more data. http://readthedocs.org/docs/django-extensions/en/latest/graph_models.html

like image 76
Thomas Avatar answered Oct 21 '22 10:10

Thomas


manage.py sql <appname appname ...> (docs)

like image 44
DrTyrsa Avatar answered Oct 21 '22 11:10

DrTyrsa