From ebec59cc5cb6c6856705bf82ced7fe8d9f75b0d0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 7 Mar 2023 19:09:31 +0100 Subject: Merging upstream version 11.3.0. Signed-off-by: Daniel Baumann --- sqlglot/dialects/dialect.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sqlglot/dialects/dialect.py') diff --git a/sqlglot/dialects/dialect.py b/sqlglot/dialects/dialect.py index af36256..6939705 100644 --- a/sqlglot/dialects/dialect.py +++ b/sqlglot/dialects/dialect.py @@ -360,10 +360,9 @@ def create_with_partitions_sql(self: Generator, expression: exp.Create) -> str: if has_schema and is_partitionable: expression = expression.copy() prop = expression.find(exp.PartitionedByProperty) - this = prop and prop.this - if prop and not isinstance(this, exp.Schema): + if prop and prop.this and not isinstance(prop.this, exp.Schema): schema = expression.this - columns = {v.name.upper() for v in this.expressions} + columns = {v.name.upper() for v in prop.this.expressions} partitions = [col for col in schema.expressions if col.name.upper() in columns] schema.set("expressions", [e for e in schema.expressions if e not in partitions]) prop.replace(exp.PartitionedByProperty(this=exp.Schema(expressions=partitions))) -- cgit v1.2.3