在peewee中获取SQL查询计数

在peewee中获取SQL查询计数

问题描述:

是否有可能在peewee中计数查询?如下 让它在Django:在peewee中获取SQL查询计数

from django.db import connection 
print len(connection.queries) 

你可以扮演就像here:子类Database设置它数查询:

def execute(*args, **kwargs): 
    self.counter += 1 # or put the query into some list, as you like 
    return super().execute(args, kwargs)