mirror of
https://github.com/apache/superset.git
synced 2026-06-01 13:49:21 +00:00
fix: Improving handling for tag relationship when deleting assets (#29117)
This commit is contained in:
@@ -150,11 +150,12 @@ class Dashboard(AuditMixinNullable, ImportExportMixin, Model):
|
||||
)
|
||||
tags = relationship(
|
||||
"Tag",
|
||||
overlaps="objects,tag,tags,tags",
|
||||
overlaps="objects,tag,tags",
|
||||
secondary="tagged_object",
|
||||
primaryjoin="and_(Dashboard.id == TaggedObject.object_id)",
|
||||
secondaryjoin="and_(TaggedObject.tag_id == Tag.id, "
|
||||
primaryjoin="and_(Dashboard.id == TaggedObject.object_id, "
|
||||
"TaggedObject.object_type == 'dashboard')",
|
||||
secondaryjoin="and_(TaggedObject.tag_id == Tag.id)",
|
||||
passive_deletes=True,
|
||||
)
|
||||
published = Column(Boolean, default=False)
|
||||
is_managed_externally = Column(Boolean, nullable=False, default=False)
|
||||
|
||||
@@ -104,9 +104,10 @@ class Slice( # pylint: disable=too-many-public-methods
|
||||
"Tag",
|
||||
secondary="tagged_object",
|
||||
overlaps="objects,tag,tags",
|
||||
primaryjoin="and_(Slice.id == TaggedObject.object_id)",
|
||||
secondaryjoin="and_(TaggedObject.tag_id == Tag.id, "
|
||||
primaryjoin="and_(Slice.id == TaggedObject.object_id, "
|
||||
"TaggedObject.object_type == 'chart')",
|
||||
secondaryjoin="and_(TaggedObject.tag_id == Tag.id)",
|
||||
passive_deletes=True,
|
||||
)
|
||||
table = relationship(
|
||||
"SqlaTable",
|
||||
|
||||
@@ -415,10 +415,11 @@ class SavedQuery(
|
||||
tags = relationship(
|
||||
"Tag",
|
||||
secondary="tagged_object",
|
||||
overlaps="tags",
|
||||
primaryjoin="and_(SavedQuery.id == TaggedObject.object_id)",
|
||||
secondaryjoin="and_(TaggedObject.tag_id == Tag.id, "
|
||||
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,
|
||||
)
|
||||
|
||||
export_parent = "database"
|
||||
|
||||
Reference in New Issue
Block a user