python – MySQLdb._exceptions.OperationalError: (2006, ”) al cerrar una consulta SQL. Es a causa de la connecion?

Al cerrar de mi consulta SQL en mi ETL:

    c.execute("""
        UPDATE `{table_name}` 
        SET `{column_name}` = CONCAT('hash_', {expression})
        WHERE {pk_name} IN ({ids})
    """.format(
        table_name=table_name, column_name=column_name, expression=expression, pk_name=pk_name,
        ids=','.join(ids)
    ))

    print('.', end='', flush=True)

Obtengo un error:

(venv) C:UsersantoiDocumentsProgrammingWorkdata-tools>python -m etl.main
2021-06-29 10:59:37.814133 - Connecting to database hozana_data...
2021-06-29 10:59:37.822142 - Connecting to archive database hozana_archive...
2021-06-29 10:59:38.046134 - Start ETL main process
2021-06-29 10:59:38.046134 - `users` table:
2021-06-29 10:59:38.046134 - Hashing column `users`.`email:` done.
2021-06-29 10:59:38.054091 - Hashing column `users`.`email_notification:`Traceback (most recent call last):
  File "C:UsersantoiDocumentsProgrammingWorkdata-toolsetltaskanonymization.py", line 17, in hash_column
    c.execute("""
  File "C:UsersantoiDocumentsProgrammingWorkdata-toolsvenvlibsite-packagesMySQLdbcursors.py", line 183, in execute
    while self.nextset():
  File "C:UsersantoiDocumentsProgrammingWorkdata-toolsvenvlibsite-packagesMySQLdbcursors.py", line 137, in nextset
    nr = db.next_result()
MySQLdb._exceptions.OperationalError: (2006, '')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:UsersantoiAppDataLocalProgramsPythonPython39librunpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:UsersantoiAppDataLocalProgramsPythonPython39librunpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:UsersantoiDocumentsProgrammingWorkdata-toolsetlmain.py", line 52, in <module>
    main()
  File "C:UsersantoiDocumentsProgrammingWorkdata-toolsetlmain.py", line 24, in main
    anonymization.main()
  File "C:UsersantoiDocumentsProgrammingWorkdata-toolsetltaskanonymization.py", line 59, in main
    hash_column('users', 'email_notification', 'user_id', True)
  File "C:UsersantoiDocumentsProgrammingWorkdata-toolsetltaskanonymization.py", line 50, in hash_column
    print('.', end='', flush=True)
  File "C:UsersantoiDocumentsProgrammingWorkdata-toolsvenvlibsite-packagesMySQLdbconnections.py", line 239, in __exit__
    self.close()
MySQLdb._exceptions.OperationalError: (2006, '')

Parece que es cuando el cliente no puede enviar una pregunta al servidor, muy probablemente porque el propio servidor ha cerrado la conexión. Sin embargo pensaba que ya habia la conexion:

introducir la descripción de la imagen aquí

Ademas hay estas lineas al principio:

2021-06-29 10:59:37.814133 - Connecting to database hozana_data...
2021-06-29 10:59:37.822142 - Connecting to archive database hozana_archive...