summaryrefslogtreecommitdiffstats
path: root/sqlglot/lineage.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-02-16 05:45:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-02-16 05:45:52 +0000
commit3d48060515ba25b4c49d975a520ee0682327d1b7 (patch)
treee8730f509026e866d77c459f74a384505425363a /sqlglot/lineage.py
parentReleasing debian version 21.0.2-1. (diff)
downloadsqlglot-3d48060515ba25b4c49d975a520ee0682327d1b7.tar.xz
sqlglot-3d48060515ba25b4c49d975a520ee0682327d1b7.zip
Merging upstream version 21.1.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/lineage.py')
-rw-r--r--sqlglot/lineage.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/sqlglot/lineage.py b/sqlglot/lineage.py
index bdd1d14..f10fbb9 100644
--- a/sqlglot/lineage.py
+++ b/sqlglot/lineage.py
@@ -153,7 +153,7 @@ def lineage(
raise ValueError(f"Could not find {column} in {scope.expression}")
for s in scope.union_scopes:
- to_node(index, scope=s, upstream=upstream)
+ to_node(index, scope=s, upstream=upstream, alias=alias)
return upstream
@@ -209,7 +209,11 @@ def lineage(
if isinstance(source, Scope):
# The table itself came from a more specific scope. Recurse into that one using the unaliased column name.
to_node(
- c.name, scope=source, scope_name=table, upstream=node, alias=aliases.get(table)
+ c.name,
+ scope=source,
+ scope_name=table,
+ upstream=node,
+ alias=aliases.get(table) or alias,
)
else:
# The source is not a scope - we've reached the end of the line. At this point, if a source is not found