This is an automated email from the ASF dual-hosted git repository.
hugh pushed a commit to branch hugh/rm-validation-blk
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/hugh/rm-validation-blk by this
push:
new 7a92272 remove validation check
7a92272 is described below
commit 7a9227200e7f1fb4f73f03b615b797d729af1901
Author: hughhhh <[email protected]>
AuthorDate: Wed Jun 23 13:44:12 2021 -0400
remove validation check
---
.../CRUD/data/database/DatabaseModal/index.tsx | 1 +
superset/db_engine_specs/bigquery.py | 23 +++++++++++++---------
2 files changed, 15 insertions(+), 9 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 1bcfaa0..c5a2bd7 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
@@ -242,6 +242,7 @@ function dbReducer(
if (action.payload.backend === 'bigquery') {
return {
...action.payload,
+ encrypted_extra: '',
engine: trimmedState.engine,
configuration_method: action.payload.configuration_method,
extra_json: deserializeExtraJSON,
diff --git a/superset/db_engine_specs/bigquery.py
b/superset/db_engine_specs/bigquery.py
index 97eb92f..b82ac54 100644
--- a/superset/db_engine_specs/bigquery.py
+++ b/superset/db_engine_specs/bigquery.py
@@ -24,14 +24,20 @@ from apispec import APISpec
from apispec.ext.marshmallow import MarshmallowPlugin
from flask_babel import gettext as __
from marshmallow import fields, Schema
+from marshmallow.exceptions import ValidationError
from sqlalchemy import literal_column
from sqlalchemy.engine.url import make_url
from sqlalchemy.sql.expression import ColumnClause
from typing_extensions import TypedDict
+from superset.databases.commands.exceptions import (
+ DatabaseInvalidError,
+ DatabaseUpdateFailedError,
+ InvalidParametersError,
+)
from superset.databases.schemas import encrypted_field_properties,
EncryptedField
from superset.db_engine_specs.base import BaseEngineSpec
-from superset.errors import SupersetError, SupersetErrorType
+from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
from superset.exceptions import SupersetGenericDBErrorException
from superset.sql_parse import Table
from superset.utils import core as utils
@@ -317,15 +323,16 @@ class BigQueryEngineSpec(BaseEngineSpec):
) -> str:
query = parameters.get("query", {})
query_params = urllib.parse.urlencode(query)
- if encrypted_extra:
- project_id = encrypted_extra.get("credentials_info",
{}).get("project_id")
+
+ if not encrypted_extra:
+ raise ValidationError("Missing service credentials")
+
+ project_id = encrypted_extra.get("credentials_info",
{}).get("project_id")
if project_id:
return f"{cls.default_driver}://{project_id}/?{query_params}"
- raise SupersetGenericDBErrorException(
- message="Big Query encrypted_extra is not available.",
- )
+ raise ValidationError("Invalid service credentials")
@classmethod
def get_parameters_from_uri(
@@ -337,9 +344,7 @@ class BigQueryEngineSpec(BaseEngineSpec):
if encrypted_extra:
return {**encrypted_extra, "query": value.query}
- raise SupersetGenericDBErrorException(
- message="Big Query encrypted_extra is not available.",
- )
+ raise ValidationError("Invalid service credentials")
@classmethod
def validate_parameters(