summaryrefslogtreecommitdiffstats
path: root/sqlglot/optimizer/scope.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-11-11 08:54:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-11-11 08:54:35 +0000
commitd1f00706bff58b863b0a1c5bf4adf39d36049d4c (patch)
tree3a8ecc5d1509d655d5df6b1455bc1e309da2c02c /sqlglot/optimizer/scope.py
parentReleasing debian version 9.0.6-1. (diff)
downloadsqlglot-d1f00706bff58b863b0a1c5bf4adf39d36049d4c.tar.xz
sqlglot-d1f00706bff58b863b0a1c5bf4adf39d36049d4c.zip
Merging upstream version 10.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/optimizer/scope.py')
-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