mebelousov opened a new issue #10641:
URL: https://github.com/apache/airflow/issues/10641


   Greenplum DB is a popular open source relational DBMS[1]. 
   
   I want to implement some database specific behaviour for a common class. 
It's easy to check connection type for postgres, mysql or oracle. Now I use 
postgres connection type for Greenplum and cannot explicitly check type. 
   
   Airflow has `PostgresHook` based on `psycopg2`. As Greenplum supports 
PostgreSQL libpq API [2], `PostgresHook` could be reused for Greenplum.
    
   As I see it's enough to change 2 code line in the `connectoin.py`.
   
   
   I'm not sure that it's nice to reuse `Hook`.
   Please confirm or reject my idea.
   
   
   ```diff
   Index: airflow/models/connection.py
   ===================================================================
   --- airflow/models/connection.py  (revision 
6416d898060706787861ff8ecbc4363152a35f45)
   +++ airflow/models/connection.py  (date 1598717245079)
   @@ -109,6 +109,7 @@
            ('grpc', 'GRPC Connection'),
            ('yandexcloud', 'Yandex Cloud'),
            ('spark', 'Spark'),
   +        ('greenplum', 'Greenplum'),
        ]
    
        def __init__(
   @@ -243,7 +244,7 @@
            elif self.conn_type == 'google_cloud_platform':
                from airflow.contrib.hooks.bigquery_hook import BigQueryHook
                return BigQueryHook(bigquery_conn_id=self.conn_id)
   -        elif self.conn_type == 'postgres':
   +        elif self.conn_type in ('postgres', 'greenplum'):
                from airflow.hooks.postgres_hook import PostgresHook
                return PostgresHook(postgres_conn_id=self.conn_id)
            elif self.conn_type == 'pig_cli':
   ```
   
   ---
   1. https://github.com/greenplum-db/gpdb
   2. 
https://gpdb.docs.pivotal.io/6-10/security-guide/topics/ports_and_protocols.html


----------------------------------------------------------------
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:
[email protected]


Reply via email to