Bouke Nederstigt created AIRFLOW-2316:
-----------------------------------------

             Summary: get_hook not updated for many connection types - can 
result in silent failure for BaseHook.get_hook()
                 Key: AIRFLOW-2316
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-2316
             Project: Apache Airflow
          Issue Type: Bug
          Components: models
    Affects Versions: Airflow 1.8, 1.9.0, 1.9.1
            Reporter: Bouke Nederstigt


Currently adding a new hook requires adjusting the Connection.get_hook() method 
in models.py. This seems to be overlooked by many hooks. Which in turn results 
in a (silent) failure to load hooks based on connection id only.

e.g. 

executing BaseHook.get_hook('s3connection') will return None because there is no
{code:java}
 elif self.conn_type == 's3':
{code}
statement in Connection.get_hook. Currently statements seem to be missing for 
the following connection types: fs, ftp, hdfs, http, hive_metastore, s3, samba, 
ssh, mesos_framework-id, databricks, aws, emr. 

Possible fix is to just add the extra elif statements for all of the missing 
connection types. To prevent this in the future a unit test can be added that 
checks the get_hook method returns an object for all items in the 
Connection._types list.  

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to