From 42dccb0c02b6fe103063300c072c97e6501e86fb Mon Sep 17 00:00:00 2001 From: LucasG0 <44552904+LucasG0@users.noreply.github.com> Date: Wed, 26 Mar 2025 12:55:26 +0100 Subject: [PATCH 1/2] Remove hfid in upsert payload (#312) --- changelog/upsertperformances.changed.md | 1 + infrahub_sdk/node.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog/upsertperformances.changed.md diff --git a/changelog/upsertperformances.changed.md b/changelog/upsertperformances.changed.md new file mode 100644 index 00000000..cae7b40e --- /dev/null +++ b/changelog/upsertperformances.changed.md @@ -0,0 +1 @@ +Improve node upsert performances diff --git a/infrahub_sdk/node.py b/infrahub_sdk/node.py index 864abf1c..a7ee537f 100644 --- a/infrahub_sdk/node.py +++ b/infrahub_sdk/node.py @@ -1418,8 +1418,10 @@ async def create( ) -> None: mutation_query = self._generate_mutation_query() + # Upserting means we may want to create, meaning payload contains all mandatory fields required for a creation, + # so hfid is just redondant information. Currently, upsert mutation has performance overhead if `hfid` is filled. if allow_upsert: - input_data = self._generate_input_data(exclude_hfid=False, request_context=request_context) + input_data = self._generate_input_data(exclude_hfid=True, request_context=request_context) mutation_name = f"{self._schema.kind}Upsert" tracker = f"mutation-{str(self._schema.kind).lower()}-upsert" else: From 6b9f89a6c10af0bc7cdf6bc87a05e31879a8ac76 Mon Sep 17 00:00:00 2001 From: Damien Garros Date: Wed, 26 Mar 2025 18:31:02 +0100 Subject: [PATCH 2/2] Create release 1.9.2 --- CHANGELOG.md | 6 ++++++ changelog/upsertperformances.changed.md | 1 - pyproject.toml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) delete mode 100644 changelog/upsertperformances.changed.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 65affdae..b8e9608e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ This project uses [*towncrier*](https://towncrier.readthedocs.io/) and the chang +## [1.9.2](https://github.com/opsmill/infrahub-sdk-python/tree/v1.9.2) - 2025-03-26 + +### Changed + +- Remove hfid in upsert payload, to improve node upsert performances + ## [1.9.1](https://github.com/opsmill/infrahub-sdk-python/tree/v1.9.1) - 2025-03-21 ### Fixed diff --git a/changelog/upsertperformances.changed.md b/changelog/upsertperformances.changed.md deleted file mode 100644 index cae7b40e..00000000 --- a/changelog/upsertperformances.changed.md +++ /dev/null @@ -1 +0,0 @@ -Improve node upsert performances diff --git a/pyproject.toml b/pyproject.toml index 360f9608..704d6bec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "infrahub-sdk" -version = "1.9.1" +version = "1.9.2" description = "Python Client to interact with Infrahub" authors = ["OpsMill "] readme = "README.md"