diff options
Diffstat (limited to 'sqlglot/dialects/spark2.py')
-rw-r--r-- | sqlglot/dialects/spark2.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sqlglot/dialects/spark2.py b/sqlglot/dialects/spark2.py index dcaa524..ceb48f8 100644 --- a/sqlglot/dialects/spark2.py +++ b/sqlglot/dialects/spark2.py @@ -19,9 +19,13 @@ def _create_sql(self: Hive.Generator, e: exp.Create) -> str: kind = e.args["kind"] properties = e.args.get("properties") - if kind.upper() == "TABLE" and any( - isinstance(prop, exp.TemporaryProperty) - for prop in (properties.expressions if properties else []) + if ( + kind.upper() == "TABLE" + and e.expression + and any( + isinstance(prop, exp.TemporaryProperty) + for prop in (properties.expressions if properties else []) + ) ): return f"CREATE TEMPORARY VIEW {self.sql(e, 'this')} AS {self.sql(e, 'expression')}" return create_with_partitions_sql(self, e) |