from django.db import connection
print connection.queries
print connection.queries[-1]['sql']
Or in Django >= 1.3
import logging
l = logging.getLogger('django.db.backends')
l.setLevel(logging.DEBUG)
l.addHandler(logging.StreamHandler())
Using tshark
sudo tshark -Tfields -e mysql.query -i any -R 'mysql.query'
mysql -h 127.0.0.1 -u root -p
No comments:
Post a Comment