You can eliminate the batch get when iterating the query, by fetching
all the itemAs in one call.
If you will process ALL the objects from a query, get them ALL, and
then iterate.
def myQuery():
query = A.all().filter('intProperty', val).filter('date >=', date).fetch(1000)
itemBkeys = [A.typeB.get_value_for_datastore(itemA) for itemA in
query]
itemBs = db.get(itemBkeys)
return itemBs
2009/3/11 peterk <[email protected]>:
>
> Ahh, thanks Ryan..that makes sense.
>
> So for lenza...you need to try and squeeze your itemBs construction
> into one RPC call..so..something like this might do the trick:
>
> def myQuery():
> query = A.all().filter('intProperty', val).filter('date >=', date)
> itemAs = [itemA for itemA in query]
> itemBkeys = [A.typeB.get_value_for_datastore(itemA) for itemA in
> itemAs]
> itemBs = db.get(itemBkeys)
> return itemBs
>
> I haven't tested it, but I think that should boil down itemBs'
> construction from n RPC calls to 1, which should bring it more in line
> with the cost of itemA's construction.
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---