andialbrecht / sqlparse

A non-validating SQL parser module for Python
BSD 3-Clause "New" or "Revised" License
3.76k stars 700 forks source link

split() return the wrong sql-command count #789

Open popolong opened 2 months ago

popolong commented 2 months ago

Describe the bug split() return the wrong sql-command count.

To Reproduce content = """ INSERT INTO table VALUES (1, '1', ''); INSERT INTO table VALUES (2, '2', ':/\'); INSERT INTO table VALUES (3, '3', 'abc');""" stmts = sqlparse.split(content) print(f"total {len(stmts)} stmt(s)") # got 2 , but should be 3

image

Expected behavior there are 3 INSERT cmds, but split got just 2.

Versions (please complete the following information):