Created
October 1, 2018 06:28
-
-
Save nnja/36352d940163b3b57513819988a8b781 to your computer and use it in GitHub Desktop.
Show django database queries from the shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [2]: tweet = Tweet.objects.get(id=8) | |
In [3]: from django.db import connection | |
In [4]: connection.queries | |
Out[4]: | |
[{'sql': 'SELECT "tweeter_tweet"."id", "tweeter_tweet"."user_id", "tweeter_tweet"."text", "tweeter_tweet"."timestamp" FROM "tweeter_tweet" WHERE "tweeter_tweet"."id" = 8', | |
'time': '0.001'}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment