I have some input which is a string containing more than one MySQL queries, such as USE some_db; SELECT * FROM some_table;
. When I store this string as s<
Look at the documentation for MySQLCursor.execute().
It claims that you can pass in a multi
parameter that allows you to run multiple queries in one string.
If multi is set to True, execute() is able to execute multiple statements specified in the operation string.
multi
is an optional second parameter to the execute() call:
operation = 'SELECT 1; INSERT INTO t1 VALUES (); SELECT 2'
for result in cursor.execute(operation, multi=True):