-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
SqlTable.schema_name
optional (#1458)
This PR makes `SqlTable.schema_name` optional as `SqlTable` can later be used to reference a CTE, which does not have a schema name.
- Loading branch information
Showing
4 changed files
with
30 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
metricflow-semantics/tests_metricflow_semantics/sql/test_sql_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from __future__ import annotations | ||
|
||
import pytest | ||
from metricflow_semantics.sql.sql_table import SqlTable | ||
|
||
|
||
def test_sql_table() -> None: # noqa: D103 | ||
assert SqlTable(schema_name=None, table_name="table", db_name=None).sql == "table" | ||
assert SqlTable(schema_name="schema", table_name="table", db_name=None).sql == "schema.table" | ||
assert SqlTable(schema_name="schema", table_name="table", db_name="db").sql == "db.schema.table" | ||
|
||
with pytest.raises(ValueError): | ||
SqlTable(schema_name=None, table_name="table", db_name="db") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters