You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Fokko Driesprong (JIRA)" <ji...@apache.org> on 2019/02/19 15:43:00 UTC
[jira] [Resolved] (AIRFLOW-3910) Raise exception explicitly in
Connection.get_hook() instead of pass silently
[ https://issues.apache.org/jira/browse/AIRFLOW-3910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fokko Driesprong resolved AIRFLOW-3910.
---------------------------------------
Resolution: Fixed
Fix Version/s: 2.0.0
> Raise exception explicitly in Connection.get_hook() instead of pass silently
> ----------------------------------------------------------------------------
>
> Key: AIRFLOW-3910
> URL: https://issues.apache.org/jira/browse/AIRFLOW-3910
> Project: Apache Airflow
> Issue Type: Improvement
> Components: models
> Affects Versions: 1.10.2
> Reporter: Xiaodong DENG
> Assignee: Xiaodong DENG
> Priority: Minor
> Fix For: 2.0.0
>
>
> Currently in Connection.get_hook(), a try-except clause is used for creating hook based on conn_id and conn_type. If something goes wrong, it pass silently and return None.
>
> But this may cause trouble. Let’s say I’m getting hook from a postgres connection, while package `psycopg2` is not installed. Then actually getting hook will fail. But it will pass silently, and None will be returned as the hook.
>
> I found this issue when I’m using SqlSensor for PostgresSQL. I keep getting error
> “AttributeError: 'NoneType' object has no attribute 'get_records’", but very hard to get a clue what causes this error.
>
> So here we should raise exception explicitly when anything goes wrong in Connection.get_hook().
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)