eschutho commented on code in PR #24839:
URL: https://github.com/apache/superset/pull/24839#discussion_r1303509210
##########
superset/tags/commands/create.py:
##########
@@ -60,3 +62,45 @@ def validate(self) -> None:
)
if exceptions:
raise TagInvalidError(exceptions=exceptions)
+
+
+class CreateCustomTagWithRelationshipsCommand(CreateMixin, BaseCommand):
+ def __init__(self, data: dict[str, Any]):
+ self._tag = data["name"]
+ self._objects_to_tag = data.get("objects_to_tag")
+ self._description = data.get("description")
+
+ def run(self) -> None:
+ self.validate()
+ try:
+ tag = TagDAO.get_by_name(self._tag.strip(), TagTypes.custom)
+ if self._objects_to_tag:
+ TagDAO.create_tag_relationship(
+ objects_to_tag=self._objects_to_tag, tag=tag
+ )
+
+ if self._description:
+ tag.description = self._description
+ db.session.commit()
+
+ except DAOCreateFailedError as ex:
+ logger.exception(ex.exception)
Review Comment:
flask will actually raise and log this error from the response. I don't
think we need this.
--
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]