Reputation: 3889
I want to delete/modify an entity in the google cloud datastore based on an email.
email = '[email protected]'
query = client.query('email', '=', email)
# delete this entity if it exists??
Now that I have this query, how can I go about deleting this entity?
Upvotes: 1
Views: 3894
Reputation: 42008
next_entity = query.fetch()
client.delete(next_entity.key)
If you're only deleting the entity and don't need anything other than the key, consider doing a keys_only
query to avoid reading data you don't care about.
Upvotes: 5