fix: remove encryption from db params (#16214)

* remove encryption from db params

* Update superset/db_engine_specs/base.py

Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>

Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>
This commit is contained in:
Elizabeth Thompson 2021-08-12 12:03:14 -07:00 committed by GitHub
parent a1e18ed110
commit 67c4c0116e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -1410,7 +1410,8 @@ class BasicParametersMixin:
parameters: BasicParametersType,
encryted_extra: Optional[Dict[str, str]] = None,
) -> str:
query = parameters.get("query", {})
# make a copy so that we don't update the original
query = parameters.get("query", {}).copy()
if parameters.get("encryption"):
if not cls.encryption_parameters:
raise Exception("Unable to build a URL with encryption enabled")
@ -1433,6 +1434,11 @@ class BasicParametersMixin:
cls, uri: str, encrypted_extra: Optional[Dict[str, Any]] = None
) -> BasicParametersType:
url = make_url(uri)
query = {
key: value
for (key, value) in url.query.items()
if (key, value) not in cls.encryption_parameters.items()
}
encryption = all(
item in url.query.items() for item in cls.encryption_parameters.items()
)
@ -1442,7 +1448,7 @@ class BasicParametersMixin:
"host": url.host,
"port": url.port,
"database": url.database,
"query": url.query,
"query": query,
"encryption": encryption,
}