You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I initially opened the issue in sqlglot, but Toby pointed out using sqlglot directly works. tobymao/sqlglot#3710
I'm running these versions:
sqlglot==25.3.3
sqlglotrs==0.2.8
sqlmesh==0.106.1
This model can be used to reproduce it:
sqlglot==25.3.3
sqlglotrs==0.2.8
sqlmesh==0.106.1
The project is configured to be the snowflake dialect.
The code renders like this in sqlmesh:
sqlmesh render bronze.dateadd --dialect duckdb
SELECT
CURRENT_DATE + INTERVAL -1 DAY AS "_col_0"
In sqlglot the transpile puts the -1 in parenthesis which makes it work:
import sqlglot
print(sqlglot.transpile("dateadd(day, -1, current_date::timestamp)", read="snowflake", write="duckdb"))
CAST(CURRENT_DATE AS TIMESTAMP) + INTERVAL (-1) DAY
The text was updated successfully, but these errors were encountered:
I initially opened the issue in sqlglot, but Toby pointed out using sqlglot directly works.
tobymao/sqlglot#3710
I'm running these versions:
sqlglot==25.3.3
sqlglotrs==0.2.8
sqlmesh==0.106.1
This model can be used to reproduce it:
sqlglot==25.3.3
sqlglotrs==0.2.8
sqlmesh==0.106.1
The project is configured to be the snowflake dialect.
The code renders like this in sqlmesh:
sqlmesh render bronze.dateadd --dialect duckdb
SELECT
CURRENT_DATE + INTERVAL -1 DAY AS "_col_0"
In sqlglot the transpile puts the -1 in parenthesis which makes it work:
import sqlglot
print(sqlglot.transpile("dateadd(day, -1, current_date::timestamp)", read="snowflake", write="duckdb"))
CAST(CURRENT_DATE AS TIMESTAMP) + INTERVAL (-1) DAY
The text was updated successfully, but these errors were encountered: