Peewee to print generated queries
Asked Answered
E

1

6

Is there a way or setting in Peewee where I can get it to print out all the queries being executed in order to debug and understand potential performance issues.

Ectoblast answered 2/8, 2017 at 9:10 Comment(0)
S
13

Yes, it is documented: http://docs.peewee-orm.com/en/latest/peewee/database.html#logging-queries

# Print all queries to stderr.
import logging
logger = logging.getLogger('peewee')
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())
Struma answered 3/8, 2017 at 1:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.