2

I have created a MySQL db using the code:

my_engine = create_engine(
    "mysql+pymysql://{user}:{pw}@{host}/{db}".format(
        host='localhost:8000',
        user="user_name",
        pw="user_pass",
        db="my_db"),
    echo=True,
    )

the code

my_engine.execute( 'DROP TABLE IF EXISTS {}'.format(table) )

works intermittently, causing python to stall (and the db to freeze) for certain tables. Do you know what this may depend upon?

Andreuccio
  • 1,053
  • 2
  • 18
  • 32
  • likely a table locking issue (not a fan of MySQL table locking). Info on table locking and what to look for here https://stackoverflow.com/questions/2499976/detecting-locked-tables-locked-by-lock-table – Twelfth Mar 16 '18 at 16:39
  • @Twelfththanks for your reply. I am not sure that is the issue though, as the same tables eventually get dropped upon trying over and over – Andreuccio Mar 16 '18 at 17:11
  • That will happen as locks are released eventually. Do you have multiple users in the database here, or is the only traffic from you? – Twelfth Mar 16 '18 at 17:49
  • 1
    @Twelfth sorry I only saw your comment. The only traffic is from me however I tent to access it both using a python connection and a MySQL manager at the same time. Could that be the issue – Andreuccio Mar 17 '18 at 18:32

0 Answers0