簡體   English   中英

如何使用peewee limit()?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM