You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Cooper Gillan (JIRA)" <ji...@apache.org> on 2019/01/14 15:45:00 UTC

[jira] [Created] (AIRFLOW-3705) PostgresHook's get_conn method calls incorrect attribute by default

Cooper Gillan created AIRFLOW-3705:
--------------------------------------

             Summary: PostgresHook's get_conn method calls incorrect attribute by default 
                 Key: AIRFLOW-3705
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-3705
             Project: Apache Airflow
          Issue Type: Bug
          Components: database
    Affects Versions: 1.10.1
            Reporter: Cooper Gillan


The {{get_conn}} method of {{PostgresHook}} [callsĀ {{self.postgres_conn_id}} directly|https://github.com/apache/airflow/blob/c030729dcbe35a2a4869e46b57a761c8376ede8d/airflow/hooks/postgres_hook.py#L46] instead of using [{{self.conn_name_attr}}|https://github.com/apache/airflow/blob/c030729dcbe35a2a4869e46b57a761c8376ede8d/airflow/hooks/postgres_hook.py#L37], which could be overridden in a sub-class.

For example, if sub-classing {{PostgresHook}} to set up separate named connections to multiple Postgres instances, the {{postgres_conn_id}} of the sub-class must be set specifically. This is true despite the fact that {{conn_name_attr}} is set up in a way that should allow any connection to be specified.



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