diff --git a/ingestion/src/metadata/utils/source_connections.py b/ingestion/src/metadata/utils/source_connections.py index 5c4908645a6..b1c498755e3 100644 --- a/ingestion/src/metadata/utils/source_connections.py +++ b/ingestion/src/metadata/utils/source_connections.py @@ -340,9 +340,6 @@ def _(connection: HiveConnection): ) if options: - if not connection.databaseSchema: - url += "/" - url += "/" params = "&".join( f"{key}={quote_plus(value)}" for (key, value) in options.items() if value ) diff --git a/ingestion/tests/unit/test_source_connection.py b/ingestion/tests/unit/test_source_connection.py index 02bcda73275..902c2b424bc 100644 --- a/ingestion/tests/unit/test_source_connection.py +++ b/ingestion/tests/unit/test_source_connection.py @@ -143,6 +143,23 @@ class SouceConnectionTest(TestCase): ) assert expected_result == get_connection_url(hive_conn_obj) + def test_hive_url_conn_options_with_db(self): + expected_result = "hive://localhost:10000/test_db?Key=Value" + hive_conn_obj = HiveConnection( + hostPort="localhost:10000", + databaseSchema="test_db", + connectionOptions={"Key": "Value"}, + ) + assert expected_result == get_connection_url(hive_conn_obj) + + def test_hive_url_conn_options_without_db(self): + expected_result = "hive://localhost:10000?Key=Value" + hive_conn_obj = HiveConnection( + hostPort="localhost:10000", + connectionOptions={"Key": "Value"}, + ) + assert expected_result == get_connection_url(hive_conn_obj) + def test_hive_url_with_kerberos_auth(self): expected_result = "hive://localhost:10000" hive_conn_obj = HiveConnection(