Merging upstream version 10.5.10.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
8588db6332
commit
4d496b7a6a
43 changed files with 1384 additions and 356 deletions
|
@ -1,15 +1,18 @@
|
|||
from sqlglot import alias, exp
|
||||
from sqlglot.errors import OptimizeError
|
||||
from sqlglot.optimizer.scope import traverse_scope
|
||||
from sqlglot.schema import ensure_schema
|
||||
|
||||
|
||||
def isolate_table_selects(expression):
|
||||
def isolate_table_selects(expression, schema=None):
|
||||
schema = ensure_schema(schema)
|
||||
|
||||
for scope in traverse_scope(expression):
|
||||
if len(scope.selected_sources) == 1:
|
||||
continue
|
||||
|
||||
for (_, source) in scope.selected_sources.values():
|
||||
if not isinstance(source, exp.Table):
|
||||
if not isinstance(source, exp.Table) or not schema.column_names(source):
|
||||
continue
|
||||
|
||||
if not source.alias:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue