summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/snowflake.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-11-01 05:12:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-11-01 05:12:42 +0000
commitc51a9844b869fd7cd69e5cc7658d34f61a865185 (patch)
tree55706c65ce7e19626aabf7ff4dde0e1a51b739db /sqlglot/dialects/snowflake.py
parentReleasing debian version 18.17.0-1. (diff)
downloadsqlglot-c51a9844b869fd7cd69e5cc7658d34f61a865185.tar.xz
sqlglot-c51a9844b869fd7cd69e5cc7658d34f61a865185.zip
Merging upstream version 19.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/dialects/snowflake.py')
-rw-r--r--sqlglot/dialects/snowflake.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/sqlglot/dialects/snowflake.py b/sqlglot/dialects/snowflake.py
index 07be65b..01f7512 100644
--- a/sqlglot/dialects/snowflake.py
+++ b/sqlglot/dialects/snowflake.py
@@ -32,7 +32,7 @@ def _check_int(s: str) -> bool:
# from https://docs.snowflake.com/en/sql-reference/functions/to_timestamp.html
-def _parse_to_timestamp(args: t.List) -> t.Union[exp.StrToTime, exp.UnixToTime]:
+def _parse_to_timestamp(args: t.List) -> t.Union[exp.StrToTime, exp.UnixToTime, exp.TimeStrToTime]:
if len(args) == 2:
first_arg, second_arg = args
if second_arg.is_string:
@@ -60,8 +60,8 @@ def _parse_to_timestamp(args: t.List) -> t.Union[exp.StrToTime, exp.UnixToTime]:
# reduce it using `simplify_literals` first and then check if it's a Literal.
first_arg = seq_get(args, 0)
if not isinstance(simplify_literals(first_arg, root=True), Literal):
- # case: <variant_expr>
- return format_time_lambda(exp.StrToTime, "snowflake", default=True)(args)
+ # case: <variant_expr> or other expressions such as columns
+ return exp.TimeStrToTime.from_arg_list(args)
if first_arg.is_string:
if _check_int(first_arg.this):
@@ -560,7 +560,6 @@ class Snowflake(Dialect):
offset = expression.args.get("offset")
if offset:
if unnest_alias:
- expression = expression.copy()
unnest_alias.append("columns", offset.pop())
selects.append("index")