fix: Big Query Edit Form (#14850)

* fix big quert edit form

* fix test

* fix api test

* fix test
This commit is contained in:
Hugh A. Miles II 2021-05-26 16:13:26 -04:00 committed by GitHub
parent e466066229
commit ae8378a50e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 3 deletions

View File

@ -1372,7 +1372,9 @@ class BasicParametersMixin:
) )
@classmethod @classmethod
def get_parameters_from_uri(cls, uri: str) -> BasicParametersType: def get_parameters_from_uri(
cls, uri: str, encrypted_extra: Optional[Dict[str, Any]] = None
) -> BasicParametersType:
url = make_url(uri) url = make_url(uri)
encryption = all( encryption = all(
item in url.query.items() for item in cls.encryption_parameters.items() item in url.query.items() for item in cls.encryption_parameters.items()

View File

@ -49,7 +49,7 @@ ma_plugin = MarshmallowPlugin()
class BigQueryParametersSchema(Schema): class BigQueryParametersSchema(Schema):
credentials_info = EncryptedField( credentials_info = EncryptedField(
description="Contents of BigQuery JSON credentials.", required=True, description="Contents of BigQuery JSON credentials.",
) )

View File

@ -246,7 +246,8 @@ class Database(
self.db_engine_spec, "get_parameters_from_uri" self.db_engine_spec, "get_parameters_from_uri"
): ):
uri = make_url(self.sqlalchemy_uri_decrypted) uri = make_url(self.sqlalchemy_uri_decrypted)
return {**parameters, **self.db_engine_spec.get_parameters_from_uri(uri)} # type: ignore encrypted_extra = self.get_encrypted_extra()
return {**parameters, **self.db_engine_spec.get_parameters_from_uri(uri, encrypted_extra=encrypted_extra)} # type: ignore
return parameters return parameters

View File

@ -1448,6 +1448,7 @@ class TestDatabaseApi(SupersetTestCase):
"x-encrypted-extra": True, "x-encrypted-extra": True,
} }
}, },
"required": ["credentials_info"],
"type": "object", "type": "object",
}, },
"preferred": True, "preferred": True,