From c84e15896a48c57e1f752e96bbc36fa5521dbeff Mon Sep 17 00:00:00 2001 From: Anders Albert <60234212+doctrino@users.noreply.github.com> Date: Tue, 28 Nov 2023 18:39:22 +0100 Subject: [PATCH] fix: Bug in transformation init method (#1527) --- CHANGELOG.md | 5 +++++ cognite/client/_version.py | 2 +- cognite/client/data_classes/transformations/__init__.py | 4 ++-- pyproject.toml | 2 +- tests/utils.py | 4 ++-- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2286e2c424..915ca7c346 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,11 @@ Changes are grouped as follows - `Fixed` for any bug fixes. - `Security` in case of vulnerabilities. +## [7.4.1] - 2023-11-28 +### Fixed +- Error in logic when creating a `Transformation`. This is causing when calling `client.transformations.update`. + This is now fixed. + ## [7.4.0] - 2023-11-27 ### Changed - Unit Catalog API is out of beta and will no longer issue warnings on usage. Access is unchanged: `client.units`. diff --git a/cognite/client/_version.py b/cognite/client/_version.py index 90ffdb3982..7aa8b64720 100644 --- a/cognite/client/_version.py +++ b/cognite/client/_version.py @@ -1,4 +1,4 @@ from __future__ import annotations -__version__ = "7.4.0" +__version__ = "7.4.1" __api_subversion__ = "V20220125" diff --git a/cognite/client/data_classes/transformations/__init__.py b/cognite/client/data_classes/transformations/__init__.py index b994334a95..fed32a9649 100644 --- a/cognite/client/data_classes/transformations/__init__.py +++ b/cognite/client/data_classes/transformations/__init__.py @@ -185,8 +185,8 @@ def __init__( raise ValueError("Transformation external_id must be the same as the schedule.external_id.") if ( (self.schedule and self.id != self.schedule.id) - or (self.running_job and self.id != self.running_job.id) - or (self.last_finished_job and self.id != self.last_finished_job.id) + or (self.running_job and self.id != self.running_job.transformation_id) + or (self.last_finished_job and self.id != self.last_finished_job.transformation_id) ): raise ValueError("Transformation id must be the same as the schedule, running_job, last_running_job id.") diff --git a/pyproject.toml b/pyproject.toml index 9927b5fe89..659efe0a0e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "cognite-sdk" -version = "7.4.0" +version = "7.4.1" description = "Cognite Python SDK" readme = "README.md" documentation = "https://cognite-sdk-python.readthedocs-hosted.com" diff --git a/tests/utils.py b/tests/utils.py index 05272ea1d1..e88339aaf9 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -347,8 +347,8 @@ def create_instance(self, resource_cls: type[T_Object]) -> T_Object: # schedule and jobs must match external id and id keyword_arguments["schedule"].external_id = keyword_arguments["external_id"] keyword_arguments["schedule"].id = keyword_arguments["id"] - keyword_arguments["running_job"].id = keyword_arguments["id"] - keyword_arguments["last_finished_job"].id = keyword_arguments["id"] + keyword_arguments["running_job"].transformation_id = keyword_arguments["id"] + keyword_arguments["last_finished_job"].transformation_id = keyword_arguments["id"] return resource_cls(*positional_arguments, **keyword_arguments) def create_value(self, type_: Any, var_name: str | None = None) -> Any: