You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/03/31 15:44:51 UTC

[GitHub] [airflow] zhongjiajie commented on a change in pull request #7903: Add conn_name and get_connection to dbapi_hook

zhongjiajie commented on a change in pull request #7903: Add conn_name and get_connection to dbapi_hook
URL: https://github.com/apache/airflow/pull/7903#discussion_r401018865
 
 

 ##########
 File path: airflow/hooks/dbapi_hook.py
 ##########
 @@ -61,10 +61,17 @@ def __init__(self, *args, **kwargs):
             raise AirflowException("conn_name_attr is not defined")
         elif len(args) == 1:
             setattr(self, self.conn_name_attr, args[0])
-        elif self.conn_name_attr not in kwargs:
-            setattr(self, self.conn_name_attr, self.default_conn_name)
-        else:
+        elif self.conn_name_attr in kwargs:
             setattr(self, self.conn_name_attr, kwargs[self.conn_name_attr])
+        else:
+            setattr(self, self.conn_name_attr, self.default_conn_name)
+
+    @property
+    def conn_name(self) -> str:
+        """
+        Get conn_name to avoid pylint no-member in subclass
 
 Review comment:
   Sorry, I just force push and forget fetch from my origin

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services