From 5fcfd5c04bbf1e00fdf4c19ce6f83c1795944fd1 Mon Sep 17 00:00:00 2001 From: anders-albert Date: Sat, 14 Dec 2024 07:39:40 +0100 Subject: [PATCH] build; changelog --- CHANGELOG.md | 4 ++ cognite/client/_version.py | 2 +- pyproject.toml | 2 +- .../test_api/test_sequences.py | 52 +++++++++++++++++++ 4 files changed, 58 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a65057dc1..b9280566f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ Changes are grouped as follows - `Fixed` for any bug fixes. - `Security` in case of vulnerabilities. +## [7.70.6] - 2024-12-14 +### Fixed +- Updating a Sequence and repeating existing columns no longer raises a `CogniteDuplicatedError`. + ## [7.70.5] - 2024-12-12 ### Fixed - Upserting a Sequence with columns no longer silently skips the columns, but instead updates them as intended. diff --git a/cognite/client/_version.py b/cognite/client/_version.py index b565e1398..f74ee2bfe 100644 --- a/cognite/client/_version.py +++ b/cognite/client/_version.py @@ -1,5 +1,5 @@ from __future__ import annotations -__version__ = "7.70.5" +__version__ = "7.70.6" __api_subversion__ = "20230101" diff --git a/pyproject.toml b/pyproject.toml index d4b301d51..a97a911e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "cognite-sdk" -version = "7.70.5" +version = "7.70.6" description = "Cognite Python SDK" readme = "README.md" diff --git a/tests/tests_integration/test_api/test_sequences.py b/tests/tests_integration/test_api/test_sequences.py index 8bd0148f5..1d4896d6d 100644 --- a/tests/tests_integration/test_api/test_sequences.py +++ b/tests/tests_integration/test_api/test_sequences.py @@ -437,3 +437,55 @@ def test_upsert_sequence_patch(self, cognite_client: CogniteClient) -> None: finally: if created: cognite_client.sequences.delete(external_id=created.external_id, ignore_unknown_ids=True) + + def test_update_sequence_patch(self, cognite_client: CogniteClient) -> None: + original_sequence = SequenceWrite( + external_id=f"update_sequence_{random_string(5)}", + columns=[ + SequenceColumnWrite( + description="KW Description", + name="KW Name", + value_type="DOUBLE", + external_id="kw_seq_01", + metadata={}, + ), + ], + description="Description of the Test Sequence", + name="Test Sequence Name", + ) + update = SequenceWrite( + external_id=original_sequence.external_id, + columns=[ + SequenceColumnWrite( + description="KW Description", + name="KW Name", + value_type="DOUBLE", + external_id="kw_seq_01", + metadata={}, + ), + SequenceColumnWrite( + description="PW Description", + name="PW Name", + value_type="DOUBLE", + external_id="pw_seq_01", + metadata={}, + ), + ], + ) + + created: Sequence | None = None + try: + created = cognite_client.sequences.create(original_sequence) + + updated = cognite_client.sequences.update(update) + + retrieved = cognite_client.sequences.retrieve(external_id=updated.external_id) + + assert retrieved is not None + TestCase().assertCountEqual( + retrieved.as_write().columns.dump(), + update.columns.dump(), + ) + finally: + if created: + cognite_client.sequences.delete(external_id=created.external_id, ignore_unknown_ids=True)