Skip to content

Commit

Permalink
datastore backend: rename property x to _index
Browse files Browse the repository at this point in the history
  • Loading branch information
akhileshh authored and dodamih committed May 22, 2024
1 parent 56d65e2 commit 1628348
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions zetta_utils/layer/db_layer/datastore/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def read(self, idx: DBIndex) -> DBDataT:
def write(self, idx: DBIndex, data: DBDataT):
entities, parent_entities = self._get_keys_or_entities(idx, data=data)
for parent in parent_entities:
parent["x"] = np.random.randint(sys.maxsize)
parent["_id_nonunique"] = np.random.randint(sys.maxsize)
# must write parent entities for aggregation query to work on `Row` entities
self.client.put_multi(parent_entities + entities)

Expand Down Expand Up @@ -283,8 +283,8 @@ def get_batch(
offset_end = sys.maxsize if offset_end > sys.maxsize else offset_end

_query = self.client.query(kind="Row")
_query.add_filter(filter=query.PropertyFilter("x", ">=", offset_start))
_query.add_filter(filter=query.PropertyFilter("x", "<", offset_end))
_query.add_filter(filter=query.PropertyFilter("_id_nonunique", ">=", offset_start))
_query.add_filter(filter=query.PropertyFilter("_id_nonunique", "<", offset_end))
_query.keys_only()
row_entities = list(_query.fetch())
row_keys = [entity.key.id_or_name for entity in row_entities]
Expand Down

0 comments on commit 1628348

Please sign in to comment.