Skip to content

Commit

Permalink
Merge branch 'master' into chore/remove-deprecated-apis-3
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgaspar authored Jun 12, 2023
2 parents f2402c5 + 3d9c7d4 commit 876104a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
1 change: 0 additions & 1 deletion RESOURCES/STANDARD_ROLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
|can copy dash on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|can publish on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|can csv on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|
|can datasources on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|can fave dashboards by username on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|can sql json on Superset|:heavy_check_mark:|O|O|:heavy_check_mark:|
|can slice on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
Expand Down
1 change: 1 addition & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,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`.
- [23933](https://github.com/apache/superset/pull/23933) Removes the deprecated Multiple Line Charts.
Expand Down
12 changes: 11 additions & 1 deletion superset/databases/commands/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import logging
from typing import Any, cast

from sqlalchemy.orm import lazyload, load_only

from superset.commands.base import BaseCommand
from superset.connectors.sqla.models import SqlaTable
from superset.databases.commands.exceptions import (
Expand Down Expand Up @@ -74,10 +76,18 @@ def run(self) -> dict[str, Any]:
extra_dict_by_name = {
table.name: table.extra_dict
for table in (
db.session.query(SqlaTable).filter(
db.session.query(SqlaTable)
.filter(
SqlaTable.database_id == self._model.id,
SqlaTable.schema == self._schema_name,
)
.options(
load_only(
SqlaTable.schema, SqlaTable.table_name, SqlaTable.extra
),
lazyload(SqlaTable.columns),
lazyload(SqlaTable.metrics),
)
).all()
}

Expand Down
25 changes: 8 additions & 17 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from flask_babel import gettext as __, lazy_gettext as _
from sqlalchemy import and_, or_
from sqlalchemy.exc import DBAPIError, NoSuchModuleError, SQLAlchemyError
from sqlalchemy.orm import lazyload, load_only

from superset import (
app,
Expand Down Expand Up @@ -202,22 +203,6 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods

logger = logging.getLogger(__name__)

@has_access_api
@event_logger.log_this
@expose("/datasources/")
@deprecated(new_target="api/v1/dataset/")
def datasources(self) -> FlaskResponse:
return self.json_response(
sorted(
[
datasource.short_data
for datasource in security_manager.get_user_datasources()
if datasource.short_data.get("name")
],
key=lambda datasource: datasource["name"],
)
)

@has_access
@event_logger.log_this
@expose("/slice/<int:slice_id>/")
Expand Down Expand Up @@ -972,10 +957,16 @@ def tables( # pylint: disable=no-self-use
extra_dict_by_name = {
table.name: table.extra_dict
for table in (
db.session.query(SqlaTable).filter(
db.session.query(SqlaTable)
.filter(
SqlaTable.database_id == database.id,
SqlaTable.schema == schema_parsed,
)
.options(
load_only(SqlaTable.schema, SqlaTable.table_name, SqlaTable.extra),
lazyload(SqlaTable.columns),
lazyload(SqlaTable.metrics),
)
).all()
}

Expand Down

0 comments on commit 876104a

Please sign in to comment.