sadpandajoe commented on code in PR #42919:
URL: https://github.com/apache/superset/pull/42919#discussion_r3870754479


##########
superset/commands/importers/v1/utils.py:
##########
@@ -318,28 +318,29 @@ def import_tag(
 
     for tag_name in target_tag_names:
         try:
-            tag = existing_tags.get(tag_name)
-
-            # If tag does not exist, create it
-            if tag is None:
-                description = tag_descriptions.get(tag_name, None)
-                tag = Tag(name=tag_name, description=description, 
type="custom")
-                db_session.add(tag)
-                existing_tags[tag_name] = tag  # Update the existing_tags 
dictionary
-
-            # Ensure the association with the object
-            tagged_object = (
-                db_session.query(TaggedObject)
-                .filter_by(object_id=object_id, object_type=object_type, 
tag_id=tag.id)
-                .first()
-            )
-            if not tagged_object:
-                new_tagged_object = TaggedObject(
-                    tag_id=tag.id, object_id=object_id, object_type=object_type
+            with db_session.begin_nested():

Review Comment:
   This changes the error-recovery boundary, but the existing tag test covers 
only successful creation and the disabled flag. A savepoint-release failure can 
still regress to a poisoned session or leave a failed association reported as 
imported. Could this add a two-tag regression that forces the first nested 
transaction to fail and asserts the second tag is processed while the failed 
association is absent from the returned IDs?



-- 
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]

Reply via email to