📜  数据库查询的数量 django - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:43.325000             🧑  作者: Mango

代码示例1
from django.conf import settings
settings.DEBUG = True
from django.db import connection, reset_queries


def num_queries(reset=True):
    print(len(connection.queries))
    if reset:
        reset_queries()