From 77c650aa55a4f651c7be746ea22814c61b942e75 Mon Sep 17 00:00:00 2001 From: Elizabeth Thompson Date: Wed, 11 Aug 2021 16:36:26 -0700 Subject: [PATCH] remove encryption from db params --- superset/db_engine_specs/base.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/superset/db_engine_specs/base.py b/superset/db_engine_specs/base.py index 261bedee94dab..33bcf3944c64a 100644 --- a/superset/db_engine_specs/base.py +++ b/superset/db_engine_specs/base.py @@ -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 = dict(parameters.get("query", {})) if parameters.get("encryption"): if not cls.encryption_parameters: raise Exception("Unable to build a URL with encryption enabled") @@ -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 = { + 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 @@ def get_parameters_from_uri( "host": url.host, "port": url.port, "database": url.database, - "query": url.query, + "query": query, "encryption": encryption, }