MySQL Forums
Forum List  »  Connector/Python

Re: migrating multi-line SQL commands from pymysql
Posted by: q kaiwei
Date: April 28, 2024 07:40PM

I meet the same problem, using the lastest version of mysql-connector-python.

It's simple to add a parameter to the instance of engine of sqlalchemy based on pymysql.

from pymysql.constants.CLIENT import MULTI_STATEMENTS

engine = create_engine('mysql+pymysql://%s:%s@%s:%s/%s' % (DB_CFG['user'], quote_plus(DB_CFG['password']), DB_CFG['host'], DB_CFG['port'], DB_CFG['database']), connect_args={"client_flag": MULTI_STATEMENTS})

Options: ReplyQuote


Subject
Written By
Posted
Re: migrating multi-line SQL commands from pymysql
April 28, 2024 07:40PM


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.