Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duckdb: non-literal date is no longer cast as date when converted from snowflake #3338

Closed
tekumara opened this issue Apr 22, 2024 · 0 comments · Fixed by #3339
Closed

duckdb: non-literal date is no longer cast as date when converted from snowflake #3338

tekumara opened this issue Apr 22, 2024 · 0 comments · Fixed by #3339

Comments

@tekumara
Copy link
Contributor

The following conversion fails when executed by duckdb, because DATE is not a valid duckdb expression:

❯ python -c 'import sqlglot; print(repr(sqlglot.parse_one("SELECT date(a.start_date) from SOURCE_TABLE AS a", read="snowflake").sql(dialect="duckdb")));'
'SELECT DATE(a.start_date) FROM SOURCE_TABLE AS a'

sqlglot 21.2 didn't have this problem, and would cast a non-literal as date, eg:

❯ python -c 'import sqlglot; print(repr(sqlglot.parse_one("SELECT date(a.start_date) from SOURCE_TABLE AS a", read="snowflake").sql(dialect="duckdb")));'
'SELECT CAST(a.start_date AS DATE) FROM SOURCE_TABLE AS a'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant