feat(airflow): respect port parameter if provided (#7945)

This commit is contained in:
Harshal Sheth 2023-05-03 04:58:22 +05:30 committed by GitHub
parent bf86235e26
commit 6833494347
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,6 +58,12 @@ class DatahubRestHook(BaseHook):
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)