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, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.

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.