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

issue in transpile #3651

Closed
vidit-wisdom opened this issue Jun 13, 2024 · 1 comment · Fixed by #3652
Closed

issue in transpile #3651

vidit-wisdom opened this issue Jun 13, 2024 · 1 comment · Fixed by #3652
Assignees

Comments

@vidit-wisdom
Copy link

vidit-wisdom commented Jun 13, 2024

Fully reproducible code snippet
Code:

import sqlglot
from sqlglot import transpile
print(sqlglot.__version__)

sql = """
SELECT DATEDIFF(days, '2021-01-01', '2021-02-01')
"""
print(transpile(sql, read='redshift',write='bigquery')[0])

Output:

25.1.0
SELECT DATE_DIFF(CAST('2021-02-01' AS DATETIME), CAST('2021-01-01' AS DATETIME), DAYS)

The date interval in the output should be DAY, not DAYS.

Official Documentation
https://count.co/sql-resources/bigquery-standard-sql/date_diff

@vidit-wisdom
Copy link
Author

Thanks!

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.

2 participants