summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/snowflake.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-27 10:46:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-27 10:46:33 +0000
commitaa1d1f1ea72887a3efb78f4950e27bc79dfa3766 (patch)
treea9f5bf5ab14c69d011e21d40f8504c4f94a8de72 /sqlglot/dialects/snowflake.py
parentAdding upstream version 11.2.0. (diff)
downloadsqlglot-aa1d1f1ea72887a3efb78f4950e27bc79dfa3766.tar.xz
sqlglot-aa1d1f1ea72887a3efb78f4950e27bc79dfa3766.zip
Adding upstream version 11.2.3.upstream/11.2.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/dialects/snowflake.py')
-rw-r--r--sqlglot/dialects/snowflake.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/sqlglot/dialects/snowflake.py b/sqlglot/dialects/snowflake.py
index 9342865..5931364 100644
--- a/sqlglot/dialects/snowflake.py
+++ b/sqlglot/dialects/snowflake.py
@@ -150,6 +150,10 @@ class Snowflake(Dialect):
FUNCTIONS = {
**parser.Parser.FUNCTIONS,
"ARRAYAGG": exp.ArrayAgg.from_arg_list,
+ "DATE_TRUNC": lambda args: exp.DateTrunc(
+ unit=exp.Literal.string(seq_get(args, 0).name), # type: ignore
+ this=seq_get(args, 1),
+ ),
"IFF": exp.If.from_arg_list,
"TO_TIMESTAMP": _snowflake_to_timestamp,
"ARRAY_CONSTRUCT": exp.Array.from_arg_list,
@@ -215,7 +219,6 @@ class Snowflake(Dialect):
}
class Generator(generator.Generator):
- CREATE_TRANSIENT = True
PARAMETER_TOKEN = "$"
TRANSFORMS = {
@@ -252,6 +255,11 @@ class Snowflake(Dialect):
"replace": "RENAME",
}
+ PROPERTIES_LOCATION = {
+ **generator.Generator.PROPERTIES_LOCATION, # type: ignore
+ exp.SetProperty: exp.Properties.Location.UNSUPPORTED,
+ }
+
def ilikeany_sql(self, expression: exp.ILikeAny) -> str:
return self.binary(expression, "ILIKE ANY")