From 67c28dbe67209effad83d93b850caba5ee1e20e3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 3 May 2023 11:12:28 +0200 Subject: Merging upstream version 11.7.1. Signed-off-by: Daniel Baumann --- sqlglot/dialects/duckdb.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'sqlglot/dialects/duckdb.py') diff --git a/sqlglot/dialects/duckdb.py b/sqlglot/dialects/duckdb.py index c034208..9454db6 100644 --- a/sqlglot/dialects/duckdb.py +++ b/sqlglot/dialects/duckdb.py @@ -8,6 +8,7 @@ from sqlglot.dialects.dialect import ( arrow_json_extract_sql, datestrtodate_sql, format_time_lambda, + no_comment_column_constraint_sql, no_pivot_sql, no_properties_sql, no_safe_divide_sql, @@ -23,7 +24,7 @@ from sqlglot.tokens import TokenType def _ts_or_ds_add(self, expression): - this = expression.args.get("this") + this = self.sql(expression, "this") unit = self.sql(expression, "unit").strip("'") or "DAY" return f"CAST({this} AS DATE) + {self.sql(exp.Interval(this=expression.expression, unit=unit))}" @@ -139,6 +140,8 @@ class DuckDB(Dialect): } class Generator(generator.Generator): + JOIN_HINTS = False + TABLE_HINTS = False STRUCT_DELIMITER = ("(", ")") TRANSFORMS = { @@ -150,6 +153,7 @@ class DuckDB(Dialect): exp.ArraySize: rename_func("ARRAY_LENGTH"), exp.ArraySort: _array_sort_sql, exp.ArraySum: rename_func("LIST_SUM"), + exp.CommentColumnConstraint: no_comment_column_constraint_sql, exp.DayOfMonth: rename_func("DAYOFMONTH"), exp.DayOfWeek: rename_func("DAYOFWEEK"), exp.DayOfYear: rename_func("DAYOFYEAR"), @@ -213,6 +217,11 @@ class DuckDB(Dialect): "except": "EXCLUDE", } + PROPERTIES_LOCATION = { + **generator.Generator.PROPERTIES_LOCATION, # type: ignore + exp.VolatileProperty: exp.Properties.Location.UNSUPPORTED, + } + LIMIT_FETCH = "LIMIT" def tablesample_sql(self, expression: exp.TableSample, seed_prefix: str = "SEED") -> str: -- cgit v1.2.3