The problem is not about sorting. The problem is that you cannot get
more than 1000 entries.
You need to "paginate" on the last_name property (if it is guaranteed
to be unique).
all_students = [ ]
next = ''
while True:
students = Student.all().order('last_name').filter('last_name >',
next).fetch(100)
if students:
all_students.extends(students)
next = all_students[-1].last_name
else:
break
Just pay attention that the code above may use too much CPU time if
you really have a lot of entries.
More details about paging:
http://code.google.com/intl/en/appengine/articles/paging.html
Regards.
ZHENG Zhong
http://buggarden.zhengzhong.net/
On May 18, 10:16 pm, daiski <[email protected]> wrote:
> Hi.
>
> I have more than 1000 entities in one kind (Students).
>
> How can I retrieve from (or iterate through) the datastore *all*
> Students sorted by a StringProperty last_name?
>
> Thanks :)
>
> Mo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---