mirror of https://github.com/apache/superset.git
chore: fix deprecation warnings for SQLALchemy URL (#23770)
This commit is contained in:
parent
e3719a1b07
commit
0788b5fdcc
|
@ -1947,7 +1947,7 @@ class BasicParametersMixin:
|
|||
query.update(cls.encryption_parameters)
|
||||
|
||||
return str(
|
||||
URL(
|
||||
URL.create(
|
||||
f"{cls.engine}+{cls.default_driver}".rstrip("+"), # type: ignore
|
||||
username=parameters.get("username"),
|
||||
password=parameters.get("password"),
|
||||
|
|
|
@ -314,7 +314,7 @@ class ClickHouseConnectEngineSpec(ClickHouseEngineSpec, BasicParametersMixin):
|
|||
if not url_params.get("database"):
|
||||
url_params["database"] = "__default__"
|
||||
url_params.pop("encryption", None)
|
||||
return str(URL(f"{cls.engine}+{cls.default_driver}", **url_params))
|
||||
return str(URL.create(f"{cls.engine}+{cls.default_driver}", **url_params))
|
||||
|
||||
@classmethod
|
||||
def get_parameters_from_uri(
|
||||
|
|
|
@ -200,7 +200,7 @@ class DatabricksNativeEngineSpec(DatabricksODBCEngineSpec, BasicParametersMixin)
|
|||
query.update(cls.encryption_parameters)
|
||||
|
||||
return str(
|
||||
URL(
|
||||
URL.create(
|
||||
f"{cls.engine}+{cls.default_driver}".rstrip("+"),
|
||||
username="token",
|
||||
password=parameters.get("access_token"),
|
||||
|
|
|
@ -265,7 +265,7 @@ class SnowflakeEngineSpec(PostgresBaseEngineSpec):
|
|||
] = None,
|
||||
) -> str:
|
||||
return str(
|
||||
URL(
|
||||
URL.create(
|
||||
"snowflake",
|
||||
username=parameters.get("username"),
|
||||
password=parameters.get("password"),
|
||||
|
|
|
@ -36,7 +36,7 @@ def test_odbc_impersonation() -> None:
|
|||
|
||||
from superset.db_engine_specs.drill import DrillEngineSpec
|
||||
|
||||
url = URL("drill+odbc")
|
||||
url = URL.create("drill+odbc")
|
||||
username = "DoAsUser"
|
||||
url = DrillEngineSpec.get_url_for_impersonation(url, True, username)
|
||||
assert url.query["DelegationUID"] == username
|
||||
|
@ -52,7 +52,7 @@ def test_jdbc_impersonation() -> None:
|
|||
|
||||
from superset.db_engine_specs.drill import DrillEngineSpec
|
||||
|
||||
url = URL("drill+jdbc")
|
||||
url = URL.create("drill+jdbc")
|
||||
username = "DoAsUser"
|
||||
url = DrillEngineSpec.get_url_for_impersonation(url, True, username)
|
||||
assert url.query["impersonation_target"] == username
|
||||
|
@ -68,7 +68,7 @@ def test_sadrill_impersonation() -> None:
|
|||
|
||||
from superset.db_engine_specs.drill import DrillEngineSpec
|
||||
|
||||
url = URL("drill+sadrill")
|
||||
url = URL.create("drill+sadrill")
|
||||
username = "DoAsUser"
|
||||
url = DrillEngineSpec.get_url_for_impersonation(url, True, username)
|
||||
assert url.query["impersonation_target"] == username
|
||||
|
@ -86,7 +86,7 @@ def test_invalid_impersonation() -> None:
|
|||
from superset.db_engine_specs.drill import DrillEngineSpec
|
||||
from superset.db_engine_specs.exceptions import SupersetDBAPIProgrammingError
|
||||
|
||||
url = URL("drill+foobar")
|
||||
url = URL.create("drill+foobar")
|
||||
username = "DoAsUser"
|
||||
|
||||
with pytest.raises(SupersetDBAPIProgrammingError):
|
||||
|
|
Loading…
Reference in New Issue