Domanda

I created a DynamoDB table that contains logging messages each of which has a timestamp associated with it:

table = Table.create('myTable',
                      schema=[
                         HashKey('cluster'),
                         RangeKey('messageTimestamp', data_type=NUMBER)],
                      throughput={'read': 10,
                                  'write': 5},
                      connection=conn)

I know how to query the table to get all items with timestamps later than a given one:

tThresh = time.time()
results = table.query(cluster__eq="clusterA", messageTimestamp__gte=tThresh)

(the "cluster" hash key value is mostly constant, i.e. messages come from only two different clusters)

Is it possible to construct a query to get all items with "before and after" timestamps, i.e. to essentially combine "gte" and "lte" in one query? Thanks

È stato utile?

Soluzione

Before 24 April you couldn't specify Greater Than, Lesser Than, or Between on a Query. But as of 24 April, AWS DynamoDB has updated their API to allow for these advanced operators.

http://aws.typepad.com/aws/2014/04/improved-queries-and-updates-for-dynamodb.html

I have verified that these operators are working for Java SDK 1.7.7, but for boto, i am guessing the boto API has been updated as well, you should update to the latest API version and test out.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top