how to check sql statement generated for model and reverse generation model of existing table in django

created at 07-16-2021 views: 2

from model to sql statement

Django 1.9 and below versions:

python manage.py sqlall <app_name>

Django version 1.9 and later

python manage.py sqlmigrate app_label migration_name

# example
python manage.py sqlmigrate app 0001_initial
python manage.py sqlmigrate app 0001

python manage.py sqlmigrate app 0002_initial

reverse generation from table to models

python manage.py inspectdb
Please log in to leave a comment.