mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-12 01:11:41 +00:00
fix(ingest/sqlglot): Make detach_ctes more robust (#11449)
This commit is contained in:
parent
f1be36605b
commit
3c1dcf99b0
@ -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 = {
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user