是否可以计算peewee中的查询? 在Django中进行如下操作:
from django.db import connection
print len(connection.queries)
答案 0 :(得分:1)
您可以像here一样行动:子类Database
将其设置为计算查询:
def execute(*args, **kwargs):
self.counter += 1 # or put the query into some list, as you like
return super().execute(args, kwargs)