manage.py sql command for django models - Django

RadiantHex picture RadiantHex · Nov 22, 2010 · Viewed 8.4k times · Source

just wondering... but is it possible to generate SQL commands for django's models?

e.g. the session model

python manage.py sql django

Any ideas?

Answer

Martin v. Löwis picture Martin v. Löwis · Nov 22, 2010

You need to mention the name of the specific app that comes with django, such as

 python manage.py sql auth
 python manage.py sql admin

I find it a bit clumsy that you can't give fully-qualified names (such as django.contrib.auth), but using just the last part of the name seems to work fine.