Skip to content

Commit 71f4a47

Browse files
authored
feat(snowflake): Transpile exp.DatetimeAdd (#4349)
1 parent 4584935 commit 71f4a47

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

sqlglot/dialects/snowflake.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,7 @@ class Generator(generator.Generator):
786786
exp.Create: transforms.preprocess([_flatten_structured_types_unless_iceberg]),
787787
exp.DateAdd: date_delta_sql("DATEADD"),
788788
exp.DateDiff: date_delta_sql("DATEDIFF"),
789+
exp.DatetimeAdd: date_delta_sql("TIMESTAMPADD"),
789790
exp.DatetimeDiff: timestampdiff_sql,
790791
exp.DateStrToDate: datestrtodate_sql,
791792
exp.DayOfMonth: rename_func("DAYOFMONTH"),

tests/dialects/test_bigquery.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ def test_bigquery(self):
656656
"bigquery": "SELECT DATETIME_ADD('2023-01-01T00:00:00', INTERVAL '1' MILLISECOND)",
657657
"databricks": "SELECT TIMESTAMPADD(MILLISECOND, '1', '2023-01-01T00:00:00')",
658658
"duckdb": "SELECT CAST('2023-01-01T00:00:00' AS DATETIME) + INTERVAL '1' MILLISECOND",
659+
"snowflake": "SELECT TIMESTAMPADD(MILLISECOND, '1', '2023-01-01T00:00:00')",
659660
},
660661
),
661662
)

0 commit comments

Comments
 (0)