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

Refactor comments so they're stored in a list #750

Merged
merged 6 commits into from
Nov 23, 2022
Merged

Conversation

georgesittas
Copy link
Collaborator

@georgesittas georgesittas commented Nov 22, 2022

The motivation behind this PR can be found in this conversation. It's still a WIP, since I haven't tweaked the generator to allow for multiple comment printing, but it'll come soon.

cc: @mpf82

sqlglot/expressions.py Outdated Show resolved Hide resolved
sqlglot/expressions.py Outdated Show resolved Hide resolved
@georgesittas
Copy link
Collaborator Author

georgesittas commented Nov 23, 2022

@tobymao I experimented with the comment formatting a bit and removed the ---style comments. The simplifications and consistency in generated code (*) we get out of this seems nice, what do you say? I can also revert back to the previous logic and try to think about how multiple comments could be formatted.

(*) Before, we generated -- ... in some places (projections) and /* ... */ in others (tables) in pretty mode.

Note to self: if current state of the PR is good to go, should update README example first.

sqlglot/generator.py Outdated Show resolved Hide resolved
@tobymao tobymao merged commit 6b0da1e into main Nov 23, 2022
@tobymao tobymao deleted the comment_refactor branch November 23, 2022 16:19
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