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

Add delete all items by partition key functionality #29186

Merged
merged 10 commits into from
Apr 10, 2023

Conversation

bambriz
Copy link
Member

@bambriz bambriz commented Mar 7, 2023

Description

Add methods to container and client connection to expose the delete all items by partition key functionality in python. If given a valid partition key, it will delete all items belonging to that partition. If a valid partition key is not given, nothing is deleted.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Added methods to container and client connection to expose the delete all items by partition key functionality in python.
@ghost ghost added the Cosmos label Mar 7, 2023
@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

azure-cosmos

Added preview functionality to delete items by partition key, added tests and examples. Updated changelog.
@bambriz bambriz marked this pull request as ready for review April 3, 2023 19:36
@bambriz bambriz changed the title Add Delete by pk methods Add delete all items by partition key functionality Apr 3, 2023
Copy link
Member

@simorenoh simorenoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, just some questions and small suggestions. Would also like it if we had the samples in the document_management.py files since those deal with all the crud operations. Thanks!

sdk/cosmos/azure-cosmos/azure/cosmos/_base.py Outdated Show resolved Hide resolved
sdk/cosmos/azure-cosmos/azure/cosmos/aio/_container.py Outdated Show resolved Hide resolved
sdk/cosmos/azure-cosmos/azure/cosmos/container.py Outdated Show resolved Hide resolved
Updated some formatting for newly added methods. Some fixes for testing delete all items by partitionkey. Added examples to document_management.py.
Match is only available after python v 3.10, removed to be more compatible with earlier python versions.
Minor code adjustments to satisfy Pylint
Added PR link to entry for delete all items by partition key in CHANGELOG.md
Copy link
Member

@simorenoh simorenoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Bryan!

Copy link
Member

@kushagraThapar kushagraThapar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @bambriz for feature :)

sdk/cosmos/azure-cosmos/azure/cosmos/aio/_container.py Outdated Show resolved Hide resolved
sdk/cosmos/azure-cosmos/azure/cosmos/container.py Outdated Show resolved Hide resolved
Fixed issue where passing a None value for partition key caused a 500 http error. Added test for passing invalid partition key values
@bambriz bambriz merged commit bcba7c7 into Azure:main Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants