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

Fix: ensure unit is a var in parse_date_delta #1637

Merged
merged 1 commit into from
May 16, 2023

Conversation

georgesittas
Copy link
Collaborator

Fixes the following issue:

>>> import sqlglot
>>> sqlglot.transpile("DATEADD(year, 50, '2006-07-31')", read="tsql", write="bigquery")
Traceback (most recent call last):
  ...
  File "sqlglot/sqlglot/dialects/bigquery.py", line 33, in func
    unit = exp.var(unit.name.upper() if unit else "DAY")
AttributeError: 'str' object has no attribute 'name'

@georgesittas georgesittas merged commit cc7a5de into main May 16, 2023
@georgesittas georgesittas deleted the jo/fix_parse_date_delta branch May 16, 2023 19:09
adrianisk pushed a commit to adrianisk/sqlglot that referenced this pull request Jun 21, 2023
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 this pull request may close these issues.

2 participants