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

dropped comments #1631

Closed
pahwaranger opened this issue May 16, 2023 · 2 comments
Closed

dropped comments #1631

pahwaranger opened this issue May 16, 2023 · 2 comments

Comments

@pahwaranger
Copy link

Comment gets dropped when trailing the SELECT statement on a new line

>>> import sqlglot
>>> sqlglot.__version__
'13.0.0'
>>> query = """
... -- test beginning
... SELECT
...     a, /* test wrap comment */
...     b as c -- test same line
...     -- test middle
... FROM foo.bar --testnospace
... -- test end
... """
>>> print(sqlglot.parse_one(query).sql(pretty=True))
/* test beginning */
SELECT
  a, /* test wrap comment */
  b AS c /* test same line */
FROM foo.bar /* testnospace */
/* test end */

Official Documentation
https://github.com/tobymao/sqlglot#formatting-and-transpiling says comments will be preserved

@tobymao
Copy link
Owner

tobymao commented May 16, 2023

it says "best effort"

@tobymao
Copy link
Owner

tobymao commented May 16, 2023

thanks for reporting @pahwaranger 😆

adrianisk pushed a commit to adrianisk/sqlglot that referenced this issue 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

No branches or pull requests

2 participants