diff --git a/.vscode/launch.json b/.vscode/launch.json index a4175a733..501bd2251 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -103,6 +103,7 @@ "args": [ "deploy", "--dry-run", + "--verbose" ], "console": "integratedTerminal", "justMyCode": false diff --git a/CHANGELOG.cdf-tk.md b/CHANGELOG.cdf-tk.md index f9cd1c504..6d488c585 100644 --- a/CHANGELOG.cdf-tk.md +++ b/CHANGELOG.cdf-tk.md @@ -30,6 +30,7 @@ Changes are grouped as follows: - In `cdf build` when loading `config.[env].yaml` the Toolkit now correctly prefers variables deeper, more specific, in the hierarchy over more general variables. - [Alpha feature] `cdf build` will no longer copy content `YAML` files to the build directory. +- A bug caused the comparison with existing Tranformation Notifications to fail. This is now fixed. ### Improved diff --git a/cognite_toolkit/_cdf_tk/loaders/_resource_loaders/transformation_loaders.py b/cognite_toolkit/_cdf_tk/loaders/_resource_loaders/transformation_loaders.py index 51ca4ea14..d97cea1d2 100644 --- a/cognite_toolkit/_cdf_tk/loaders/_resource_loaders/transformation_loaders.py +++ b/cognite_toolkit/_cdf_tk/loaders/_resource_loaders/transformation_loaders.py @@ -482,6 +482,19 @@ def dump_id(cls, id: str) -> dict[str, Any]: "destination": destination, } + def _are_equal( + self, + local: TransformationNotificationWrite, + cdf_resource: TransformationNotification, + return_dumped: bool = False, + ) -> bool | tuple[bool, dict[str, Any], dict[str, Any]]: + local_dumped = local.dump() + cdf_dumped = cdf_resource.as_write().dump() + cdf_dumped.pop("transformationId") + cdf_dumped["transformationExternalId"] = local.transformation_external_id + + return self._return_are_equal(local_dumped, cdf_dumped, return_dumped) + @classmethod def get_required_capability( cls, items: TransformationNotificationWriteList | None, read_only: bool @@ -508,11 +521,17 @@ def retrieve(self, ids: SequenceNotStr[str]) -> TransformationNotificationList: result = self.client.transformations.notifications.list( transformation_external_id=transformation_external_id, destination=destination, limit=-1 ) + # list() does not return the transformation_external_id on items + for notification in result: + notification.transformation_external_id = transformation_external_id + except CogniteAPIError: # The notification endpoint gives a 500 if the notification does not exist. # The issue has been reported to the service team. continue + retrieved.extend(result) + return retrieved def update(self, items: TransformationNotificationWriteList) -> TransformationNotificationList: