コード例 #1
0
    def _Get(self, key):
        app_kind, _, k = self._GetEntityLocation(key)

        try:
            return datastore_stub_util.LoadEntity(
                self.__entities_by_kind[app_kind][k].protobuf)
        except KeyError:
            pass
コード例 #2
0
 def _Get(self, key):
     conn = self._GetConnection()
     try:
         prefix = self._GetTablePrefix(key)
         c = conn.execute(
             'SELECT entity FROM "%s!Entities" WHERE __path__ = ?' %
             (prefix, ), (self.__EncodeIndexPB(key.path()), ))
         row = c.fetchone()
         if row:
             entity = entity_pb.EntityProto()
             entity.ParseFromString(row[0])
             return datastore_stub_util.LoadEntity(entity)
     finally:
         self._ReleaseConnection(conn)