Fix: connector for hive has double dash (#7953)

This commit is contained in:
Milan Bariya 2022-10-05 15:31:13 +05:30 committed by GitHub
parent 7deebe8a2c
commit cd43f1fdcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 3 deletions

View File

@ -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
)

View File

@ -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(