mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2026-01-06 04:26:57 +00:00
* Fix #6823: Fix hive attribute error * Empty commit to start test
This commit is contained in:
parent
3f1fc5344a
commit
7c004a6785
@ -317,15 +317,17 @@ def _(connection: SnowflakeConnection):
|
||||
@get_connection_url.register
|
||||
def _(connection: HiveConnection):
|
||||
url = f"{connection.scheme.value}://"
|
||||
if connection.connectionArguments:
|
||||
if connection.connectionArguments.auth in ("LDAP", "CUSTOM"):
|
||||
if connection.username:
|
||||
url += f"{connection.username}"
|
||||
if not connection.password:
|
||||
connection.password = SecretStr("")
|
||||
url += f":{quote_plus(connection.password.get_secret_value())}"
|
||||
|
||||
url += "@"
|
||||
if (
|
||||
connection.username
|
||||
and connection.connectionArguments
|
||||
and hasattr(connection.connectionArguments, "auth")
|
||||
and connection.connectionArguments.auth in ("LDAP", "CUSTOM")
|
||||
):
|
||||
url += f"{connection.username}"
|
||||
if not connection.password:
|
||||
connection.password = SecretStr("")
|
||||
url += f":{quote_plus(connection.password.get_secret_value())}"
|
||||
url += "@"
|
||||
|
||||
url += connection.hostPort
|
||||
url += f"/{connection.databaseSchema}" if connection.databaseSchema else ""
|
||||
@ -335,6 +337,7 @@ def _(connection: HiveConnection):
|
||||
if connection.connectionOptions
|
||||
else connection.connectionOptions
|
||||
)
|
||||
|
||||
if options:
|
||||
if not connection.databaseSchema:
|
||||
url += "/"
|
||||
|
||||
@ -154,6 +154,17 @@ class SouceConnectionTest(TestCase):
|
||||
)
|
||||
assert expected_result == get_connection_url(hive_conn_obj)
|
||||
|
||||
def test_hive_url_without_auth(self):
|
||||
expected_result = "hive://localhost:10000"
|
||||
hive_conn_obj = HiveConnection(
|
||||
scheme=HiveScheme.hive.value,
|
||||
username="username",
|
||||
password="password",
|
||||
hostPort="localhost:10000",
|
||||
connectionArguments={"customKey": "value"},
|
||||
)
|
||||
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