[google-appengine] Re: best away to know numbers of rows in a entities
If you used numeric keys then you can do pagination by key in order to get all items from the datastore and count them. Basically this involves querying the datastore several times, each time filtering on keys that are greater than the highest key from the results of the previous query. You won't want to do this often as it will likely take to long to do it in a single request so you'll probably only want to do it once and store the value in a counter for later use. If you are using key names and don't have a way of pulling unique data, say via a create time DateTimeProperty, then I'm afraid you're kind of out of luck. You could try different filters and pull the data locally and compare the keys to get unique entities but that sounds like a serious pain. Someone else might have a better idea in this case. Ian On Wed, Jun 24, 2009 at 6:52 AM, alf alberto@gmail.com wrote: hi, assuming you have more than 1000 rows and you have no counter store in a entities what is the best away to know how many rows has a entitie. I think is better time to time request numbers of rows per entity to has a incremental counter and always have in mind insert and delete many thaks. -- === 株式会社ビープラウド イアン・ルイス 〒150-0012 東京都渋谷区広尾1-11-2アイオス広尾ビル604 email: ianmle...@beproud.jp TEL:03-5795-2707 FAX:03-5795-2708 http://www.beproud.jp/ === --~--~-~--~~~---~--~~ 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] Re: best away to know numbers of rows in a entities
2009/6/24 Ian Lewis ianmle...@gmail.com If you used numeric keys then you can do pagination by key in order to get all items from the datastore and count them. Basically this involves querying the datastore several times, each time filtering on keys that are greater than the highest key from the results of the previous query. You won't want to do this often as it will likely take to long to do it in a single request so you'll probably only want to do it once and store the value in a counter for later use. If you are using key names and don't have a way of pulling unique data, say via a create time DateTimeProperty, then I'm afraid you're kind of out of luck. You could try different filters and pull the data locally and compare the keys to get unique entities but that sounds like a serious pain. Someone else might have a better idea in this case. Pagination by key works regardless of if you're using key names or IDs. -Nick Johnson Ian On Wed, Jun 24, 2009 at 6:52 AM, alf alberto@gmail.com wrote: hi, assuming you have more than 1000 rows and you have no counter store in a entities what is the best away to know how many rows has a entitie. I think is better time to time request numbers of rows per entity to has a incremental counter and always have in mind insert and delete many thaks. -- === 株式会社ビープラウド イアン・ルイス 〒150-0012 東京都渋谷区広尾1-11-2アイオス広尾ビル604 email: ianmle...@beproud.jp TEL:03-5795-2707 FAX:03-5795-2708 http://www.beproud.jp/ === -- Nick Johnson, App Engine Developer Programs Engineer Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047 --~--~-~--~~~---~--~~ 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] Re: best away to know numbers of rows in a entities
2009/6/24 Nick Johnson (Google) nick.john...@google.com Pagination by key works regardless of if you're using key names or IDs. Good to know. Sorry about the misinformation. I had forgotten that entities are ordered in the datastore by their key. BTW, here is an article in the documentation about pagination: http://code.google.com/appengine/articles/paging.html Read the part called Paging without a property for information on how to paginate by key. Here is information about queries on keys and contains the info about how keys are sorted by id/keyname: http://code.google.com/appengine/docs/python/datastore/queriesandindexes.html#Queries_on_Keys -- === 株式会社ビープラウド イアン・ルイス 〒150-0012 東京都渋谷区広尾1-11-2アイオス広尾ビル604 email: ianmle...@beproud.jp TEL:03-5795-2707 FAX:03-5795-2708 http://www.beproud.jp/ === --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---