6

对于Peewee,我尝试使用以下限制:

one_ticket = Ticket.select().limit(1)
print one_ticket.count()

然而,这会打印出 5。有人知道这里有什么问题吗?

4

1 回答 1

2

尝试peewee调试模式下运行,这实际上只是设置 pythonlogging模块来处理logging.DEBUG关卡项目:

import logging
logging.basicConfig(
    format='[%(asctime)-15s] [%(name)s] %(levelname)s]: %(message)s',
    level=logging.DEBUG
)

# From here, you can now perform your query, and you should see peewee's debug output using the logging module.
one_ticket = Ticket.select().limit(1)
print one_ticket.count()

理想情况下,您应该看到原始查询。

于 2013-11-19T09:39:27.257 回答