Skip to content
Browse files

adding a raw sql method

  • Loading branch information...
1 parent 3aa06e8 commit a5ec7bb90b1882db95c6f4eae94ea373f7f6a50f @coleifer committed
Showing with 4 additions and 0 deletions.
  1. +4 −0
@@ -2089,3 +2089,7 @@ def dfs(model):
for m in sorted(models, key=names, reverse=True):
return list(reversed(ordering)) # want parents first in output ordering
+def raw_sql(query):
+ db = query.model_class._meta.database
+ return query.sql(db.get_compiler())

2 comments on commit a5ec7bb


Can someone please give an example of how to use this helper function?


query =
print raw_sql(query)

Please sign in to comment.
Something went wrong with that request. Please try again.