[ https://issues.apache.org/jira/browse/AIRFLOW-3705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16949734#comment-16949734 ]
ASF subversion and git services commented on AIRFLOW-3705: ---------------------------------------------------------- Commit f98ce4a122e959035d6d91b24dc253fab66f4d0c in airflow's branch refs/heads/v1-10-stable from Cooper Gillan [ https://gitbox.apache.org/repos/asf?p=airflow.git;h=f98ce4a ] [AIRFLOW-3705] Fix PostgresHook get_conn to use conn_name_attr (#5841) Update PostgresHook's get_conn method to directly call the specified conn_name_attr rather that always using self.postgres_conn_id. Currently subclassing PostgresHook requires overriding the postgres_conn_id attribute in order to establish a separate connection. Add an additional unit test for this case checking that the subclassed PostgresHook's get_conn calls the correct arguments and that the hook calls the correction connection_id in get_connection. (cherry picked from commit f823a66001c9f3682153acbf27bca137d0f4a7ec) > 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.2 > Reporter: Cooper Gillan > Assignee: Cooper Gillan > Priority: Minor > Fix For: 1.10.6 > > > Sub-classing {{PostgresHook}} to specify separate connections is currently > not possible due to [{{get_conn}} callingĀ {{self.postgres_conn_id}} > directly|https://github.com/apache/airflow/blob/c030729dcbe35a2a4869e46b57a761c8376ede8d/airflow/hooks/postgres_hook.py#L46]. > It should be possible to set different values for > [{{self.conn_name_attr}}|https://github.com/apache/airflow/blob/c030729dcbe35a2a4869e46b57a761c8376ede8d/airflow/hooks/postgres_hook.py#L37], > in sub-classes of the hook. > 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 (v8.3.4#803005)