From 6833494347aa8cfc8f2d6e908bcf9bf5b7ef1d71 Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Wed, 3 May 2023 04:58:22 +0530 Subject: [PATCH] feat(airflow): respect port parameter if provided (#7945) --- metadata-ingestion/src/datahub_provider/hooks/datahub.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/metadata-ingestion/src/datahub_provider/hooks/datahub.py b/metadata-ingestion/src/datahub_provider/hooks/datahub.py index 1343e34954975..e8ae417ac3e76 100644 --- a/metadata-ingestion/src/datahub_provider/hooks/datahub.py +++ b/metadata-ingestion/src/datahub_provider/hooks/datahub.py @@ -58,6 +58,12 @@ def _get_config(self) -> Tuple[str, Optional[str], Optional[int]]: host = conn.host if host is None: raise AirflowException("host parameter is required") + if conn.port: + if ":" in host: + raise AirflowException( + "host parameter should not contain a port number if the port is specified separately" + ) + host = f"{host}:{conn.port}" password = conn.password timeout_sec = conn.extra_dejson.get("timeout_sec") return (host, password, timeout_sec)