Convert single mysql insert statements to one statement with multiple VALUES lists

I needed to convert multiple mysql insert statements to statements with multiple VALUE liststo insert several rows at a time. I have not found any tool for that, so I wrote this script in Python. Thankfully I found a non-validating SQL parser module for Python, so this task became very easy. You must install it, before using this script.

Example input data:

MySQL

1

2

3

4

5

6

7

8

9

10

INSERTINTO`test_table`(`id`,`name`)VALUES('1','test1');

INSERTINTO`test_table`(`id`,`name`)VALUES('2','test2');

INSERTINTO`test_table`(`id`,`name`)VALUES('3','test3');

INSERTINTO`test_table`(`id`,`name`)VALUES('4','test4');

INSERTINTO`test_table`(`id`,`name`)VALUES('5','test5');

INSERTINTO`test_table`(`id`,`name`)VALUES('6','test6');

INSERTINTO`test_table`(`id`,`name`)VALUES('7','test7');

INSERTINTO`test_table`(`id`,`name`)VALUES('8','test8');

INSERTINTO`test_table`(`id`,`name`)VALUES('9','test9');

INSERTINTO`test_table`(`id`,`name`)VALUES('10','test10');

Example output data (number of rows in one statement is defined by user):