summaryrefslogtreecommitdiffstats
path: root/sqlglot/optimizer/scope.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-11-11 08:54:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-11-11 08:54:30 +0000
commit9ebe8c99ba4be74ccebf1b013f4e56ec09e023c1 (patch)
tree7ab2f39fbb6fd832aeea5cef45b54bfd59ba5ba5 /sqlglot/optimizer/scope.py
parentAdding upstream version 9.0.6. (diff)
downloadsqlglot-9ebe8c99ba4be74ccebf1b013f4e56ec09e023c1.tar.xz
sqlglot-9ebe8c99ba4be74ccebf1b013f4e56ec09e023c1.zip
Adding upstream version 10.0.1.upstream/10.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--sqlglot/optimizer/scope.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/sqlglot/optimizer/scope.py b/sqlglot/optimizer/scope.py
index 5a75ee2..18848f3 100644
--- a/sqlglot/optimizer/scope.py
+++ b/sqlglot/optimizer/scope.py
@@ -226,7 +226,9 @@ class Scope:
self._ensure_collected()
columns = self._raw_columns
- external_columns = [column for scope in self.subquery_scopes for column in scope.external_columns]
+ external_columns = [
+ column for scope in self.subquery_scopes for column in scope.external_columns
+ ]
named_outputs = {e.alias_or_name for e in self.expression.expressions}
@@ -278,7 +280,11 @@ class Scope:
Returns:
dict[str, Scope]: Mapping of source alias to Scope
"""
- return {alias: scope for alias, scope in self.sources.items() if isinstance(scope, Scope) and scope.is_cte}
+ return {
+ alias: scope
+ for alias, scope in self.sources.items()
+ if isinstance(scope, Scope) and scope.is_cte
+ }
@property
def selects(self):
@@ -307,7 +313,9 @@ class Scope:
sources in the current scope.
"""
if self._external_columns is None:
- self._external_columns = [c for c in self.columns if c.table not in self.selected_sources]
+ self._external_columns = [
+ c for c in self.columns if c.table not in self.selected_sources
+ ]
return self._external_columns
@property