Skip to content

Commit

Permalink
fix: allow nested db layer entries
Browse files Browse the repository at this point in the history
  • Loading branch information
supersergiy committed Feb 24, 2025
1 parent e6fc726 commit 0e439a9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
5 changes: 5 additions & 0 deletions tests/unit/layer/db_layer/firestore/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ def test_batching(firestore_emulator, mocker) -> None:

ROW_COUNT = 150
COLS = ("col_a", "col_b")
mocker.patch(
"zetta_utils.layer.db_layer.firestore.backend.FirestoreBackend.__len__",
return_value=0,
)
assert layer.get_batch(10, 10) == {}
mocker.patch(
"zetta_utils.layer.db_layer.firestore.backend.FirestoreBackend.__len__",
return_value=ROW_COUNT,
Expand Down
2 changes: 1 addition & 1 deletion zetta_utils/layer/db_layer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .index import DBIndex
from .backend import DBDataT, DBBackend, DBArrayValueT, DBValueT, DBRowDataT
from .backend import DBDataT, DBBackend, DBValueT, DBRowDataT

from .layer import DBLayer, UserDBIndex, ColIndex, DBDataProcT

Expand Down
6 changes: 2 additions & 4 deletions zetta_utils/layer/db_layer/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
from __future__ import annotations

from abc import abstractmethod
from typing import MutableMapping, Sequence, Union
from typing import Mapping, MutableMapping, Sequence, Union

from .. import Backend
from . import DBIndex

DBScalarValueT = Union[bool, int, float, str]
DBArrayValueT = list[DBScalarValueT]
DBValueT = Union[DBScalarValueT, DBArrayValueT]
DBValueT = Union[bool, int, float, str, Sequence["DBValueT"], Mapping[str, "DBValueT"]]
DBRowDataT = MutableMapping[str, DBValueT | None]
DBDataT = Sequence[DBRowDataT]

Expand Down
2 changes: 0 additions & 2 deletions zetta_utils/layer/db_layer/firestore/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
stop_after_attempt,
wait_exponential,
)
from typeguard import typechecked

from zetta_utils import builder
from zetta_utils.layer.db_layer import DBBackend, DBDataT, DBIndex, DBRowDataT
Expand All @@ -26,7 +25,6 @@


@builder.register("FirestoreBackend")
@typechecked
@attrs.mutable
class FirestoreBackend(DBBackend):
"""
Expand Down

0 comments on commit 0e439a9

Please sign in to comment.