diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-05-03 09:12:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-05-03 09:12:24 +0000 |
commit | 98d5537435b2951b36c45f1fda667fa27c165794 (patch) | |
tree | d26b4dfa6cf91847100fe10a94a04dcc2ad36a86 /sqlglot/dialects/duckdb.py | |
parent | Adding upstream version 11.5.2. (diff) | |
download | sqlglot-98d5537435b2951b36c45f1fda667fa27c165794.tar.xz sqlglot-98d5537435b2951b36c45f1fda667fa27c165794.zip |
Adding upstream version 11.7.1.upstream/11.7.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/dialects/duckdb.py')
-rw-r--r-- | sqlglot/dialects/duckdb.py | 11 |
1 files changed, 10 insertions, 1 deletions
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: |