[英]How to use peewee limit()?
有了Peewee,我試圖使用限制如下:
one_ticket = Ticket.select().limit(1)
print one_ticket.count()
但這打印出5。 有人知道這里有什么問題嗎?
嘗試在調試模式下運行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()
理想情況下,您應該看到原始查詢。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.