Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying insert method for bulk transactions #614

Merged
merged 4 commits into from
Oct 25, 2023

Conversation

edkeeble
Copy link
Contributor

@edkeeble edkeeble commented Oct 23, 2023

Description:
We have started adopting the bulk transactions extension for loading data into our pgstac backend, but are blocked by the fact that we occasionally need to re-ingest an updated item. The bulk_item_insert route does not provide a means of specifying alternate data loading methods (e.g. upsert, delsert, etc) and stac-fastapi-pgstac only supports inserts via the create_items function. In the event of a conflict, it returns a ConflictError with no details regarding which of the bulk items caused the conflict, which makes it difficult to correct the issue.

In this PR, I propose adding an optional parameter to the request object for the bulk_item_insert route. This method parameter will allow clients to specify the use of upsert rather than the default insert behavior. I have created a separate PR on stac-fastapi-pgstac to support conditionally using the upsert_items function.

This change should not impact any stac-fastapi backends which do not support alternate loading methods, since they will ignore the optional param.

PR Checklist:

  • pre-commit hooks pass locally
  • Tests pass (run make test)
  • Documentation has been updated to reflect changes, if applicable, and docs build successfully (run make docs)
  • Changes are added to the CHANGELOG.

@edkeeble edkeeble marked this pull request as ready for review October 24, 2023 13:29
@bitner bitner requested a review from gadomski October 24, 2023 16:27
@bitner bitner self-requested a review October 24, 2023 16:31
@gadomski gadomski merged commit d035774 into stac-utils:main Oct 25, 2023
5 checks passed
@edkeeble edkeeble mentioned this pull request Nov 16, 2023
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.

3 participants