Marius Lian
Marius Lian

Reputation: 543

How to use Query with scan_index_forward in boto dynamodb v2

I need to use scan_index_forward in my DynamodDB query and from the documentation here: http://boto.readthedocs.org/en/latest/ref/dynamodb2.html

It seems I must use the low-level part and more more specifically "layer1". Here is the definition for a Query in "layer1": http://boto.readthedocs.org/en/latest/ref/dynamodb2.html#boto.dynamodb2.layer1.DynamoDBConnection.query

From this documentation I can't find how to do this nor is there any example. Is there anyone that can provide a sample of how to execute a query on "layer1"?

Here is the code I have so far:

import boto.dynamodb2
import boto.dynamodb2.layer1
import boto.sdb

region_list=boto.sdb.regions()

dynoConnLayer1 = boto.dynamodb2.layer1.DynamoDBConnection(aws_access_key_id='xxxxxx', aws_secret_access_key='xxxxxxx', region = region_list[1]) 

dynoConnLayer1.query(table_name='Keywords', index_name='publishedDate', select='keyword__eq=somekeyword;publishedDate__GT=2013-06-01', scan_index_forward='false')

Upvotes: 2

Views: 5773

Answers (1)

Marius Lian
Marius Lian

Reputation: 543

I can answer this myself: scan_index_forward is supported in the high-level through the "reverse" parameter. So if you do not use "reverse" parameter the result will be returned in default ascending order. If you provide "reverse=True" parameter the result will be returned in descending order.

Code samples can be found here: http://boto.readthedocs.org/en/latest/dynamodb2_tut.html#querying

Upvotes: 1

Related Questions