mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-07-24 09:50:01 +00:00
Fix: Hive connection issue (#8583)
* Fix: Hive connection issue * Change based on comments
This commit is contained in:
parent
2ffb88f6aa
commit
4d16be2608
@ -336,12 +336,18 @@ def _(connection: HiveConnection):
|
||||
and hasattr(connection.connectionArguments, "auth")
|
||||
and connection.connectionArguments.auth in ("LDAP", "CUSTOM")
|
||||
):
|
||||
url += f"{quote_plus(connection.username)}"
|
||||
url += quote_plus(connection.username)
|
||||
if not connection.password:
|
||||
connection.password = SecretStr("")
|
||||
url += f":{quote_plus(connection.password.get_secret_value())}"
|
||||
url += "@"
|
||||
|
||||
elif connection.username:
|
||||
url += quote_plus(connection.username)
|
||||
if connection.password:
|
||||
url += f":{quote_plus(connection.password.get_secret_value())}"
|
||||
url += "@"
|
||||
|
||||
url += connection.hostPort
|
||||
url += f"/{connection.databaseSchema}" if connection.databaseSchema else ""
|
||||
|
||||
|
@ -197,7 +197,7 @@ class SouceConnectionTest(TestCase):
|
||||
assert expected_result == get_connection_url(hive_conn_obj)
|
||||
|
||||
def test_hive_url_without_auth(self):
|
||||
expected_result = "hive://localhost:10000"
|
||||
expected_result = "hive://username:password@localhost:10000"
|
||||
hive_conn_obj = HiveConnection(
|
||||
scheme=HiveScheme.hive.value,
|
||||
username="username",
|
||||
@ -207,6 +207,25 @@ class SouceConnectionTest(TestCase):
|
||||
)
|
||||
assert expected_result == get_connection_url(hive_conn_obj)
|
||||
|
||||
def test_hive_url_without_connection_arguments(self):
|
||||
expected_result = "hive://username:password@localhost:10000"
|
||||
hive_conn_obj = HiveConnection(
|
||||
scheme=HiveScheme.hive.value,
|
||||
username="username",
|
||||
password="password",
|
||||
hostPort="localhost:10000",
|
||||
)
|
||||
assert expected_result == get_connection_url(hive_conn_obj)
|
||||
|
||||
def test_hive_url_without_connection_arguments_pass(self):
|
||||
expected_result = "hive://username@localhost:10000"
|
||||
hive_conn_obj = HiveConnection(
|
||||
scheme=HiveScheme.hive.value,
|
||||
username="username",
|
||||
hostPort="localhost:10000",
|
||||
)
|
||||
assert expected_result == get_connection_url(hive_conn_obj)
|
||||
|
||||
def test_trino_url_without_params(self):
|
||||
expected_url = "trino://username:pass@localhost:443/catalog"
|
||||
trino_conn_obj = TrinoConnection(
|
||||
|
Loading…
x
Reference in New Issue
Block a user