Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mysql database error
#2
If I'm right, mysql is multi-threads, so you could manage the problem if, at the first step, you start a transaction, and commit (or rollback) after reading what you want. By this way the second step (the same code actually) will start a new transaction when running, wich will wait the end of the first step (the commit) in the appropriate way.
I'm not sure of what's following, but this could be difficult to do if you don't use classes. I allways do it, creating a class for data access, and overriding that class when I need to access data from another part of the script. Establish and keep the connection in the class data ; it will done one time and will stay ready for the successive requests. I allways do it and it works well in that cases of the GUI event loop cross itself, making situations when you don't know exactly what occurs because it's almost difficult to debug.
Also, check what happens if mysql do a transaction for each request if you don't start it explicitely and commit it when you want.
I don't know if it's helpfull in your case, but I'm pretty sure if you make the effort to create separated classes for the different parts of your code, you will get a good value.
Reply


Messages In This Thread
mysql database error - by brecht83 - Dec-04-2018, 11:50 AM
RE: mysql database error - by jeanMichelBain - Dec-14-2018, 01:25 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  error in python and mysql statement vj78 4 2,855 Apr-08-2021, 02:08 PM
Last Post: vj78
  User Input to mySQL database newbie1 3 4,194 Aug-26-2020, 10:42 AM
Last Post: newbie1
  error when inserting list statement from python to MySQL ADBYITMS 0 1,579 Nov-10-2019, 10:44 AM
Last Post: ADBYITMS
  MySQL Database Flask maurosmartins 0 1,823 Oct-03-2019, 10:56 AM
Last Post: maurosmartins
  How to format a datetime MySQL database field to local using strftime() nikos 6 3,796 Feb-24-2019, 06:32 PM
Last Post: nikos

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020