Created
November 28, 2012 17:13
-
-
Save hhatto/4162611 to your computer and use it in GitHub Desktop.
print raw sql for peewee
This file contains hidden or 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
| from peewee import * | |
| from models import News, database | |
| compiler = database.get_compiler() | |
| print(News.select().where(News.url == 'test').sql(compiler)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As per peewee
3.13you can print SQL queries by first getting the cursor, then calling themogrify()method for your query.Where
databaseis the Peewee Database object representing the connection to your database.