tags:

views:

32

answers:

3

Hi,

My plan is to be able to dynamically generated sql tables. Since I know django can create sql tables via Models, they must have a function for this. The problem is I can not find this function in the django folder, or maybe I simply don't recognize it. thnx

+2  A: 

It's called django-admin.py

Start here: http://docs.djangoproject.com/en/dev/ref/django-admin/

Specifically, see http://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-sql

S.Lott
I'm looking for the specific function actually. This way I can implement it in my python script.
Benjamin
@Benjamin: You can import and execute that. Further, you can read the source to see how they do it. It's quite clear from reading the source.
S.Lott
A: 

I am not exactly sure what you mean, but you can get the SQL for all the tables in an app by running this command: python manage.py sqlall your_app

Ivan P
A: 

If you're looking for the specific pieces of code, have a look at django.db.backends.creation to see how the sql is generated, of course there need to be individual implementations for different database types, so for example also see django.db.backends.postgresl.creation!

lazerscience