Skip to content

Commit

Permalink
bug fix (#17019)
Browse files Browse the repository at this point in the history
  • Loading branch information
AAfghahi committed Oct 8, 2021
1 parent a6173f1 commit e32a12f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,10 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
});
// cast the new encrypted extra object into a string
dbToUpdate.encrypted_extra = JSON.stringify(additionalEncryptedExtra);
// this needs to be added by default to gsheets
if (dbToUpdate.engine === 'gsheets') {
dbToUpdate.impersonate_user = true;
}
}

if (dbToUpdate?.parameters?.catalog) {
Expand Down
9 changes: 6 additions & 3 deletions superset/db_engine_specs/gsheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,12 @@ def validate_parameters(
cls, parameters: GSheetsParametersType,
) -> List[SupersetError]:
errors: List[SupersetError] = []
encrypted_credentials = json.loads(
parameters.get("service_account_info") or "{}"
)
encrypted_credentials = parameters.get("service_account_info") or "{}"

# On create the encrypted credentials are a string,
# at all other times they are a dict
if isinstance(encrypted_credentials, str):
encrypted_credentials = json.loads(encrypted_credentials)

table_catalog = parameters.get("catalog", {})

Expand Down

0 comments on commit e32a12f

Please sign in to comment.