Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Showing with 4 additions and 0 deletions.
  1. +4 −0 peewee.py
View
4 peewee.py
@@ -2089,3 +2089,7 @@ def dfs(model):
for m in sorted(models, key=names, reverse=True):
dfs(m)
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

@kevinisaac

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

@coleifer
Owner

query = MyModel.select()
print raw_sql(query)

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