diff --git a/UPDATING.md b/UPDATING.md index 040196c696561..459cc4e452754 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -35,6 +35,9 @@ assists people when migrating to a new version. files for production use cases! While we never really supported or should have tried to support docker-compose for production use cases, we now actively have taken a stance against supporting it. See the PR for details. +- [27697](https://github.com/apache/superset/pull/27697) [minor] flask-session bump leads to them + deprecating `SESSION_USE_SIGNER`, check your configs as this flag won't do anything moving + forward. ### Breaking Changes diff --git a/requirements/base.txt b/requirements/base.txt index ea0f900241158..f5318071b3a7e 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -126,7 +126,7 @@ flask-login==0.6.3 # flask-appbuilder flask-migrate==3.1.0 # via apache-superset -flask-session==0.5.0 +flask-session==0.8.0 # via apache-superset flask-sqlalchemy==2.5.1 # via @@ -214,6 +214,8 @@ mdurl==0.1.2 # via markdown-it-py msgpack==1.0.8 # via apache-superset +msgspec==0.18.6 + # via flask-session nh3==0.2.17 # via apache-superset numba==0.57.1 diff --git a/superset/config.py b/superset/config.py index 2f6ce136946d1..0d00fedfbb9e3 100644 --- a/superset/config.py +++ b/superset/config.py @@ -20,6 +20,7 @@ in your PYTHONPATH as there is a ``from superset_config import *`` at the end of this file. """ +# mypy: ignore-errors # pylint: disable=too-many-lines from __future__ import annotations @@ -940,7 +941,7 @@ class CeleryConfig: # pylint: disable=too-few-public-methods } -CELERY_CONFIG = CeleryConfig # pylint: disable=invalid-name +CELERY_CONFIG: type[CeleryConfig] = CeleryConfig # Set celery config to None to disable all the above configuration # CELERY_CONFIG = None @@ -1474,7 +1475,6 @@ def EMAIL_HEADER_MUTATOR( # pylint: disable=invalid-name,unused-argument # from flask_session import RedisSessionInterface # # SESSION_SERVER_SIDE = True -# SESSION_USE_SIGNER = True # SESSION_TYPE = "redis" # SESSION_REDIS = Redis(host="localhost", port=6379, db=0) # @@ -1704,7 +1704,7 @@ class ExtraDynamicQueryFilters(TypedDict, total=False): try: # pylint: disable=import-error,wildcard-import,unused-wildcard-import import superset_config - from superset_config import * # type: ignore + from superset_config import * # noqa: F403, F401 print(f"Loaded your LOCAL configuration at [{superset_config.__file__}]") except Exception: diff --git a/superset/models/slice.py b/superset/models/slice.py index eb2b220c8ff3e..4b1cef7e461bf 100644 --- a/superset/models/slice.py +++ b/superset/models/slice.py @@ -51,7 +51,7 @@ if TYPE_CHECKING: from superset.common.query_context import QueryContext from superset.common.query_context_factory import QueryContextFactory - from superset.connectors.sqla.models import BaseDatasource + from superset.connectors.sqla.models import SqlaTable metadata = Model.metadata # pylint: disable=no-member slice_user = Table( @@ -139,14 +139,14 @@ def __repr__(self) -> str: return self.slice_name or str(self.id) @property - def cls_model(self) -> type[BaseDatasource]: + def cls_model(self) -> type[SqlaTable]: # pylint: disable=import-outside-toplevel from superset.daos.datasource import DatasourceDAO return DatasourceDAO.sources[self.datasource_type] @property - def datasource(self) -> BaseDatasource | None: + def datasource(self) -> SqlaTable | None: return self.get_datasource def clone(self) -> Slice: @@ -163,7 +163,7 @@ def clone(self) -> Slice: # pylint: disable=using-constant-test @datasource.getter # type: ignore - def get_datasource(self) -> BaseDatasource | None: + def get_datasource(self) -> SqlaTable | None: return ( db.session.query(self.cls_model) .filter_by(id=self.datasource_id) diff --git a/tests/integration_tests/charts/commands_tests.py b/tests/integration_tests/charts/commands_tests.py index 28f9d42d6dd60..5d3a4986b81d1 100644 --- a/tests/integration_tests/charts/commands_tests.py +++ b/tests/integration_tests/charts/commands_tests.py @@ -173,7 +173,7 @@ def test_export_chart_command_no_related(self, mock_g): class TestImportChartsCommand(SupersetTestCase): @patch("superset.utils.core.g") @patch("superset.security.manager.g") - def test_import_v1_chart(self, sm_g, utils_g): + def test_import_v1_chart(self, sm_g, utils_g) -> None: """Test that we can import a chart""" admin = sm_g.user = utils_g.user = security_manager.find_user("admin") contents = { @@ -192,7 +192,7 @@ def test_import_v1_chart(self, sm_g, utils_g): assert json.loads(chart.params) == { "annotation_layers": [], "color_picker": {"a": 1, "b": 135, "g": 122, "r": 0}, - "datasource": dataset.uid, + "datasource": dataset.uid if dataset else None, "js_columns": ["color"], "js_data_mutator": "data => data.map(d => ({\\n ...d,\\n color: colors.hexToRGB(d.extraProps.color)\\n}));", "js_onclick_href": "", @@ -228,7 +228,8 @@ def test_import_v1_chart(self, sm_g, utils_g): dataset = ( db.session.query(SqlaTable).filter_by(uuid=dataset_config["uuid"]).one() ) - assert dataset.table_name == "imported_dataset" + table_name = dataset.table_name if dataset else None + assert table_name == "imported_dataset" assert chart.table == dataset database = (