From c72e2f159de1df625fe2bb19ef9ea839b929a0c2 Mon Sep 17 00:00:00 2001 From: Khushboo Vashi Date: Tue, 8 Aug 2023 11:00:52 +0530 Subject: [PATCH] Fix the query tool issue 'pgAdminThread' object has no attribute 'native_id'. #6660 --- web/pgadmin/tools/sqleditor/__init__.py | 4 +++- web/pgadmin/tools/sqleditor/utils/start_running_query.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/web/pgadmin/tools/sqleditor/__init__.py b/web/pgadmin/tools/sqleditor/__init__.py index 1c2314ade3d..71f5ffb8d04 100644 --- a/web/pgadmin/tools/sqleditor/__init__.py +++ b/web/pgadmin/tools/sqleditor/__init__.py @@ -920,7 +920,9 @@ def poll(trans_id): is_thread_alive = False if trans_obj.get_thread_native_id(): for thread in threading.enumerate(): - if thread.native_id == trans_obj.get_thread_native_id() and\ + _native_id = thread.native_id if hasattr(thread, 'native_id' + ) else thread.ident + if _native_id == trans_obj.get_thread_native_id() and\ thread.is_alive(): is_thread_alive = True break diff --git a/web/pgadmin/tools/sqleditor/utils/start_running_query.py b/web/pgadmin/tools/sqleditor/utils/start_running_query.py index 9c3076e3b9f..fdcf210a426 100644 --- a/web/pgadmin/tools/sqleditor/utils/start_running_query.py +++ b/web/pgadmin/tools/sqleditor/utils/start_running_query.py @@ -162,7 +162,9 @@ def asyn_exec_query(conn, sql, trans_obj, is_rollback_req, current_app._get_current_object()) ) _thread.start() - trans_obj.set_thread_native_id(_thread.native_id) + _native_id = _thread.native_id if hasattr(_thread, 'native_id' + ) else _thread.ident + trans_obj.set_thread_native_id(_native_id) StartRunningQuery.save_transaction_in_session(session_obj, trans_id, trans_obj)