Skip to main content
se añadieron 2651 caracteres en el cuerpo; título editado
Origen Enlace

MySQLdb._exceptions.OperationalError: (2006, '') al cerrarservidor desaparece después de una consulta SQL. Es a causa de la connecion?en mi ETL

Al cerrarMi servidor MySQL desaparece después de miuna consulta SQL sobre la tabla cacia user en mi ETL obtengo un error:

(venv) C:\Users\antoi\Documents\Programming\Work\data-tools>python -m etl.main
2021-0607-2906 10:5912:37:15.814133134728 - Connecting to database hozana_data...
2021-0607-2906 10:5912:37:15.822142140731 - Connecting to archive database hozana_archive...
2021-0607-2906 1012:5937:3815.046134372728 - Start ETL main process
2021-0607-2906 1012:5937:3815.046134372728 - `users` table:
2021-0607-2906 1012:5937:3815.046134372728 - Hashing column `users`.`email:`
table_name:  users
c.execute("SELECT * FROM users"):  0
 done.
2021-0607-2906 1012:5937:3815.054091374727 - Hashing column `users`.`email_notification:`Traceback`
table_name:  users
(2006, '')
2021-07-06 12:37:15.375740 - Hashing column `users`.`last_name:`
table_name:  users
(2006, '')
2021-07-06 12:37:15.376728 - `messages` table:
Traceback (most recent call last):
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\task\anonymization.py", line 1771, in hash_columnmain
    c.execute(""""""UPDATE messages SET payload = '' WHERE type = 'text_message'""")
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\venv\lib\site-packages\MySQLdb\cursors.py", line 183, in execute
    while self.nextset():
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\venv\lib\site-packages\MySQLdb\cursors.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:\Users\antoi\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\antoi\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\main.py", line 52, in <module>
    main()
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\main.py", line 24, in main
    anonymization.main()
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\task\anonymization.py", line 5971, in main
    hash_column('users', 'email_notification', 'user_id', True)
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\task\anonymizationc.py", lineexecute("""UPDATE 50,messages inSET hash_column
payload = '' WHERE print('.',type end='',= flush=True'text_message'""")
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\venv\lib\site-packages\MySQLdb\connections.py", line 239, in __exit__
    self.close()
MySQLdb._exceptions.OperationalError: (2006, '')

Aqui esta el ETL. Este script fue hecho cuando la biblioteca era 1.3.7 y estoy tratando de cambiar a 2.0.3codigo:

def hash_column(table_name, column_name, pk_name, email_mode=False):
    # Executed a query that will overwrite a column with an hashed version of its content.
    # With email mode, the domain name will be kept:
    # [email protected] -> 379ac32fe8f576c4c63b17cd576e6c40c7dcd[...][email protected]
        try:
            info('Hashing column `{table_name}`.`{column_name}:`'
                 .format(table_name=table_name, column_name=column_name), end='', flush=True)
            with db as c:
                # Execute the update in batches, to avoid "Lock wait timeout exceeded"
                print("\ntable_name: ", table_name)
                c = c.cursor()
                print("c.execute(\"""SELECT * FROM users\"""): ", c.execute("SELECT * FROM users"))
                c.execute("""
                    SELECT {pk_name} as row_id
                    FROM {table_name}
                    WHERE {column_name} IS NOT NULL AND {column_name} NOT LIKE 'hash_%'
                    ORDER BY row_id ASC
                """.format(table_name=table_name, column_name=column_name, pk_name=pk_name))
                ids = []
                for row in c.fetchall():
                    row_id, = row
                    # cast to string, to avoid "expected str instance, int found" on join
                    ids.append(str(row_id))

                ids_chunks = chunks(list(ids), 50000)

                for ids in ids_chunks:
                    expression = """
                            CONCAT(
                                SHA2(SUBSTRING_INDEX(LOWER({column_name}), '@', 1), 512),
                                '@',
                                SUBSTRING_INDEX(LOWER({column_name}), '@', -1)
                            )
                        """.format(column_name=column_name) if email_mode \
                        else 'SHA2(LOWER({column_name}), 512)'.format(column_name=column_name)
                    print("c.execute(\"""SELECT COUNT(*) FROM users\"""): ",
                          c.execute("""SELECT COUNT(*) FROM {table_name}""").format(table_name=table_name))
                    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)

            print(' done.')
        except MySQLdb.OperationalError as e:
            print(e)

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

Al cerrar de mi consulta SQL sobre la tabla cacia user en mi ETL obtengo un error:

(venv) C:\Users\antoi\Documents\Programming\Work\data-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:\Users\antoi\Documents\Programming\Work\data-tools\etl\task\anonymization.py", line 17, in hash_column
    c.execute("""
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\venv\lib\site-packages\MySQLdb\cursors.py", line 183, in execute
    while self.nextset():
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\venv\lib\site-packages\MySQLdb\cursors.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:\Users\antoi\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\antoi\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\main.py", line 52, in <module>
    main()
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\main.py", line 24, in main
    anonymization.main()
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\task\anonymization.py", line 59, in main
    hash_column('users', 'email_notification', 'user_id', True)
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\task\anonymization.py", line 50, in hash_column
    print('.', end='', flush=True)
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\venv\lib\site-packages\MySQLdb\connections.py", line 239, in __exit__
    self.close()
MySQLdb._exceptions.OperationalError: (2006, '')

Aqui esta el ETL. Este script fue hecho cuando la biblioteca era 1.3.7 y estoy tratando de cambiar a 2.0.3:

    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)

MySQLdb._exceptions.OperationalError: (2006, '') servidor desaparece después de una consulta en mi ETL

Mi servidor MySQL desaparece después de una consulta:

(venv) C:\Users\antoi\Documents\Programming\Work\data-tools>python -m etl.main
2021-07-06 12:37:15.134728 - Connecting to database hozana_data...
2021-07-06 12:37:15.140731 - Connecting to archive database hozana_archive...
2021-07-06 12:37:15.372728 - Start ETL main process
2021-07-06 12:37:15.372728 - `users` table:
2021-07-06 12:37:15.372728 - Hashing column `users`.`email:`
table_name:  users
c.execute("SELECT * FROM users"):  0
 done.
2021-07-06 12:37:15.374727 - Hashing column `users`.`email_notification:`
table_name:  users
(2006, '')
2021-07-06 12:37:15.375740 - Hashing column `users`.`last_name:`
table_name:  users
(2006, '')
2021-07-06 12:37:15.376728 - `messages` table:
Traceback (most recent call last):
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\task\anonymization.py", line 71, in main
    c.execute("""UPDATE messages SET payload = '' WHERE type = 'text_message'""")
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\venv\lib\site-packages\MySQLdb\cursors.py", line 183, in execute
    while self.nextset():
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\venv\lib\site-packages\MySQLdb\cursors.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:\Users\antoi\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\antoi\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\main.py", line 52, in <module>
    main()
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\main.py", line 24, in main
    anonymization.main()
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\task\anonymization.py", line 71, in main
    c.execute("""UPDATE messages SET payload = '' WHERE type = 'text_message'""")
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\venv\lib\site-packages\MySQLdb\connections.py", line 239, in __exit__
    self.close()
MySQLdb._exceptions.OperationalError: (2006, '')

Aqui esta el codigo:

def hash_column(table_name, column_name, pk_name, email_mode=False):
    # Executed a query that will overwrite a column with an hashed version of its content.
    # With email mode, the domain name will be kept:
    # [email protected] -> 379ac32fe8f576c4c63b17cd576e6c40c7dcd[...][email protected]
        try:
            info('Hashing column `{table_name}`.`{column_name}:`'
                 .format(table_name=table_name, column_name=column_name), end='', flush=True)
            with db as c:
                # Execute the update in batches, to avoid "Lock wait timeout exceeded"
                print("\ntable_name: ", table_name)
                c = c.cursor()
                print("c.execute(\"""SELECT * FROM users\"""): ", c.execute("SELECT * FROM users"))
                c.execute("""
                    SELECT {pk_name} as row_id
                    FROM {table_name}
                    WHERE {column_name} IS NOT NULL AND {column_name} NOT LIKE 'hash_%'
                    ORDER BY row_id ASC
                """.format(table_name=table_name, column_name=column_name, pk_name=pk_name))
                ids = []
                for row in c.fetchall():
                    row_id, = row
                    # cast to string, to avoid "expected str instance, int found" on join
                    ids.append(str(row_id))

                ids_chunks = chunks(list(ids), 50000)

                for ids in ids_chunks:
                    expression = """
                            CONCAT(
                                SHA2(SUBSTRING_INDEX(LOWER({column_name}), '@', 1), 512),
                                '@',
                                SUBSTRING_INDEX(LOWER({column_name}), '@', -1)
                            )
                        """.format(column_name=column_name) if email_mode \
                        else 'SHA2(LOWER({column_name}), 512)'.format(column_name=column_name)
                    print("c.execute(\"""SELECT COUNT(*) FROM users\"""): ",
                          c.execute("""SELECT COUNT(*) FROM {table_name}""").format(table_name=table_name))
                    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)

            print(' done.')
        except MySQLdb.OperationalError as e:
            print(e)
se añadieron 100 caracteres en el cuerpo
Origen Enlace

Aqui esta el ETL. Este script fue hecho cuando la biblioteca era 1.3.7 y estoy tratando de cambiar a 2.0.3:

Aqui esta el ETL:

Aqui esta el ETL. Este script fue hecho cuando la biblioteca era 1.3.7 y estoy tratando de cambiar a 2.0.3:

Revertido a la revisión 3
Origen Enlace

When executing someAl cerrar de mi consulta SQL queries on thesobre la tabla cacia user table in myen mi ETL I get anobtengo un error:

(venv) C:\Users\antoi\Documents\Programming\Work\data-tools>python -m etl.main
2021-06-29 1510:3459:5337.515286814133 - Connecting to database hozana_data...
2021-06-29 1510:3459:5337.523283822142 - Connecting to archive database hozana_archive...
2021-06-29 1510:3459:5338.755949046134 - Start ETL main process
2021-06-29 1510:3459:5338.755949046134 - `users` table:
2021-06-29 1510:3459:5338.755949046134 - Hashing column `users`.`email:`table_name:  users
c.execute("SELECT 15+10 FROM users"):  0
` done.
2021-06-29 1510:3459:5338.763899054091 - Hashing column `users`.`email_notification:`table_name:  users
Traceback`Traceback (most recent call last):
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\task\anonymization.py", line 1817, in hash_column
    print("c.execute(\"""SELECT 15+10 FROM users\"""): ", c.execute("""SELECT 15+10 FROM users"""))"""
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\venv\lib\site-packages\MySQLdb\cursors.py", line 183, in execute
    while self.nextset():
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\venv\lib\site-packages\MySQLdb\cursors.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:\Users\antoi\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\antoi\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\main.py", line 52, in <module>
    main()
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\main.py", line 24, in main
    anonymization.main()
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\task\anonymization.py", line 6159, in main
    hash_column('users', 'email_notification', 'user_id', True)
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\task\anonymization.py", line 5250, in hash_column
    print('.', end='', flush=True)
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\venv\lib\site-packages\MySQLdb\connections.py", line 239, in __exit__
    self.close()
MySQLdb._exceptions.OperationalError: (2006, '')

I don't get it. This error seems to be because of a closed connection or too much data ... But I only have the schema, the database is empty. And even when I do a simple math operation I get this error:

Here is part of theAqui esta el ETL:

from etl.mysql.operations import drop_column_if_exists
from etl.utils.logging import info
from etl.mysql.connect import db, db_name
from etl.utilsc.array import chunks


def hash_columnexecute(table_name, column_name, pk_name, email_mode=False):"""
    # Executed a query that will overwrite a column with an hashed version ofUPDATE its`{table_name}` content.
    # With email mode, the domainSET name`{column_name}` will= beCONCAT('hash_', kept:{expression})
    # [email protected] -> 379ac32fe8f576c4c63b17cd576e6c40c7dcd[...][email protected]
 WHERE {pk_name} IN info('Hashing column `{table_name}`.`{column_nameids}:`')
         """.format(table_name=table_name, column_name=column_name), end='', flush=True)

    with db as c:
        # Execute the update in batchestable_name=table_name, to avoid "Lock waitcolumn_name=column_name, timeoutexpression=expression, exceeded"pk_name=pk_name,
        c = cids=','.cursorjoin(ids)
        print("table_name: ", table_name))
     
    print("c'.execute(\"""SELECT 15+10 FROM users\"""): "', c.execute("""SELECT 15+10 FROMend='', users""")flush=True)
       

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 c10:59:37.execute("""
            SELECT {pk_name} as row_id
            FROM {table_name} 
            WHERE {column_name} IS NOT NULL AND {column_name} NOT LIKE 'hash_%'
            ORDER BY row_id ASC
   814133 - Connecting to database """hozana_data.format(table_name=table_name, column_name=column_name, pk_name=pk_name))..
   2021-06-29 10:59:37.822142 - Connecting to idsarchive =database []
hozana_archive...

The problem isn't because of the connection, I have it and it's okay.

introducir la descripción de la imagen aquí

I tried to incrementIntenté aumentar el max_allowed_packet:

But it is still the same spacePero sigue siendo el mismo espacio:

When executing some SQL queries on the user table in my ETL I get an error:

(venv) C:\Users\antoi\Documents\Programming\Work\data-tools>python -m etl.main
2021-06-29 15:34:53.515286 - Connecting to database hozana_data...
2021-06-29 15:34:53.523283 - Connecting to archive database hozana_archive...
2021-06-29 15:34:53.755949 - Start ETL main process
2021-06-29 15:34:53.755949 - `users` table:
2021-06-29 15:34:53.755949 - Hashing column `users`.`email:`table_name:  users
c.execute("SELECT 15+10 FROM users"):  0
 done.
2021-06-29 15:34:53.763899 - Hashing column `users`.`email_notification:`table_name:  users
Traceback (most recent call last):
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\task\anonymization.py", line 18, in hash_column
    print("c.execute(\"""SELECT 15+10 FROM users\"""): ", c.execute("""SELECT 15+10 FROM users"""))
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\venv\lib\site-packages\MySQLdb\cursors.py", line 183, in execute
    while self.nextset():
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\venv\lib\site-packages\MySQLdb\cursors.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:\Users\antoi\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\antoi\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\main.py", line 52, in <module>
    main()
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\main.py", line 24, in main
    anonymization.main()
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\task\anonymization.py", line 61, in main
    hash_column('users', 'email_notification', 'user_id', True)
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\task\anonymization.py", line 52, in hash_column
    print('.', end='', flush=True)
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\venv\lib\site-packages\MySQLdb\connections.py", line 239, in __exit__
    self.close()
MySQLdb._exceptions.OperationalError: (2006, '')

I don't get it. This error seems to be because of a closed connection or too much data ... But I only have the schema, the database is empty. And even when I do a simple math operation I get this error:

Here is part of the ETL:

from etl.mysql.operations import drop_column_if_exists
from etl.utils.logging import info
from etl.mysql.connect import db, db_name
from etl.utils.array import chunks


def hash_column(table_name, column_name, pk_name, email_mode=False):
    # Executed a query that will overwrite a column with an hashed version of its content.
    # With email mode, the domain name will be kept:
    # [email protected] -> 379ac32fe8f576c4c63b17cd576e6c40c7dcd[...][email protected]
    info('Hashing column `{table_name}`.`{column_name}:`'
         .format(table_name=table_name, column_name=column_name), end='', flush=True)

    with db as c:
        # Execute the update in batches, to avoid "Lock wait timeout exceeded"
        c = c.cursor()
        print("table_name: ", table_name)
        print("c.execute(\"""SELECT 15+10 FROM users\"""): ", c.execute("""SELECT 15+10 FROM users"""))
        c.execute("""
            SELECT {pk_name} as row_id
            FROM {table_name} 
            WHERE {column_name} IS NOT NULL AND {column_name} NOT LIKE 'hash_%'
            ORDER BY row_id ASC
        """.format(table_name=table_name, column_name=column_name, pk_name=pk_name))
        ids = []
...

The problem isn't because of the connection, I have it and it's okay.

introducir la descripción de la imagen aquí

I tried to increment max_allowed_packet:

But it is still the same space:

Al cerrar de mi consulta SQL sobre la tabla cacia user en mi ETL obtengo un error:

(venv) C:\Users\antoi\Documents\Programming\Work\data-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:\Users\antoi\Documents\Programming\Work\data-tools\etl\task\anonymization.py", line 17, in hash_column
    c.execute("""
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\venv\lib\site-packages\MySQLdb\cursors.py", line 183, in execute
    while self.nextset():
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\venv\lib\site-packages\MySQLdb\cursors.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:\Users\antoi\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\antoi\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\main.py", line 52, in <module>
    main()
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\main.py", line 24, in main
    anonymization.main()
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\task\anonymization.py", line 59, in main
    hash_column('users', 'email_notification', 'user_id', True)
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\etl\task\anonymization.py", line 50, in hash_column
    print('.', end='', flush=True)
  File "C:\Users\antoi\Documents\Programming\Work\data-tools\venv\lib\site-packages\MySQLdb\connections.py", line 239, in __exit__
    self.close()
MySQLdb._exceptions.OperationalError: (2006, '')

Aqui esta el 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)

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...

Intenté aumentar el max_allowed_packet:

Pero sigue siendo el mismo espacio:

se añadieron 1039 caracteres en el cuerpo
Origen Enlace
Loading
se añadieron 43 caracteres en el cuerpo
Origen Enlace
Loading
se añadieron 397 caracteres en el cuerpo
Origen Enlace
Loading
Origen Enlace
Loading