[Cosmos] bugfix: set automaticIdGeneration to false properly for upsert_item() calls - #24150
Merged
Conversation
* Removed some stuff * Looking at constructors * Updated request * Added client close * working client creation Co-authored-by: simorenoh <simonmorenohe@gmail.com>
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"
Move branch into local fork
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
simorenoh
requested review from
JericHunter,
annatisch,
kushagraThapar,
simplynaveen20,
tjprescott and
xinlian12
as code owners
April 22, 2022 20:44
Collaborator
|
API change check for API changes are not detected in this pull request for |
tjprescott
approved these changes
Apr 26, 2022
tjprescott
left a comment
Member
There was a problem hiding this comment.
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.
Member
Author
|
/azp run python - cosmos - ci |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.