john-bodley commented on code in PR #25043:
URL: https://github.com/apache/superset/pull/25043#discussion_r1300934969
##########
superset/connectors/sqla/models.py:
##########
@@ -1524,63 +1479,16 @@ def after_delete(
"""
security_manager.dataset_after_delete(mapper, connection, sqla_table)
- @staticmethod
- def after_update(
- mapper: Mapper,
- connection: Connection,
- sqla_table: SqlaTable,
- ) -> None:
- """
- Update dataset permissions
- """
- # set permissions
- security_manager.dataset_after_update(mapper, connection, sqla_table)
-
- # TODO: the shadow writing is deprecated
- inspector = inspect(sqla_table)
- session = inspector.session
-
- # double-check that ``UPDATE``s are actually pending (this method is
called even
- # for instances that have no net changes to their column-based
attributes)
- if not session.is_modified(sqla_table, include_collections=True):
- return
-
- # find the dataset from the known instance list first
- # (it could be either from a previous query or newly created)
- dataset = next(
- find_cached_objects_in_session(
- session, NewDataset, uuids=[sqla_table.uuid]
- ),
- None,
- )
- # if not found, pull from database
- if not dataset:
- dataset = (
-
session.query(NewDataset).filter_by(uuid=sqla_table.uuid).one_or_none()
- )
- if not dataset:
- sqla_table.write_shadow_dataset()
- return
-
- def write_shadow_dataset(
- self: SqlaTable,
- ) -> None:
- """
- This method is deprecated
- """
- session = inspect(self).session
- # most of the write_shadow_dataset functionality has been removed
- # but leaving this portion in
- # to remove later because it is adding a Database relationship to the
session
- # and there is some functionality that depends on this
+ def load_database(self: SqlaTable) -> None:
+ # somehow the database attribute is not loaded on access
if self.database_id and (
not self.database or self.database.id != self.database_id
):
+ session = inspect(self).session
Review Comment:
Thanks for ensuring we're using the same session.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]