MySQL Forums
Forum List  »  Connector/Python

migrating multi-line SQL commands from pymysql
Posted by: Guy Matz
Date: March 28, 2024 08:30AM

I've been tasked with migrating from pymsqyl to mysql.connector . . . we have a bunch of code that has multi-line SQL statements that don't run as expected in mysql.connector, viz. only the first command in the multi-line statement gets run . . . Is there a best way to migrate from pymysql to mysql.connector? I've added `client_flags=ClientFlag.MULTI_STATEMENTS` but then I seem to need to add `while connection.next_result(): pass` after every insert/update statement that has multi-line SQL before I can do a commit.

Is there a better way?

Options: ReplyQuote

Written By
migrating multi-line SQL commands from pymysql
March 28, 2024 08:30AM

Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.