如何在pynamodb ORM中使用多个where条件

2024-06-16 18:16:18 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用的是PynamoDB和Flask,我想用field1=value1 and field2=value2这样的查询查询对象。在

这里的field1和{}属于NumberAttribute()类型。在

from pynamodb.models import Model
from pynamodb.attributes import UnicodeAttribute, NumberAttribute,UTCDateTimeAttribute

class SMSQuota(Model):
    id = UnicodeAttribute(hash_key=True)
    user_id = NumberAttribute(null=True)
    sms_quota = NumberAttribute()
    validity_date = UTCDateTimeAttribute(null=True)
    class Meta:
        table_name = 'SMSQuota'
        region = 'us-west-2'
        write_capacity_units = 1
        read_capacity_units = 1

在PynamoDB ORM中如何做到这一点?在

项目=SMSQuota.query( ?? ,过滤条件=??)在


Tags: fromimportidtruemodelnullclasscapacity