Hi Daiski,

You can sort your results by using the .order() method on a Query object:

q = Student.all().order('last_name').

The datastore only supports fetching 1000 results per query. If you
really need to retrieve more, you can use multiple queries and
paginate, for example see Zheng's solution (but bear in mind that his
code snippet will omit entries in the case of more than one student
with the same last name).

Before you do so, though, consider why you're trying to retrieve more
than 1000 results in a single request. Do you intend to display them
all to the user? If so, is that a usable user interface? Do you intend
to aggregate the data from the records? In this case, you may want to
consider calculating the aggregates ahead of time.

-Nick Johnson

On Mon, May 18, 2009 at 9: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

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to