Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Not a Bug
-
Affects Version/s: 5.5.37
-
Fix Version/s: N/A
-
Component/s: Platform Power
-
Labels:None
-
Environment:Hardware architecture: x86
Operating system: Red Hat 7.0 GA
MySQL Python connector version: 1.2.3
Description
If i run the following command in Python command line:
import MySQLdb connArgs={"host": <server_url>, "user": <user>, "passwd": <password>, "db": <database_name>} conn = MySQLdb.connect(**connArgs) conn.autocommit = True cursor = conn.cursor(MySQLdb.cursors.DictCursor) query = <insert_sql_query> cursor.execute(query)
and then check the MariaDB database, the inserted tuple does not show up in a SELECT query output. If I commit as shown below, the new tuple shows up in SELECT query output.
conn.commit()
This works correctly in MySQL server 5.1.66, same MySQLdb module version.
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
It works identically with MySQL 5.1.66 and MariaDB (or MySQL 5.5), see http://mysql-python.sourceforge.net/FAQ.html:
For your conn.autocommit = True call, I'm not quite sure what it is supposed to do, MySQLdb does not seem to support autocommit attribute for connections: http://mysql-python.sourceforge.net/MySQLdb.html#mysqldb
The most likely reason why you see the difference is that you use a default storage engine, which is MyISAM in 5.1 and InnoDB in 5.5. So, in 5.1 the presence or absence of autocommit won't make any difference, while in 5.5 it will.
To double-check, create the table with an explicit engine on both servers and run the test.