diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-01-23 05:06:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-01-23 05:06:14 +0000 |
commit | 38e6461a8afbd7cb83709ddb998f03d40ba87755 (patch) | |
tree | 64b68a893a3b946111b9cab69503f83ca233c335 /sqlglot/lineage.py | |
parent | Releasing debian version 20.4.0-1. (diff) | |
download | sqlglot-38e6461a8afbd7cb83709ddb998f03d40ba87755.tar.xz sqlglot-38e6461a8afbd7cb83709ddb998f03d40ba87755.zip |
Merging upstream version 20.9.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/lineage.py')
-rw-r--r-- | sqlglot/lineage.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sqlglot/lineage.py b/sqlglot/lineage.py index abcc10f..09bf201 100644 --- a/sqlglot/lineage.py +++ b/sqlglot/lineage.py @@ -129,13 +129,10 @@ def lineage( if isinstance(column, int) else next( (select for select in scope.expression.selects if select.alias_or_name == column), - exp.Star() if scope.expression.is_star else None, + exp.Star() if scope.expression.is_star else scope.expression, ) ) - if not select: - raise ValueError(f"Could not find {column} in {scope.expression}") - if isinstance(scope.expression, exp.Union): upstream = upstream or Node(name="UNION", source=scope.expression, expression=select) @@ -194,6 +191,8 @@ def lineage( # if the select is a star add all scope sources as downstreams if select.is_star: for source in scope.sources.values(): + if isinstance(source, Scope): + source = source.expression node.downstream.append(Node(name=select.sql(), source=source, expression=source)) # Find all columns that went into creating this one to list their lineage nodes. |