MySQL Forums
Forum List  »  Connector/Python

ClientFlag MULTI_STATEMENTS
Posted by: q kaiwei
Date: April 27, 2024 02:31PM

I checked documents, but can't found sample codes of executing multi statements using mysql-connector-python, so need help to correct the following.

```
import mysql.connector
from mysql.connector import ClientFlag

# Connect with the MySQL Server
con = mysql.connector.connect(**CFG)
con.set_client_flags([ClientFlag.MULTI_STATEMENTS])
con.reconnect()

cur = con.cursor()

SQL = "update class set age=123 where name='w1';update class set age=456 where name='w2';"
cur.execute(SQL)

....
```

Options: ReplyQuote


Subject
Written By
Posted
ClientFlag MULTI_STATEMENTS
April 27, 2024 02:31PM


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.