You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by dp...@apache.org on 2023/06/12 13:17:33 UTC
[superset] branch master updated: chore: remove deprecated api /superset/filter/... (#24335)
This is an automated email from the ASF dual-hosted git repository.
dpgaspar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 2df699c99c chore: remove deprecated api /superset/filter/... (#24335)
2df699c99c is described below
commit 2df699c99c56fa2044c77af25438de7d12160ec4
Author: Daniel Vaz Gaspar <da...@gmail.com>
AuthorDate: Mon Jun 12 14:17:23 2023 +0100
chore: remove deprecated api /superset/filter/... (#24335)
---
RESOURCES/STANDARD_ROLES.md | 1 -
UPDATING.md | 2 ++
superset/views/core.py | 44 +----------------------------------
tests/integration_tests/core_tests.py | 13 -----------
4 files changed, 3 insertions(+), 57 deletions(-)
diff --git a/RESOURCES/STANDARD_ROLES.md b/RESOURCES/STANDARD_ROLES.md
index 5bb3047c0f..aa5654ec62 100644
--- a/RESOURCES/STANDARD_ROLES.md
+++ b/RESOURCES/STANDARD_ROLES.md
@@ -104,7 +104,6 @@
|can queries on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|can stop query on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|
|can request access on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
-|can filter on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|can dashboard on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|can results on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|can post on TableSchemaView|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
diff --git a/UPDATING.md b/UPDATING.md
index 9201886bf9..2117087908 100644
--- a/UPDATING.md
+++ b/UPDATING.md
@@ -24,6 +24,7 @@ assists people when migrating to a new version.
## Next
+- [24335](https://github.com/apache/superset/pull/24335): Removed deprecated API `/superset/filter/<datasource_type>/<int:datasource_id>/<column>/`
- [24185](https://github.com/apache/superset/pull/24185): `/api/v1/database/test_connection` and `api/v1/database/validate_parameters` permissions changed from `can_read` to `can_write`. Only Admin user's have access.
- [24256](https://github.com/apache/superset/pull/24256): `Flask-Login` session validation is now set to `strong` by default. Previous setting was `basic`.
- [24232](https://github.com/apache/superset/pull/24232): Enables ENABLE_TEMPLATE_REMOVE_FILTERS, DRILL_TO_DETAIL, DASHBOARD_CROSS_FILTERS by default, marks VERSIONED_EXPORT and ENABLE_TEMPLATE_REMOVE_FILTERS as deprecated.
@@ -33,6 +34,7 @@ assists people when migrating to a new version.
### Breaking Changes
+- [24335](https://github.com/apache/superset/pull/24335): Removed deprecated API `/superset/filter/<datasource_type>/<int:datasource_id>/<column>/`
- [24333](https://github.com/apache/superset/pull/24333): Removed deprecated API `/superset/datasources`
- [24266](https://github.com/apache/superset/pull/24266) Remove the `ENABLE_ACCESS_REQUEST` config parameter and the associated request/approval workflows.
- [24330](https://github.com/apache/superset/pull/24330) Removes `getUiOverrideRegistry` from `ExtensionsRegistry`.
diff --git a/superset/views/core.py b/superset/views/core.py
index cc64dd23ff..5c9ad07ad6 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -129,12 +129,7 @@ from superset.tasks.async_queries import load_explore_json_into_cache
from superset.utils import core as utils, csv
from superset.utils.async_query_manager import AsyncQueryTokenException
from superset.utils.cache import etag_cache
-from superset.utils.core import (
- apply_max_row_limit,
- DatasourceType,
- get_user_id,
- ReservedUrlParameters,
-)
+from superset.utils.core import DatasourceType, get_user_id, ReservedUrlParameters
from superset.utils.dates import now_as_float
from superset.utils.decorators import check_dashboard_access
from superset.views.base import (
@@ -782,43 +777,6 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
standalone_mode=standalone_mode,
)
- @api
- @handle_api_exception
- @has_access_api
- @event_logger.log_this
- @expose("/filter/<datasource_type>/<int:datasource_id>/<column>/")
- @deprecated(
- new_target="/api/v1/datasource/<datasource_type>/"
- "<datasource_id>/column/<column_name>/values/"
- )
- def filter( # pylint: disable=no-self-use
- self, datasource_type: str, datasource_id: int, column: str
- ) -> FlaskResponse:
- """
- Endpoint to retrieve values for specified column.
-
- :param datasource_type: Type of datasource e.g. table
- :param datasource_id: Datasource id
- :param column: Column name to retrieve values for
- :returns: The Flask response
- :raises SupersetSecurityException: If the user cannot access the resource
- """
- # TODO: Cache endpoint by user, datasource and column
- datasource = DatasourceDAO.get_datasource(
- db.session, DatasourceType(datasource_type), datasource_id
- )
- if not datasource:
- return json_error_response(DATASOURCE_MISSING_ERR)
-
- datasource.raise_for_access()
- row_limit = apply_max_row_limit(config["FILTER_SELECT_ROW_LIMIT"])
- payload = json.dumps(
- datasource.values_for_column(column_name=column, limit=row_limit),
- default=utils.json_int_dttm_ser,
- ignore_nan=True,
- )
- return json_success(payload)
-
@staticmethod
def save_or_overwrite_slice(
# pylint: disable=too-many-arguments,too-many-locals
diff --git a/tests/integration_tests/core_tests.py b/tests/integration_tests/core_tests.py
index c0ad2c1c76..230101b39a 100644
--- a/tests/integration_tests/core_tests.py
+++ b/tests/integration_tests/core_tests.py
@@ -308,19 +308,6 @@ class TestCore(SupersetTestCase):
db.session.delete(slc)
db.session.commit()
- @pytest.mark.usefixtures("load_energy_table_with_slice")
- def test_filter_endpoint(self):
- self.login(username="admin")
- tbl_id = self.table_ids.get("energy_usage")
- table = db.session.query(SqlaTable).filter(SqlaTable.id == tbl_id)
- table.filter_select_enabled = True
- url = "/superset/filter/table/{}/target/"
-
- # Changing name
- resp = self.get_resp(url.format(tbl_id))
- assert len(resp) > 0
- assert "energy_target0" in resp
-
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_slice_data(self):
# slice data should have some required attributes