feat: API endpoint to import dashboards (#11751)

* ImportChartsCommand

* feat: add a command to import dashboards

* feat: API endpoint to import dashboards

* Add dispatcher

* Raise specific exception

* Fix test

* Remove print calls

* Add logging when passing
This commit is contained in:
Beto Dealmeida
2020-11-24 22:45:35 -08:00
committed by GitHub
parent e4d02881d2
commit 501b9d47c5
19 changed files with 272 additions and 23 deletions

View File

@@ -40,6 +40,7 @@ from superset.datasets.commands.exceptions import (
DatasetCreateFailedError,
DatasetDeleteFailedError,
DatasetForbiddenError,
DatasetImportError,
DatasetInvalidError,
DatasetNotFoundError,
DatasetRefreshFailedError,
@@ -598,7 +599,7 @@ class DatasetRestApi(BaseSupersetModelRestApi):
@safe
@statsd_metrics
def import_(self) -> Response:
"""Import dataset (s) with associated databases
"""Import dataset(s) with associated databases
---
post:
requestBody:
@@ -642,6 +643,6 @@ class DatasetRestApi(BaseSupersetModelRestApi):
except CommandInvalidError as exc:
logger.warning("Import dataset failed")
return self.response_422(message=exc.normalized_messages())
except Exception as exc: # pylint: disable=broad-except
except DatasetImportError as exc:
logger.exception("Import dataset failed")
return self.response_500(message=str(exc))