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

[Cosmos] bugfix: set automaticIdGeneration to false properly for upsert_item() calls #24150

Merged
merged 83 commits into from
Apr 28, 2022
Merged

[Cosmos] bugfix: set automaticIdGeneration to false properly for upsert_item() calls #24150

merged 83 commits into from
Apr 28, 2022

Conversation

simorenoh
Copy link
Member

@simorenoh simorenoh commented Apr 22, 2022

Seems like this option wasn't being parsed properly due to wrong naming, which was allowing for the creation of items with auto-generated id's through the use of upsert_item() method. This is wrong behavior.

With these changes the backend successfully throws errors when users upsert items without an 'id' field in the body. The parsing was happening in _cosmos_client_connection.py, _GetContainerIdWithPathForItem method, and was always being ignored since the option was not being properly set in the upsert_item call.

Marked it as a breaking change since this may have allowed users to create items in the past without passing in an 'id' field in their item bodies - which would now no longer be possible.

simorenoh and others added 30 commits August 13, 2021 13:14
* Removed some stuff

* Looking at constructors

* Updated request

* Added client close

* working client creation

Co-authored-by: simorenoh <[email protected]>
database read works, but ignored exception is returned:
Fatal error on SSL transport
NoneType has no attribute 'send' (_loop._proactor.send)
RuntimeError: Event loop is closed
Unclosed connector/ connection
Added methods needed to use async with when initializing client, but logs output "Exception ignored... Runtime Error: Event loop is closed"
missing upsert and other resources
missing read_all_items and both query methods for container class
Complete item CRUD functionality - only missing queries
Query functionality and container query methods
also fixed README and added examples_async
@azure-sdk
Copy link
Collaborator

API change check for azure-cosmos

API changes are not detected in this pull request for azure-cosmos

Copy link
Member

@tjprescott tjprescott left a comment

Choose a reason for hiding this comment

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

LGTM. I'm somewhat curious why if the service supports an auto-generated ID the SDK doesn't, but clearly this was not the intended behavior in the SDK.

@simorenoh
Copy link
Member Author

/azp run python - cosmos - ci

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tjprescott tjprescott merged commit f80d07b into Azure:main Apr 28, 2022
@simorenoh simorenoh deleted the bugfix-disableautomaticidgen branch May 5, 2022 19:29
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-python that referenced this pull request Jun 5, 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.

4 participants