Пример #1
0
 def to_delete_mutation(key):
     if not helper.is_key_valid(key):
         raise ValueError(
             'Keys to be deleted from the Cloud Datastore must be '
             'complete:\n%s", key')
     mutation = datastore_pb2.Mutation()
     mutation.delete.CopyFrom(key)
     return mutation
Пример #2
0
 def to_upsert_mutation(entity):
     if not helper.is_key_valid(entity.key):
         raise ValueError(
             'Entities to be written to the Cloud Datastore must '
             'have complete keys:\n%s' % entity)
     mutation = datastore_pb2.Mutation()
     mutation.upsert.CopyFrom(entity)
     return mutation