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

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


The following commit(s) were added to refs/heads/master by this push:
     new cdc2090  MySQL hook respects conn_name_attr (#14240)
cdc2090 is described below

commit cdc20904a59610822968ab57aa127d989ec7e2a5
Author: Constantino Schillebeeckx 
<[email protected]>
AuthorDate: Wed Feb 17 04:54:02 2021 -0500

    MySQL hook respects conn_name_attr (#14240)
    
    The MySQL hook does not properly use the class attribute `conn_name_attr` in
    the get_conn method; this adjusts that method to use the same approach as 
the
    get_uri method.
---
 airflow/providers/mysql/hooks/mysql.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/airflow/providers/mysql/hooks/mysql.py 
b/airflow/providers/mysql/hooks/mysql.py
index 7d1f71f..e5e9017 100644
--- a/airflow/providers/mysql/hooks/mysql.py
+++ b/airflow/providers/mysql/hooks/mysql.py
@@ -133,7 +133,9 @@ class MySqlHook(DbApiHook):
 
         :return: a mysql connection object
         """
-        conn = self.connection or self.get_connection(self.mysql_conn_id)  # 
pylint: disable=no-member
+        conn = self.connection or self.get_connection(
+            getattr(self, self.conn_name_attr)
+        )  # pylint: disable=no-member
 
         client_name = conn.extra_dejson.get('client', 'mysqlclient')
 

Reply via email to