This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 232f7d1  fix get_connections deprecation warn in hivemetastore hook 
(#18854)
232f7d1 is described below

commit 232f7d158741405f959e8b09b1687238920306a0
Author: Aakcht <[email protected]>
AuthorDate: Sun Oct 10 16:56:54 2021 +0300

    fix get_connections deprecation warn in hivemetastore hook (#18854)
---
 airflow/providers/apache/hive/hooks/hive.py | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/airflow/providers/apache/hive/hooks/hive.py 
b/airflow/providers/apache/hive/hooks/hive.py
index b7ac8ef..71c2d31 100644
--- a/airflow/providers/apache/hive/hooks/hive.py
+++ b/airflow/providers/apache/hive/hooks/hive.py
@@ -544,16 +544,15 @@ class HiveMetastoreHook(BaseHook):
         return hmsclient.HMSClient(iprot=protocol)
 
     def _find_valid_server(self) -> Any:
-        conns = self.get_connections(self.conn_id)
-        for conn in conns:
-            host_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-            self.log.info("Trying to connect to %s:%s", conn.host, conn.port)
-            if host_socket.connect_ex((conn.host, conn.port)) == 0:
-                self.log.info("Connected to %s:%s", conn.host, conn.port)
-                host_socket.close()
-                return conn
-            else:
-                self.log.error("Could not connect to %s:%s", conn.host, 
conn.port)
+        conn = self.get_connection(self.conn_id)
+        host_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        self.log.info("Trying to connect to %s:%s", conn.host, conn.port)
+        if host_socket.connect_ex((conn.host, conn.port)) == 0:
+            self.log.info("Connected to %s:%s", conn.host, conn.port)
+            host_socket.close()
+            return conn
+        else:
+            self.log.error("Could not connect to %s:%s", conn.host, conn.port)
         return None
 
     def get_conn(self) -> Any:

Reply via email to