chore: remove deprecated apis /slice_json/ and /annotation_json/ (#24423)
This commit is contained in:
parent
62364a4b15
commit
d6a61c125a
|
|
@ -69,12 +69,10 @@
|
||||||
|can slice on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|
|can slice on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|
||||||
|can sync druid source on Superset|:heavy_check_mark:|O|O|O|
|
|can sync druid source on Superset|:heavy_check_mark:|O|O|O|
|
||||||
|can explore on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|
|can explore on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|
||||||
|can slice json on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|
|
||||||
|can approve on Superset|:heavy_check_mark:|O|O|O|
|
|can approve on Superset|:heavy_check_mark:|O|O|O|
|
||||||
|can explore json on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|
|can explore json on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|
||||||
|can fetch datasource metadata on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|
|can fetch datasource metadata on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|
||||||
|can csrf token on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|
|can csrf token on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|
||||||
|can annotation json on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|
|
||||||
|can sqllab on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|
|
|can sqllab on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|
|
||||||
|can select star on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|
|can select star on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|
||||||
|can warm up cache on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|
|can warm up cache on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ assists people when migrating to a new version.
|
||||||
|
|
||||||
### Breaking Changes
|
### Breaking Changes
|
||||||
|
|
||||||
|
- [24423](https://github.com/apache/superset/pull/24423): Removed deprecated APIs `/superset/slice_json/...`, `/superset/annotation_json/...`
|
||||||
- [24400](https://github.com/apache/superset/pull/24400): Removed deprecated APIs `/superset/recent_activity/...`, `/superset/fave_dashboards_by_username/...`, `/superset/fave_dashboards/...`, `/superset/created_dashboards/...`, `/superset/user_slices/`, `/superset/created_slices/...`, `/superset/fave_slices/...`, `/superset/favstar/...`,
|
- [24400](https://github.com/apache/superset/pull/24400): Removed deprecated APIs `/superset/recent_activity/...`, `/superset/fave_dashboards_by_username/...`, `/superset/fave_dashboards/...`, `/superset/created_dashboards/...`, `/superset/user_slices/`, `/superset/created_slices/...`, `/superset/fave_slices/...`, `/superset/favstar/...`,
|
||||||
- [24401](https://github.com/apache/superset/pull/24401): Removes the deprecated `metrics` column (which was blossomed in [20732](https://github.com/apache/superset/pull/20732)) from the `/api/v1/dataset/` API.
|
- [24401](https://github.com/apache/superset/pull/24401): Removes the deprecated `metrics` column (which was blossomed in [20732](https://github.com/apache/superset/pull/20732)) from the `/api/v1/dataset/` API.
|
||||||
- [24375](https://github.com/apache/superset/pull/24375): Removed deprecated API `/superset/get_or_create_table/...`, `/superset/sqllab_viz`
|
- [24375](https://github.com/apache/superset/pull/24375): Removed deprecated API `/superset/get_or_create_table/...`, `/superset/sqllab_viz`
|
||||||
|
|
|
||||||
|
|
@ -41,13 +41,12 @@ from superset import (
|
||||||
event_logger,
|
event_logger,
|
||||||
is_feature_enabled,
|
is_feature_enabled,
|
||||||
security_manager,
|
security_manager,
|
||||||
viz,
|
|
||||||
)
|
)
|
||||||
from superset.charts.commands.exceptions import ChartNotFoundError
|
from superset.charts.commands.exceptions import ChartNotFoundError
|
||||||
from superset.charts.dao import ChartDAO
|
from superset.charts.dao import ChartDAO
|
||||||
from superset.common.chart_data import ChartDataResultFormat, ChartDataResultType
|
from superset.common.chart_data import ChartDataResultFormat, ChartDataResultType
|
||||||
from superset.connectors.base.models import BaseDatasource
|
from superset.connectors.base.models import BaseDatasource
|
||||||
from superset.connectors.sqla.models import AnnotationDatasource, SqlaTable
|
from superset.connectors.sqla.models import SqlaTable
|
||||||
from superset.dashboards.commands.exceptions import DashboardAccessDeniedError
|
from superset.dashboards.commands.exceptions import DashboardAccessDeniedError
|
||||||
from superset.dashboards.commands.importers.v0 import ImportDashboardsCommand
|
from superset.dashboards.commands.importers.v0 import ImportDashboardsCommand
|
||||||
from superset.dashboards.permalink.commands.get import GetDashboardPermalinkCommand
|
from superset.dashboards.permalink.commands.get import GetDashboardPermalinkCommand
|
||||||
|
|
@ -96,7 +95,6 @@ from superset.views.utils import (
|
||||||
check_datasource_perms,
|
check_datasource_perms,
|
||||||
check_explore_cache_perms,
|
check_explore_cache_perms,
|
||||||
check_resource_permissions,
|
check_resource_permissions,
|
||||||
check_slice_perms,
|
|
||||||
get_dashboard_extra_filters,
|
get_dashboard_extra_filters,
|
||||||
get_datasource_info,
|
get_datasource_info,
|
||||||
get_form_data,
|
get_form_data,
|
||||||
|
|
@ -216,65 +214,6 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
|
||||||
payload = viz_obj.get_payload()
|
payload = viz_obj.get_payload()
|
||||||
return self.send_data_payload_response(viz_obj, payload)
|
return self.send_data_payload_response(viz_obj, payload)
|
||||||
|
|
||||||
@event_logger.log_this
|
|
||||||
@api
|
|
||||||
@has_access_api
|
|
||||||
@expose("/slice_json/<int:slice_id>")
|
|
||||||
@etag_cache()
|
|
||||||
@check_resource_permissions(check_slice_perms)
|
|
||||||
@deprecated(new_target="/api/v1/chart/<int:id>/data/")
|
|
||||||
def slice_json(self, slice_id: int) -> FlaskResponse:
|
|
||||||
form_data, slc = get_form_data(slice_id, use_slice_data=True)
|
|
||||||
if not slc:
|
|
||||||
return json_error_response("The slice does not exist")
|
|
||||||
|
|
||||||
if not slc.datasource:
|
|
||||||
return json_error_response("The slice's datasource does not exist")
|
|
||||||
|
|
||||||
try:
|
|
||||||
viz_obj = get_viz(
|
|
||||||
datasource_type=slc.datasource.type,
|
|
||||||
datasource_id=slc.datasource.id,
|
|
||||||
form_data=form_data,
|
|
||||||
force=False,
|
|
||||||
)
|
|
||||||
return self.generate_json(viz_obj)
|
|
||||||
except SupersetException as ex:
|
|
||||||
return json_error_response(utils.error_msg_from_exception(ex))
|
|
||||||
|
|
||||||
@api
|
|
||||||
@has_access_api
|
|
||||||
@event_logger.log_this
|
|
||||||
@expose("/annotation_json/<int:layer_id>")
|
|
||||||
@deprecated(new_target="/api/v1/chart/<int:id>/data/")
|
|
||||||
def annotation_json( # pylint: disable=no-self-use
|
|
||||||
self, layer_id: int
|
|
||||||
) -> FlaskResponse:
|
|
||||||
form_data = get_form_data()[0]
|
|
||||||
force = utils.parse_boolean_string(request.args.get("force"))
|
|
||||||
|
|
||||||
form_data["layer_id"] = layer_id
|
|
||||||
form_data["filters"] = [{"col": "layer_id", "op": "==", "val": layer_id}]
|
|
||||||
# Set all_columns to ensure the TableViz returns the necessary columns to the
|
|
||||||
# frontend.
|
|
||||||
form_data["all_columns"] = [
|
|
||||||
"created_on",
|
|
||||||
"changed_on",
|
|
||||||
"id",
|
|
||||||
"start_dttm",
|
|
||||||
"end_dttm",
|
|
||||||
"layer_id",
|
|
||||||
"short_descr",
|
|
||||||
"long_descr",
|
|
||||||
"json_metadata",
|
|
||||||
"created_by_fk",
|
|
||||||
"changed_by_fk",
|
|
||||||
]
|
|
||||||
datasource = AnnotationDatasource()
|
|
||||||
viz_obj = viz.viz_types["table"](datasource, form_data=form_data, force=force)
|
|
||||||
payload = viz_obj.get_payload()
|
|
||||||
return data_payload_response(*viz_obj.payload_json_and_has_error(payload))
|
|
||||||
|
|
||||||
@event_logger.log_this
|
@event_logger.log_this
|
||||||
@api
|
@api
|
||||||
@has_access_api
|
@has_access_api
|
||||||
|
|
|
||||||
|
|
@ -516,39 +516,6 @@ def check_datasource_perms(
|
||||||
viz_obj.raise_for_access()
|
viz_obj.raise_for_access()
|
||||||
|
|
||||||
|
|
||||||
def check_slice_perms(_self: Any, slice_id: int) -> None:
|
|
||||||
"""
|
|
||||||
Check if user can access a cached response from slice_json.
|
|
||||||
|
|
||||||
This function takes `self` since it must have the same signature as the
|
|
||||||
the decorated method.
|
|
||||||
|
|
||||||
:param slice_id: The slice ID
|
|
||||||
:raises SupersetSecurityException: If the user cannot access the resource
|
|
||||||
"""
|
|
||||||
|
|
||||||
form_data, slc = get_form_data(slice_id, use_slice_data=True)
|
|
||||||
|
|
||||||
if slc and slc.datasource:
|
|
||||||
try:
|
|
||||||
viz_obj = get_viz(
|
|
||||||
datasource_type=slc.datasource.type,
|
|
||||||
datasource_id=slc.datasource.id,
|
|
||||||
form_data=form_data,
|
|
||||||
force=False,
|
|
||||||
)
|
|
||||||
except NoResultFound as ex:
|
|
||||||
raise SupersetSecurityException(
|
|
||||||
SupersetError(
|
|
||||||
error_type=SupersetErrorType.UNKNOWN_DATASOURCE_TYPE_ERROR,
|
|
||||||
level=ErrorLevel.ERROR,
|
|
||||||
message="Could not find viz object",
|
|
||||||
)
|
|
||||||
) from ex
|
|
||||||
|
|
||||||
viz_obj.raise_for_access()
|
|
||||||
|
|
||||||
|
|
||||||
def _deserialize_results_payload(
|
def _deserialize_results_payload(
|
||||||
payload: Union[bytes, str], query: Query, use_msgpack: Optional[bool] = False
|
payload: Union[bytes, str], query: Query, use_msgpack: Optional[bool] = False
|
||||||
) -> dict[str, Any]:
|
) -> dict[str, Any]:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue