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

Expressions are being changed automatcally while parsing group by clause #760

Open
hashir0981 opened this issue Jan 3, 2024 · 1 comment

Comments

@hashir0981
Copy link

Describe the bug
It is hallucinating some expressions that include datetime. That should'nt be the expected result.

To Reproduce
def strip_alias_from_group_by(group_by: str) -> str:
sql = f"""
SELECT
{group_by.strip()}
FROM
TABLE1
""".strip()
parsed_sql = parse_one(sql, dialect="databricks", read="databricks")
return ", ".join(map(lambda i: f"{i.alias}" if i.alias else i.sql(), parsed_sql.expressions))

What's the concrete error / traceback.

Expected behavior
A clear and concise description of what you expected to happen.

Versions (please complete the following information):

  • Python: [e.g. 3.11.2]
  • sqlparse: [e.g. 0.4.1]

Additional context
Add any other context about the problem here.

@andialbrecht
Copy link
Owner

Please provide more details about the error. How to reproduce it, the expected and actual output of any kind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants