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

Convert CSV column names into ASTs without parsing them #2677

Closed
georgesittas opened this issue May 23, 2024 · 0 comments · Fixed by #2686
Closed

Convert CSV column names into ASTs without parsing them #2677

georgesittas opened this issue May 23, 2024 · 0 comments · Fixed by #2686
Assignees
Labels
Bug Something isn't working

Comments

@georgesittas
Copy link
Contributor

Context: #2634

Seed models that contain columns with special characters in them are currently not handled properly. It seems like we're trying to parse the CSV column names using maybe_parse at some point during loading, which can cause a ParseError instead of converting the "unsafe" identifiers into quoted columns.

This can be demonstrated using the example project, by simply renaming event_date to event_date. in the CSV file. This is the error we currently get:

sqlglot.errors.ParseError: Required keyword: 'this' missing for <class 'sqlglot.expressions.Column'>. Line 1, Col: 11.
  event_date.

To fix this, my guess is that we should use to_identifier or something similar, to ensure we'll simply produce a quoted identifier instead of crashing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant