I'm new to Google CloudDatastore and reading a document.
(Note: we don't plan to use Google AppEngine, just DataStore only.)
According to the document, DataStore supports transaction but
If you want to use queries within a transaction,
your data must be organized into entity groups in such a way
that you can specify ancestor filters that will match the right data.
So I thought as long as I want to use transaction, I am forced to create some parent key and set it as an ancestor. And all entities under the parent have a limitation that update and transaction can be only performed once per second.
However, I also see a very simple example of insert here: https://cloud.google.com/datastore/docs/concepts/entities#datastore-insert-python
with client.transaction():
incomplete_key = client.key('Task')
task = datastore.Entity(key=incomplete_key)
task.update({
'category': 'Personal',
'done': False,
'priority': 4,
'description': 'Learn Cloud Datastore'
})
client.put(task)
It doesn't specify a parent and use a single root entity inside a transaction, does it ? Even about examples in Transaction page only the one for "read-only transaction" explicitly specifies a parent. Do other ones simply omit a parent while it actually exists?
I'm wondering I can use transaction without an entity group (= without a big performance degrade) if I can specify a key of a root entity, but there is no such description in the document...
I'd appreciate if someone can clarify the behavior. Thanks.