Feat: add tables method to fs_repository

This commit is contained in:
Bertrand Benjamin 2025-01-05 07:01:03 +01:00
parent d1c1b7420d
commit ed8f91d78b
2 changed files with 6 additions and 1 deletions

View File

@ -120,12 +120,16 @@ class FSRepository(Repository):
def _schema(self, name: str) -> FSSchema:
"""List schemas (sub directories within basepath)"""
schema_path = self._basepath / name
tables = self.ls(name)
tables = self.tables(schema=name)
return FSSchema(name=name, path=schema_path, tables=tables)
def schema(self, name: str) -> Schema:
return self._schema(name).ref
def tables(self, schema: str) -> list[str]:
tables = self.ls(schema)
return tables
def _table(self, schema: str, name: str) -> FSTable:
"""Get infos on the table"""
table_path = self._basepath / schema / name

View File

@ -59,6 +59,7 @@ def test_list_schema(location, repository):
def test_list_tables_schema(repository):
assert repository.schema("schema").tables == ["username", "recovery", "salary"]
assert repository.tables(schema="schema") == ["username", "recovery", "salary"]
def test_describe_table(location, repository):