Skip to content

Commit

Permalink
[FEATURE] Implement TupleFilesystemStoreBackend::get_all (#9687)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-hoffman committed Apr 2, 2024
1 parent 0b7b2aa commit e0c61f8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion great_expectations/data_context/store/tuple_store_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ def _get(self, key):

@override
def _get_all(self) -> list[Any]:
raise NotImplementedError
keys = [key for key in self.list_keys() if key != StoreBackend.STORE_BACKEND_ID_KEY]
return [self._get(key) for key in keys]

def _set(self, key, value, **kwargs):
if not isinstance(key, tuple):
Expand Down
23 changes: 23 additions & 0 deletions tests/data_context/store/test_store_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,29 @@ def test_TupleFilesystemStoreBackend(tmp_path_factory):
assert url == "http://www.test.com/my_file_CCC"


@pytest.mark.filesystem
def test_TupleFilesystemStoreBackend_get_all(tmp_path_factory):
path = "dummy_str"
full_test_dir = tmp_path_factory.mktemp("test_TupleFilesystemStoreBackend__dir")
project_path = str(full_test_dir)

my_store = TupleFilesystemStoreBackend(
root_directory=project_path,
base_directory=os.path.join(project_path, path), # noqa: PTH118
filepath_template="my_file_{0}",
)

value_a = "aaa"
value_b = "bbb"

my_store.set(("AAA",), value_a)
my_store.set(("BBB",), value_b)

all_values = my_store.get_all()

assert sorted(all_values) == [value_a, value_b]


@pytest.mark.filesystem
def test_TupleFilesystemStoreBackend_ignores_jupyter_notebook_checkpoints(
tmp_path_factory,
Expand Down

0 comments on commit e0c61f8

Please sign in to comment.