You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2021/10/08 17:20:37 UTC
[superset] branch master updated: bug fix (#17019)
This is an automated email from the ASF dual-hosted git repository.
beto pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new e32a12f bug fix (#17019)
e32a12f is described below
commit e32a12fa0b45e7a00833d7733cb6c7a0cb3bb640
Author: AAfghahi <48...@users.noreply.github.com>
AuthorDate: Fri Oct 8 13:19:04 2021 -0400
bug fix (#17019)
---
.../src/views/CRUD/data/database/DatabaseModal/index.tsx | 4 ++++
superset/db_engine_specs/gsheets.py | 9 ++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
index e4f2704..c892816 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
@@ -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) {
diff --git a/superset/db_engine_specs/gsheets.py b/superset/db_engine_specs/gsheets.py
index 8136c17..3889e99 100644
--- a/superset/db_engine_specs/gsheets.py
+++ b/superset/db_engine_specs/gsheets.py
@@ -153,9 +153,12 @@ class GSheetsEngineSpec(SqliteEngineSpec):
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", {})