mirror of
https://github.com/apache/superset.git
synced 2026-04-25 19:14:27 +00:00
fix: Handle bad permission errors for bigquery test connections (#14147)
* starter make file * yea * move messaging to config * Delete Makefile * remove * checkout * check for db generic errors * checkout bad files * add proper message * add docs for new permissions codes * Update superset/errors.py Co-authored-by: AAfghahi <48933336+AAfghahi@users.noreply.github.com> * Update superset/errors.py Co-authored-by: AAfghahi <48933336+AAfghahi@users.noreply.github.com> * rename var * starter regex * fix * fix * fix linting * update test * yerp * fixed test * added regex * Apply suggestions from code review Co-authored-by: Beto Dealmeida <roberto@dealmeida.net> * address comments * update docs * prettier * fux * add space * Update errors.py * Update types.ts Co-authored-by: AAfghahi <48933336+AAfghahi@users.noreply.github.com> Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>
This commit is contained in:
@@ -22,6 +22,7 @@ from sqlalchemy import column
|
||||
|
||||
from superset.db_engine_specs.base import BaseEngineSpec
|
||||
from superset.db_engine_specs.bigquery import BigQueryEngineSpec
|
||||
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
|
||||
from tests.db_engine_specs.base_tests import TestDbEngineSpec
|
||||
|
||||
|
||||
@@ -223,3 +224,18 @@ class TestBigQueryDbEngineSpec(TestDbEngineSpec):
|
||||
credentials="account_info",
|
||||
if_exists="extra_key",
|
||||
)
|
||||
|
||||
def test_extract_errors(self):
|
||||
msg = "403 POST https://bigquery.googleapis.com/bigquery/v2/projects/test-keel-310804/jobs?prettyPrint=false: Access Denied: Project User does not have bigquery.jobs.create permission in project profound-keel-310804"
|
||||
result = BigQueryEngineSpec.extract_errors(Exception(msg))
|
||||
assert result == [
|
||||
SupersetError(
|
||||
message="We were unable to connect to your database. Please confirm that your service account has the Viewer and Job User roles on the project.",
|
||||
error_type=SupersetErrorType.CONNECTION_DATABASE_PERMISSIONS_ERROR,
|
||||
level=ErrorLevel.ERROR,
|
||||
extra={
|
||||
"engine_name": "Google BigQuery",
|
||||
"issue_codes": [{"code": 1017, "message": "",}],
|
||||
},
|
||||
)
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user