Dynamodb查询大于和小于op的日期属性

2024-04-19 01:37:05 发布

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

我在Dynamodb中创建了一个表,其中包含以下详细信息

class OrderStatusIndex(GlobalSecondaryIndex):
    class Meta:
        index_name = 'OrderStatusIndex'
        read_capacity_units = 2
        write_capacity_units = 1
        projection = AllProjection()
    order_status = NumberAttribute(hash_key=True)
    created_on = UnicodeAttribute(range_key=True)


class Order(Model):

    class Meta:
        table_name = 'order'
        host = 'http://localhost:8000'
        read_capacity_units = 2
        write_capacity_units = 1

    order_id = NumberAttribute(hash_key=True)
    order_status = NumberAttribute(hash_key=True)
    created_on = UnicodeAttribute(range_key=True)
    order_status_index = OrderStatusIndex()

现在我想根据订单状态来查询,该状态是在特定日期得到的 如果我做mysql查询,如下所示

^{pr2}$

在Dynamodb中使用pynamodb也能实现同样的功能吗


Tags: keynametruereadindexstatusorderhash