You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2022/10/05 23:18:31 UTC

[superset] 01/01: reference catalog for gsheets validation

This is an automated email from the ASF dual-hosted git repository.

hugh pushed a commit to branch fix-gsheet-edits
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 889add1c31b749ae4a5f049448240f2f4cb61aa5
Author: hughhhh <hu...@gmail.com>
AuthorDate: Wed Oct 5 19:18:08 2022 -0400

    reference catalog for gsheets validation
---
 superset/databases/schemas.py       |  7 +++++++
 superset/db_engine_specs/gsheets.py | 10 +++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/superset/databases/schemas.py b/superset/databases/schemas.py
index 201e35cbfc..3e9d100816 100644
--- a/superset/databases/schemas.py
+++ b/superset/databases/schemas.py
@@ -315,6 +315,13 @@ class DatabaseValidateParametersSchema(Schema):
         values=fields.Raw(allow_none=True),
         description="DB-specific parameters for configuration",
     )
+    catalog = fields.List(
+        fields.Dict(
+            keys=fields.String(),
+            values=fields.Raw(allow_none=True),
+            description="Gsheets specific column for managing label to sheet urls",
+        )
+    )
     database_name = fields.String(
         description=database_name_description,
         allow_none=True,
diff --git a/superset/db_engine_specs/gsheets.py b/superset/db_engine_specs/gsheets.py
index 78b42d2b3a..cc4328ab50 100644
--- a/superset/db_engine_specs/gsheets.py
+++ b/superset/db_engine_specs/gsheets.py
@@ -215,7 +215,15 @@ class GSheetsEngineSpec(SqliteEngineSpec):
         properties: GSheetsPropertiesType,
     ) -> List[SupersetError]:
         errors: List[SupersetError] = []
-        parameters = properties.get("parameters", {})
+
+        # backwards compatible just incase people are send data
+        # via parameters for validation
+        parameters = (
+            properties.get("parameters", {})
+            if properties.get("parameters")
+            else properties.get("catalog", {})
+        )
+
         encrypted_credentials = parameters.get("service_account_info") or "{}"
 
         # On create the encrypted credentials are a string,