Newbie
Newbie

Reputation: 249

Google app engine: Retrieve values from datastore after a particular key value?

I'm newbie to GAP (Python). I'm using NDB to retrieve all the values from datastore which comes after a particular key value.

Thanks in advance if anybody can help me out with this one?

Upvotes: 1

Views: 172

Answers (1)

Tim Hoffman
Tim Hoffman

Reputation: 12986

I assume you are setting the key or are using allocate id's otherwise such a requirement would not have a lot of meaning.

You can use the key as an order argument.

e.g. I have a Product model

x = models.Product.query().order(models.Product.key)

Given this I can then get all keys greater than a specific key with

x = models.Product.query(models.Product.key > ndb.Key('Product','001132')).order(models.Product.key)

The order is a bit irrelevent but heh ;-)

Upvotes: 1

Related Questions