Skip to content

Commit

Permalink
add missing file
Browse files Browse the repository at this point in the history
  • Loading branch information
shirshanka committed Jul 20, 2022
1 parent 22091d5 commit 4037d55
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions metadata-ingestion/src/datahub/ingestion/run/connection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import logging

from datahub.ingestion.api.source import TestConnectionReport
from datahub.ingestion.source.source_registry import source_registry

logger = logging.getLogger(__name__)


class ConnectionManager:
"""A class that helps build / manage / triage connections"""

def test_source_connection(self, recipe_config_dict: dict) -> TestConnectionReport:
# pulls out the source component of the dictionary
# walks the type registry to find the source class
# calls specific class.test_connection
try:
source_type = recipe_config_dict.get("source", {}).get("type")
source_class = source_registry.get(source_type)
return source_class.test_connection(
recipe_config_dict.get("source", {}).get("config", {})
)
except Exception as e:
logger.error(e)
raise e

0 comments on commit 4037d55

Please sign in to comment.