Skip to content

Conversation

Copy link

Copilot AI commented Feb 3, 2026

The match parameter for controlling If-Match headers in upsert operations now only works with mode="individual". Batch mode will raise DataverseError if match is provided.

Changes

  • API: Removed match parameter from batch mode overload signature
  • Validation: Added error check that raises DataverseError when match is used with mode="batch"
  • Internal: Removed match parameter from transform_to_batch_for_upsert function
  • Tests: Replaced batch match tests with error validation test
  • Docs: Updated examples to clarify individual-only support

Usage

# Individual mode - supported
entity.upsert(data, mode="individual", match="prevent_create")  # ✓

# Batch mode - raises DataverseError
entity.upsert(data, mode="batch", match="prevent_create")  # ✗
Original prompt

This section details on the original issue you should resolve

<issue_title>Feature Request: differentiate between update and create in upsert</issue_title>
<issue_description>Currently upsert will always create new entities if you supply the required fields (in lots of our tables only an id is needed and nothing more).
It would be nice if we could supply additional headers (or a flag) for the
If-Match: * header (or the If-None-Match: * but then you could also use create) to limit this cf. https://learn.microsoft.com/en-us/power-apps/developer/data-platform/use-upsert-insert-update-record?tabs=webapi</issue_description>

<agent_instructions>* Implement a new keyword argument in the upsert method of DataverseEntity

  • This keyword argument should enable "update" mode in the request header according to the linked docs in the issue
  • Expand tests to cover this behavior
  • Make a branch from main to commit your suggested code </agent_instructions>

Comments on the Issue (you are @copilot in this section)

@MarcusRisanger Hi there!

I could take a look at adding a options in the upsert method for these headers. Would have to do some testing to see how the current API handler behaves in practice with partial "failures" :)

You are also welcome to submit a PR!</comment_new>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 3, 2026 09:51
…update modes

Co-authored-by: MarcusRisanger <69350948+MarcusRisanger@users.noreply.github.com>
Co-authored-by: MarcusRisanger <69350948+MarcusRisanger@users.noreply.github.com>
Copilot AI changed the title [WIP] Feature Request: differentiate between update and create in upsert Add match parameter to upsert for controlling create/update behavior Feb 3, 2026
Copilot AI requested a review from MarcusRisanger February 3, 2026 09:55
Copilot AI and others added 2 commits February 3, 2026 13:05
Co-authored-by: MarcusRisanger <69350948+MarcusRisanger@users.noreply.github.com>
Copilot AI changed the title Add match parameter to upsert for controlling create/update behavior Restrict upsert match parameter to individual mode only Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: differentiate between update and create in upsert

2 participants