For the complete documentation index, see llms.txt. This page is also available as Markdown.

Enrich user profiles

Update or delete part of an existing profile without overwriting the whole object.

Your goal

Change one thing inside a stored profile - add a loyalty card, update a balance, remove an obsolete object - without sending the whole profile and without losing what you did not send.

Expected outcome

Partial updates that hit exactly the object you intended, and a schema that declares how the platform is supposed to recognise that object.

When to use a partial update

Use PARTIAL_UPDATE or PARTIAL_DELETE as the update_strategy of a USER_PROFILE import when you want targeted updates on existing profiles without overwriting the whole profile object. The import mechanics are the same as in Import profiles - only the strategy changes.

The setup differs by situation.

Arrays of objects

The platform needs to know which element of the array you mean. That requires a schema directive on the object concerned.

Plain objects

No array, no ambiguity: PARTIAL_UPDATE works with no directive needed.

The update directives

Both are declared in the datamart's schema, so update the schema before relying on them.

Directive
Put it on
Use it when

@UpdateStrategyKey

The field inside the object that identifies it

The object has an "id-like" field. The value of that field in your request identifies which element to update.

@UpdateValueObject

The object itself

The object has no field that can identify it. You send the new value of the object and it overrides the previous one.

type UserProfile {
   compartment_id: String!
   user_account_id: String
   loyalty: [Loyalty]
}

type Loyalty {
   cards: [Cards]
}

type Cards {
   card_id: String! @UpdateStrategyKey
   benefits: String
   last_visit_date: String
}

A hierarchy of inner objects is allowed, each level with its own key:

What each operation does

Using the Cards schema above, with card_id as the key.

PARTIAL_UPDATE with a new key value appends the object.

Stored:

Payload:

Result - both cards:

PARTIAL_UPDATE with an existing key value updates only the fields you send.

Stored:

Payload - the key identifies the element, benefits is the only change:

Result - last_visit_date is untouched:

PARTIAL_DELETE with a key value removes that object from the array.

The same mechanism removes a property inside an array element, rather than the element itself, depending on what you address in the payload.

With @UpdateValueObject on the object, a PARTIAL_UPDATE overrides the object - array of objects or single object - with the value you send, instead of merging into it.

This is the strategy for objects with no natural identifier, where merging would produce a meaningless mixture of old and new fields.

PARTIAL_UPDATE with no directive covers the cases without arrays of objects:

  • Updating properties directly on the UserProfile.

  • Updating a property inside a plain object.

  • Overriding a plain object.

Arrays of scalar values are treated as scalars. An array such as [1,2,3] is replaced as a whole, not merged element by element.

Constraints

The update request must respect the datamart schema.

  • If a property is in the payload but not declared in the schema, the whole request fails.

  • If a property is already present in the profile but not declared in the schema, it is not overwritten by a partial update or delete - and cannot be updated at all except with FORCE_REPLACE.

  • If the types in the payload do not respect the schema, the whole request fails.

Properties that cannot be partially updated:

  • A property whose schema declaration uses a directive referencing [parent] in its path - for example @Property(path: "[parent].property").

  • Computed values: computed fields, ML function results, function results.

Verify

  • The directive is present in the published schema, not only in a draft.

  • A test update changes only the object you targeted, leaving its siblings intact.

  • A test delete removes the object and nothing else.

  • The execution's error file is empty - a schema mismatch fails the whole request, so a partial success is not the failure mode to expect here.

Last updated

Was this helpful?