This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin 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 5167d20f27 fix: Improving handling for tag relationship when deleting
assets v2 (#29229)
5167d20f27 is described below
commit 5167d20f2771e72e51bc4fd9dcb89988f32916cc
Author: Vitor Avila <[email protected]>
AuthorDate: Wed Jun 12 13:39:34 2024 -0300
fix: Improving handling for tag relationship when deleting assets v2
(#29229)
---
superset/models/dashboard.py | 4 ++--
superset/models/slice.py | 4 ++--
superset/models/sql_lab.py | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/superset/models/dashboard.py b/superset/models/dashboard.py
index 98baa83278..e8f53dddb5 100644
--- a/superset/models/dashboard.py
+++ b/superset/models/dashboard.py
@@ -154,8 +154,8 @@ class Dashboard(AuditMixinNullable, ImportExportMixin,
Model):
secondary="tagged_object",
primaryjoin="and_(Dashboard.id == TaggedObject.object_id, "
"TaggedObject.object_type == 'dashboard')",
- secondaryjoin="and_(TaggedObject.tag_id == Tag.id)",
- passive_deletes=True,
+ secondaryjoin="TaggedObject.tag_id == Tag.id",
+ viewonly=True, # cascading deletion already handled by
superset.tags.models.ObjectUpdater.after_delete
)
published = Column(Boolean, default=False)
is_managed_externally = Column(Boolean, nullable=False, default=False)
diff --git a/superset/models/slice.py b/superset/models/slice.py
index e4c6a35ae8..c30e643b7d 100644
--- a/superset/models/slice.py
+++ b/superset/models/slice.py
@@ -106,8 +106,8 @@ class Slice( # pylint: disable=too-many-public-methods
overlaps="objects,tag,tags",
primaryjoin="and_(Slice.id == TaggedObject.object_id, "
"TaggedObject.object_type == 'chart')",
- secondaryjoin="and_(TaggedObject.tag_id == Tag.id)",
- passive_deletes=True,
+ secondaryjoin="TaggedObject.tag_id == Tag.id",
+ viewonly=True, # cascading deletion already handled by
superset.tags.models.ObjectUpdater.after_delete
)
table = relationship(
"SqlaTable",
diff --git a/superset/models/sql_lab.py b/superset/models/sql_lab.py
index 4abed73436..6f25a5a660 100644
--- a/superset/models/sql_lab.py
+++ b/superset/models/sql_lab.py
@@ -418,8 +418,8 @@ class SavedQuery(
overlaps="objects,tag,tags",
primaryjoin="and_(SavedQuery.id == TaggedObject.object_id, "
"TaggedObject.object_type == 'query')",
- secondaryjoin="and_(TaggedObject.tag_id == Tag.id)",
- passive_deletes=True,
+ secondaryjoin="TaggedObject.tag_id == Tag.id",
+ viewonly=True, # cascading deletion already handled by
superset.tags.models.ObjectUpdater.after_delete
)
export_parent = "database"