Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions superset/db_engine_specs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,8 @@ def build_sqlalchemy_uri(
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")
Expand All @@ -1433,6 +1434,11 @@ def get_parameters_from_uri(
cls, uri: str, encrypted_extra: Optional[Dict[str, Any]] = None
) -> BasicParametersType:
url = make_url(uri)
query = {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also do this:

query = dict(item for item in url.query.items() if item not in cls.encryption_parameters.items())

key: value
for (key, value) in url.query.items()
if (key, value) not in cls.encryption_parameters.items()
Comment thread
betodealmeida marked this conversation as resolved.
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feel free to suggest a dryer way of doing this (some repetition with below)

encryption = all(
item in url.query.items() for item in cls.encryption_parameters.items()
)
Expand All @@ -1442,7 +1448,7 @@ def get_parameters_from_uri(
"host": url.host,
"port": url.port,
"database": url.database,
"query": url.query,
"query": query,
"encryption": encryption,
}

Expand Down