I have a string constructed with multiple insert statements and insert statement with values given in multiple-row syntax. Is it possible to specify multiple insert statements along with values given by multiple row syntax for execute(multi=true) in mysql-connector-python? For. e.g below is the string concatenated with the insert statements, first statement with multiple row values:
operation = 'INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9)(11,22,33),(44,55,66),(77,88,99);
INSERT INTO tb2_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);
INSERT INTO tbl1_name (col1,col2) VALUES(col2*2,15);
INSERT INTO tbl1_name (col1,col2) VALUES(15,col1*2);
INSERT INTO tbl2_name (col1,col2) VALUES(col2*2,15);
INSERT INTO tbl2_name (col1,col2) VALUES(15,col1*2);'
for result in cursor.execute(operation, multi=True):
print reslut.row_count
operation = 'INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9)(11,22,33),(44,55,66),(77,88,99);
INSERT INTO tb2_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);
INSERT INTO tbl1_name (col1,col2) VALUES(col2*2,15);
INSERT INTO tbl1_name (col1,col2) VALUES(15,col1*2);
INSERT INTO tbl2_name (col1,col2) VALUES(col2*2,15);
INSERT INTO tbl2_name (col1,col2) VALUES(15,col1*2);'
for result in cursor.execute(operation, multi=True):
print reslut.row_count