Feat: use id in repository

This commit is contained in:
2025-01-05 11:27:52 +01:00
parent b9dade2701
commit 48964ad561
3 changed files with 97 additions and 54 deletions

View File

@@ -48,24 +48,29 @@ def repository(location) -> FSRepository:
return FSRepository("example", location, "example")
def test_list_schema(location, repository):
assert repository.schemas() == ["schema"]
assert repository.schema("schema").name == "schema"
assert repository.schema("schema").id == str(location / "schema")
assert repository.schema("schema").repo_id == str(location)
assert repository.schema("schema").value == str(location / "schema")
assert repository.schema("schema").tables == ["username", "recovery", "salary"]
def test_list_schemas(repository):
assert repository.schemas() == ["example-schema"]
def test_describe_schema(location, repository):
schema = repository.schema("example-schema")
assert schema.name == "schema"
assert schema.id == "example-schema"
assert schema.repo_id == str(location)
assert schema.value == str(location / "schema")
assert schema.tables == ["username", "recovery", "salary"]
def test_list_tables_schema(repository):
assert repository.schema("schema").tables == ["username", "recovery", "salary"]
assert repository.tables(schema="schema") == ["username", "recovery", "salary"]
assert repository.schema("example-schema").tables == ["username", "recovery", "salary"]
assert repository.tables("example-schema") == ["username", "recovery", "salary"]
assert repository.tables() == ["username", "recovery", "salary"]
def test_describe_table(location, repository):
table = repository.table("schema", "username")
table = repository.table("example-schema-username")
assert table.id == str(location / "schema" / "username")
assert table.id == "example-schema-username"
assert table.repo_id == str(location)
assert table.schema_id == str(location / "schema")
assert table.name == "username"
@@ -75,9 +80,9 @@ def test_describe_table(location, repository):
def test_describe_table_with_partitions(location, repository):
table = repository.table("schema", "recovery")
table = repository.table("example-schema-recovery")
assert table.id == str(location / "schema" / "recovery")
assert table.id == "example-schema-recovery"
assert table.repo_id == str(location)
assert table.schema_id == str(location / "schema")
assert table.name == "recovery"