Here is the entity I would like to pass to the task:
class MyData(ndb.Model):
...
text = ndb.StringProperty(indexed=False)
data = ndb.BlobKeyProperty(repeated=True)
details = ndb.KeyProperty(kind=Details)
Can I do something like below?
mydata = MyData.query()
mydata = mydata.filter(...)
mydata = mydata.order(MyData.added)
mydata = mydata.fetch(100)
for d in mydata:
taskqueue.add(url='/worker', payload=d)
How can I extract the data from the payload then? Don't think that self.request.get('payload')
will work.
Understand that I can pass just the ndb key and read the entity within the task. But it will require additional read operations. Or, can I use keys_only
somehow when fetch(100)
? keys_only
operations are free in accordance with the doc:
Small datastore operations include calls to allocate datastore ids or keys-only queries, and these operations are free.
But are they counted as datastore read operations?