diff --git a/metadata-ingestion/setup.py b/metadata-ingestion/setup.py index 8b778048c34757..bf80172441405f 100644 --- a/metadata-ingestion/setup.py +++ b/metadata-ingestion/setup.py @@ -101,7 +101,7 @@ sqlglot_lib = { # Using an Acryl fork of sqlglot. # https://github.com/tobymao/sqlglot/compare/main...hsheth2:sqlglot:main?expand=1 - "acryl-sqlglot[rs]==25.20.2.dev5", + "acryl-sqlglot[rs]==25.20.2.dev6", } classification_lib = { diff --git a/metadata-ingestion/src/datahub/sql_parsing/sqlglot_utils.py b/metadata-ingestion/src/datahub/sql_parsing/sqlglot_utils.py index 56e4c806eb0c30..71245353101f60 100644 --- a/metadata-ingestion/src/datahub/sql_parsing/sqlglot_utils.py +++ b/metadata-ingestion/src/datahub/sql_parsing/sqlglot_utils.py @@ -347,6 +347,9 @@ def detach_ctes( dialect = get_dialect(platform) statement = parse_statement(sql, dialect=dialect) + if not cte_mapping: + return statement + def replace_cte_refs(node: sqlglot.exp.Expression) -> sqlglot.exp.Expression: if ( isinstance(node, sqlglot.exp.Identifier)