【发布时间】:2018-03-29 15:21:35
【问题描述】:
我在 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 查询,这将如下所示
select *from order where order_status = 0 and created_on >= start_date and created_on <=end_date
有什么方法可以在 Dynamodb 中使用 pynamodb 实现相同的目标
【问题讨论】: