user1769203
user1769203

Reputation: 349

Why is my query failing? Trying to apply sort order on GAE datastore entity

    q = Institution_Table.all().run(batch_size=2000).order('name')

gives me the following error:

AttributeError: '_QueryIterator' object has no attribute 'order'

Upvotes: 0

Views: 151

Answers (1)

Paul Collingwood
Paul Collingwood

Reputation: 9116

The example given in the docs shows that .order('name') is attached to a query.

In your example you are attaching it after the query has been run.

Try:

q = Institution_Table.all().order('name')
results = q.run()

Here: https://developers.google.com/appengine/docs/python/datastore/queries#Restrictions_on_Queries

Upvotes: 2

Related Questions