使用Peewee我尝试使用限制如下:
one_ticket = Ticket.select().limit(1)
print one_ticket.count()
但这打印出5。有人知道这里有什么问题吗?
答案 0 :(得分:2)
尝试在debug mode中运行peewee
,这实际上只是设置python logging
模块来处理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()
理想情况下,您应该看到原始查询。