Skip to content

Commit

Permalink
hack for bq tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxHalford committed Nov 9, 2023
1 parent 10da16f commit da817ff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion lea/app/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def test(
view_columns = columns.query(f"view_name == '{client._make_view_path(view)}'")[
"column"
].tolist()

for test in client.yield_unit_tests(view=view, view_columns=view_columns):
assertion_tests.append(test)
console.log(f"Found {len(assertion_tests):,d} assertion tests")
Expand Down
5 changes: 4 additions & 1 deletion lea/clients/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ def get_columns(self) -> pd.DataFrame:
FROM {self.dataset_name}.INFORMATION_SCHEMA.COLUMNS
"""
view = lea.views.GenericSQLView(schema=None, name=None, query=query, sqlglot_dialect=self.sqlglot_dialect)
return self._load_sql_view(view)
columns = self._load_sql_view(view)
# HACK
columns['view_name'] = columns['view_name'].apply(lambda x: f"{self.dataset_name}.{x}")
return columns

def _make_view_path(self, view: lea.views.View) -> str:
return f"{self.dataset_name}.{lea._SEP.join(view.key)}"
Expand Down
2 changes: 1 addition & 1 deletion lea/clients/duckdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def get_tables(self):
def get_columns(self) -> pd.DataFrame:
query = """
SELECT
table_schema || '.' || table_name AS view_name,
table_schema || '.' || table_name AS view_name,
column_name AS column,
data_type AS type
FROM information_schema.columns
Expand Down

0 comments on commit da817ff

Please sign in to comment.