fix(ingest/sqlglot): Make detach_ctes more robust (#11449)

This commit is contained in:
Andrew Sikowitz 2024-09-23 11:42:55 -07:00 committed by GitHub
parent f1be36605b
commit 3c1dcf99b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -101,7 +101,7 @@ usage_common = {
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 = {

View File

@ -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)