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

Different behaviour library and sqlformat.org #725

Open
KoBOLL opened this issue Jun 29, 2023 · 0 comments
Open

Different behaviour library and sqlformat.org #725

KoBOLL opened this issue Jun 29, 2023 · 0 comments

Comments

@KoBOLL
Copy link

KoBOLL commented Jun 29, 2023

I am trying to parse an SQL query:

do $$
declare
  content_count int = 10;
begin
  /*comment*/
  select 1;
end; $$

sqlformat.org parse and highlight it correctly:
image

But when I try to do it in Python:

import sqlparse

def parse(s: str):
    res = sqlparse.parse(s)
    print(res[0].tokens)

parse("""
do $$
declare
  content_count int = 10;
begin
  /*comment*/
  select 1;
end; $$""")

I get :

[<Newline ' ' at 0x7AB1C28A8408>, <Keyword 'do' at 0x7AB1C28A8468>, <Whitespace ' ' at 0x7AB1C28A84C8>, <Literal '$$ dec...' at 0x7AB1C28A8528>]

What am I doing wrong?

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

1 participant