[
https://issues.apache.org/jira/browse/AIRFLOW-3309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16687218#comment-16687218
]
ASF GitHub Bot commented on AIRFLOW-3309:
-----------------------------------------
kaxil closed pull request #4154: [AIRFLOW-3309] Add MongoDB connection
URL: https://github.com/apache/incubator-airflow/pull/4154
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/airflow/contrib/hooks/mongo_hook.py
b/airflow/contrib/hooks/mongo_hook.py
index 9280a51666..4d72f56566 100644
--- a/airflow/contrib/hooks/mongo_hook.py
+++ b/airflow/contrib/hooks/mongo_hook.py
@@ -27,7 +27,7 @@ class MongoHook(BaseHook):
ex.
{replicaSet: test, ssl: True, connectTimeoutMS: 30000}
"""
- conn_type = 'MongoDb'
+ conn_type = 'mongo'
def __init__(self, conn_id='mongo_default', *args, **kwargs):
super(MongoHook, self).__init__(source='mongo')
diff --git a/airflow/models.py b/airflow/models.py
index a428c8abb7..8b476afde4 100755
--- a/airflow/models.py
+++ b/airflow/models.py
@@ -667,6 +667,7 @@ class Connection(Base, LoggingMixin):
('azure_data_lake', 'Azure Data Lake'),
('cassandra', 'Cassandra',),
('qubole', 'Qubole'),
+ ('mongo', 'MongoDB'),
('gcpcloudsql', 'Google Cloud SQL'),
]
@@ -808,6 +809,9 @@ def get_hook(self):
elif self.conn_type == 'cassandra':
from airflow.contrib.hooks.cassandra_hook import CassandraHook
return CassandraHook(cassandra_conn_id=self.conn_id)
+ elif self.conn_type == 'mongo':
+ from airflow.contrib.hooks.mongo_hook import MongoHook
+ return MongoHook(conn_id=self.conn_id)
elif self.conn_type == 'gcpcloudsql':
from airflow.contrib.hooks.gcp_sql_hook import
CloudSqlDatabaseHook
return CloudSqlDatabaseHook(gcp_cloudsql_conn_id=self.conn_id)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Missing Mongo DB connection type
> --------------------------------
>
> Key: AIRFLOW-3309
> URL: https://issues.apache.org/jira/browse/AIRFLOW-3309
> Project: Apache Airflow
> Issue Type: Bug
> Components: database
> Affects Versions: 1.10.0
> Reporter: John Cheng
> Assignee: John Cheng
> Priority: Minor
> Fix For: 2.0.0
>
>
> Unable to choose Mongo DBÂ on the admin console connection page.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)