Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem in insertion from python script in mysql database with innondb engine

I am facing a problem where I am trying to add data from a python script to mysql database with InnonDB engine, it works fine with myisam engine of the mysql database. But the problem with the myisam engine is that it doesn't support foreign keys so I'll have to add extra code each place where I want to insert/delete records in database.

Does anyone know why InnonDB doesn't work with python scripts and possible solutions for this problem ??

like image 354
Aniket Avatar asked Sep 23 '26 00:09

Aniket


1 Answers

InnoDB is transactional. You need to call connection.commit() after inserts/deletes/updates.

Edit: you can call connection.autocommit(True) to turn on autocommit.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!