diff --git a/superset/daos/tag.py b/superset/daos/tag.py index aae3c0dacad..2c5cc358265 100644 --- a/superset/daos/tag.py +++ b/superset/daos/tag.py @@ -54,9 +54,6 @@ class TagDAO(BaseDAO[Tag]): for name in clean_tag_names: type_ = TagType.custom tag = TagDAO.get_by_name(name, type_) - tagged_objects.append( - TaggedObject(object_id=object_id, object_type=object_type, tag=tag) - ) # Check if the association already exists existing_tagged_object = ( diff --git a/tests/integration_tests/tags/dao_tests.py b/tests/integration_tests/tags/dao_tests.py index 0bc866da035..6273799a379 100644 --- a/tests/integration_tests/tags/dao_tests.py +++ b/tests/integration_tests/tags/dao_tests.py @@ -144,6 +144,15 @@ class TestTagsDAO(SupersetTestCase): # check if tag exists assert db.session.query(Tag).filter(Tag.name == "example tag 1").first() + # test that a combination of non-unique and unique tags + # can be added. + TagDAO.create_custom_tagged_objects( + object_type=ObjectType.dashboard.name, + object_id=1, + tag_names=["example tag 1", "example tag 2"], + ) + assert db.session.query(Tag).filter(Tag.name == "example tag 2").first() + @pytest.mark.usefixtures("load_world_bank_dashboard_with_slices") @pytest.mark.usefixtures("with_tagging_system_feature") @pytest.mark.usefixtures("create_tags")