[google-appengine] Re: Sorting more than 1000 entities

2009-05-19 Thread daiski

Thanks Zheng and Nick!

On May 19, 3:41 pm, "Nick Johnson (Google)" 
wrote:
> 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  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 google-appengine@googlegroups.com
> > To unsubscribe from this group, send email to 
> > google-appengine+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://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 google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Sorting more than 1000 entities

2009-05-18 Thread daiski

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 google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---