Skip to content

Commit 1268605

Browse files
committed
Styling
1 parent 80466f1 commit 1268605

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sqlglot/expressions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8520,19 +8520,21 @@ def expand(
85208520
The transformed expression.
85218521
"""
85228522
normalized_sources = {normalize_table_name(k, dialect=dialect): v for k, v in sources.items()}
8523-
# Create a query provider based on the sources parameter
85248523

85258524
def _expand(node: Expression):
85268525
if isinstance(node, Table):
85278526
name = normalize_table_name(node, dialect=dialect)
85288527
source = normalized_sources.get(name)
8528+
85298529
if source:
85308530
# Create a subquery with the same alias (or table name if no alias)
85318531
parsed_source = source() if callable(source) else source
85328532
subquery = parsed_source.subquery(node.alias or name)
85338533
subquery.comments = [f"source: {name}"]
8534+
85348535
# Continue expanding within the subquery
85358536
return subquery.transform(_expand, copy=False)
8537+
85368538
return node
85378539

85388540
return expression.transform(_expand, copy=copy)

0 commit comments

Comments
 (0)