Skip to content

feature: SDK should only upsert fields that have been modified #821

@minitriga

Description

@minitriga

Component

Python SDK

Describe the Feature Request

When saving a node (especially with allow_upsert=True), the SDK currently includes all fields in the GraphQL mutation payload, not just fields that have been modified. This can lead to unintended side effects, such as:

  • Sending null for unset optional relationships (e.g. parent: null for hierarchical nodes), causing server-side errors
  • Overwriting values that were set by other processes, object templates, or server defaults
  • Unnecessary data in mutation payloads increasing request size and processing time

The SDK should implement dirty/change tracking so that _generate_input_data() only includes fields that have been explicitly set or modified since the node was created or fetched.

PR #810 addressed a specific instance of this problem (hierarchical relationships), but the underlying issue applies more broadly to all attributes and relationships.

Describe the Use Case

  1. Upsert without overwriting: A user fetches a node, modifies one attribute, and saves it. Currently all fields are sent, potentially overwriting concurrent changes to other fields. Only the modified attribute should be included in the mutation.

  2. Object template defaults: When creating a new node with allow_upsert=True, unset optional fields are sent as null, which can override defaults that would otherwise be applied by object templates on the server side.

  3. Concurrent workflows: Multiple scripts or users may modify different fields on the same node. Without change tracking, each save overwrites the entire object, creating race conditions.

Additional Information

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions