MySQL Forums
Forum List  »  Connector/Python

Cannot commit a read statement
Posted by: Xiang Zhang
Date: July 26, 2022 11:00AM

```
>>> import mysql.connector
>>> cnx = mysql.connector.connect(user="root")
>>> cur = cnx.cursor()
>>> cur.execute('select count(*) from test.test')
>>> cnx.commit()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/homebrew/lib/python3.9/site-packages/mysql/connector/connection.py", line 1229, in commit
self._execute_query("COMMIT")
File "/opt/homebrew/lib/python3.9/site-packages/mysql/connector/connection.py", line 1247, in _execute_query
self.handle_unread_result()
File "/opt/homebrew/lib/python3.9/site-packages/mysql/connector/connection.py", line 1455, in handle_unread_result
raise errors.InternalError("Unread result found")
mysql.connector.errors.InternalError: Unread result found
```

commit a select statement always return a "Unread result found" error. Is this expected? Same code works well with mysqlclient and PyMySQL.

Options: ReplyQuote


Subject
Written By
Posted
Cannot commit a read statement
July 26, 2022 11:00AM


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.