I'm looking for an example to delete items from Google Cloud Datastore by:
- Key
- Kind
- Filter
- Ancestry
ps: I couldn't find them here: https://developers.google.com/datastore/docs/concepts/queries
I'm looking for an example to delete items from Google Cloud Datastore by:
ps: I couldn't find them here: https://developers.google.com/datastore/docs/concepts/queries
Google Cloud Datastore only supports delete-by-key (and in general, does not support "update queries").
To delete a small number of entities, you can execute a (keys-only) RunQuery
operation to fetch the keys and then a BlindWrite
request to delete the entities.
Or, if the entities are in a single entity group, you can do the entire operation inside a transaction using BeginTransaction
to create a new transaction, set the transaction
handle in the query ReadOptions
, and a Commit
request to apply the mutation.
If you are deleting a large number of entities, you can use the above technique in a MapReduce.
If you are deleting all entities of a particular kind, you can use the App Engine Administration Console to delete entities in bulk.
AttributeError: 'Entity' object has no attribute 'delete'
Are you sure you're not mistaking my question for an App-Engine question? – Sjuul Janssen