Add new connection type - Greenplum
See original GitHub issueGreenplum 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.
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':
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
dblink | Pivotal Greenplum Docs
Use the dblink_connect() function to create either an implicit or a named connection to another database. The connection string that you provide should...
Read more >Greenplum Connections - Trifacta Documentation
Create Connection Name of the host. The port number of the Greenplum server. The default port value is 5432. The name of...
Read more >Establish datasource connection to Pivotal Greenplum database
From Cognos Administration, create a new data source with JDBC type, and choose Pivotal Greenplum in the connection string page.
Read more >Add a Greenplum database connection | ThoughtSpot Software
You can add a connection to a Greenplum database using ThoughtSpot DataFlow. Follow these steps: ... After you select the Greenplum Connection type,...
Read more >Configure Pivotal Greenplum Bulk Connection for Writing Data
Select Greenplum ODBC as the Driver; · Select new database connection; · Select your DSN from the drop-down and enter a value for...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@mebelousov I think in that case you don’t need to duplicate code. you can inherit from PostgresHook and overwrite only the methods that are incomparable.
You hook can be:
@mebelousov would you like to open a PR?