# Функция для замены NULL на пустые строки def replace_null_with_empty_string(conn): cursor = conn.cursor() query = """ UPDATE contacts SET name = COALESCE(name, ''), phone = COALESCE(phone, ''), email = COALESCE(email, '') """ cursor.execute(query) conn.commit()