Skip to content

Commit

Permalink
fix bakc the get_valid_schemas func
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-tzayats committed Dec 10, 2024
1 parent 06884b6 commit 23db36e
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions semantic_model_generator/snowflake_utils/snowflake_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,14 +443,10 @@ def get_valid_schemas_tables_columns_df(
if table_names:
table_names_str = ", ".join([f"'{t.lower()}'" for t in table_names])
where_clause += f"AND LOWER(t.table_name) in ({table_names_str}) "
query = dedent(
f"""
select t.{_TABLE_SCHEMA_COL}, t.{_TABLE_NAME_COL}, c.{_COLUMN_NAME_COL}, c.{_DATATYPE_COL}, c.{_COMMENT_COL} as {_COLUMN_COMMENT_ALIAS}
from {db_name}.information_schema.tables as t
join {db_name}.information_schema.columns as c on t.table_schema = c.table_schema and t.table_name = c.table_name{where_clause}
order by 1, 2, c.ordinal_position
"""
)
query = f"""select t.{_TABLE_SCHEMA_COL}, t.{_TABLE_NAME_COL}, c.{_COLUMN_NAME_COL}, c.{_DATATYPE_COL}, c.{_COMMENT_COL} as {_COLUMN_COMMENT_ALIAS}
from {db_name}.information_schema.tables as t
join {db_name}.information_schema.columns as c on t.table_schema = c.table_schema and t.table_name = c.table_name{where_clause}
order by 1, 2, c.ordinal_position"""
cursor_execute = conn.cursor().execute(query)
assert cursor_execute, "cursor_execute should not be None here"
schemas_tables_columns_df = cursor_execute.fetch_pandas_all()
Expand Down

0 comments on commit 23db36e

Please sign in to comment.