eschutho commented on code in PR #24839: URL: https://github.com/apache/superset/pull/24839#discussion_r1303504318
########## superset/daos/tag.py: ########## @@ -363,3 +364,46 @@ def favorited_ids(tags: list[Tag]) -> list[int]: ) .all() ] + + @staticmethod + def create_tag_relationship( + objects_to_tag: list[tuple[ObjectTypes, int]], tag: Tag + ) -> None: + """ + Creates a tag relationship between the given objects and the specified tag. + This function iterates over a list of objects, each specified by a type + and an id, and creates a TaggedObject for each one, associating it with + the provided tag. All created TaggedObjects are collected in a list. + Args: + objects_to_tag (List[Tuple[ObjectTypes, int]]): A list of tuples, each + containing an ObjectType and an id, representing the objects to be tagged. + + tag (Tag): The tag to be associated with the specified objects. + Returns: + None. + """ + tagged_objects = [] + if not tag: + raise TagNotFoundError() Review Comment: @Antonio-RiveroMartnez I'm going to take a pass at cleaning up this logic in the future and move all status codes to the exceptions instead of the api. -- 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: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org