def _Put(self, entity, insert): entity = datastore_stub_util.StoreEntity(entity) self.__entities_lock.acquire() try: self._StoreEntity(entity, insert) finally: self.__entities_lock.release()
def _Put(self, entity, insert): conn = self._GetConnection() try: self.__DeleteIndexEntries(conn, [entity.key()]) entity = datastore_stub_util.StoreEntity(entity) self.__InsertEntities(conn, [entity]) self.__InsertIndexEntries(conn, [entity]) finally: self._ReleaseConnection(conn)
def _Put(self, v3_entity, insert): connection = self._GetConnection() v3_entity = datastore_stub_util.StoreEntity(v3_entity) req = googledatastore.CommitRequest() req.mode = datastore_pb.CommitRequest.NON_TRANSACTIONAL v1_entity = req.mutation.upsert.add() converter.v3_to_v1_entity(v3_entity, v1_entity) v1_entity.key.partition_id.Clear() resp = connection.commit(req)