Setup the config
# Add the following lines to ~/.subversion/config
# must be put in the [tunnels] section of the config file
sshnew=ssh -l user -p 2222
Execute the svn:
svn co svn+sshnew://servername.com/path/to/repository/
Sunday, February 01, 2009
Djanog show model query
Show the raw SQL generated by a model access:
Reset the queries list returned above:
>>> from django import db
>>> db.reset_queries()
Show SQL for a given query (newer django version; 1.5+?)
>>> Product.objects.all().query.sql_with_params()
Show SQL for a given query (older django version; 1.2-1.5+?)
>>> Product.objects.all().query.as_sql()
http://docs.djangoproject.com/en/dev/faq/models/
http://docs.djangoproject.com/en/dev/faq/models/#how-can-i-see-the-raw-sql-queries-django-is-running
# DEBUG needs to be set True
>>> from django.db import connection
>>> connection.queries
[{'sql': 'SELECT polls_polls.id,polls_polls.question,polls_polls.pub_date FROM polls_polls',
'time': '0.002'}]
sql # The raw SQL statement
time # How long the statement took to execute, in seconds.
sql # The raw SQL statement
time # How long the statement took to execute, in seconds.
Reset the queries list returned above:
>>> from django import db
>>> db.reset_queries()
Show SQL for a given query (newer django version; 1.5+?)
>>> Product.objects.all().query.sql_with_params()
Show SQL for a given query (older django version; 1.2-1.5+?)
>>> Product.objects.all().query.as_sql()
http://docs.djangoproject.com/en/dev/faq/models/
http://docs.djangoproject.com/en/dev/faq/models/#how-can-i-see-the-raw-sql-queries-django-is-running
Subscribe to:
Posts (Atom)