Skip to content

strip_comments causing syntax error #425

@msardana94

Description

@msardana94

If there is no space between comments and keyword, the output causes a syntax error. Here's an example:

import sqlparse

sql='''select * from table1--this is a comment
inner join table2 on table1.id = table2.id--this is a comment
where table1.a=1'''

sqlparse.format(sql,strip_comments=True)

This gives the following as output:
select * from table1inner join table2 on table1.id = table2.idwhere table1.a=1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions