-
Notifications
You must be signed in to change notification settings - Fork 3k
[Tables] use etag from entity if match condition is given #18271
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
Conversation
if match_condition and not etag: | ||
try: | ||
etag = entity.metadata.get("etag", None) | ||
except AttributeError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you might also need to catch TypeError
here - if a customer passes in a TableEntity
instance they created, then entity.metadata
will be None
(and we should add a test for this).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated and added a test!
sdk/tables/azure-data-tables/azure/data/tables/_table_client.py
Outdated
Show resolved
Hide resolved
sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py
Outdated
Show resolved
Hide resolved
sdk/tables/azure-data-tables/azure/data/tables/aio/_table_client_async.py
Outdated
Show resolved
Hide resolved
new_etag = e.metadata["etag"] | ||
e.metadata["etag"] = old_etag | ||
|
||
with pytest.raises(HttpResponseError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this actually just a raw HttpResponseError
? Or are we raising azure.core.ResourceModifiedError
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a raw HttpResponseError
, here's what it looks like.
E azure.core.exceptions.HttpResponseError: The update condition specified in the request was not satisfied.
E RequestId:0c9fe685-8002-003d-4cd4-41ac3f000000
E Time:2021-05-05T17:33:24.9865841Z
E ErrorCode:UpdateConditionNotSatisfied
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting! I've made a note to fix that - but could come post-GA if needed.
…into azure_purview_catalog * 'master' of https://github.com/Azure/azure-sdk-for-python: ignore analysis for swagger readmes (Azure#18520) [purview] add azure-purview-nspkg (Azure#18518) [AppConfiguration] Appconfig consistency (Azure#18493) [Container Registry] Improved samples (Azure#18263) [Container Registry] renamings (Azure#18492) [ServiceBus] internal code rename and sample readme update (Azure#18516) [EventHub] update link in sample readme (Azure#18517) Post Process Event Names Script (Azure#18419) [Tables] use etag from entity if match condition is given (Azure#18271) adding operation-location to headers that are scrubbed (Azure#18514)
…into azure_purview_scanning * 'master' of https://github.com/Azure/azure-sdk-for-python: (550 commits) del useless files (Azure#18528) delete existing useless files for trafficmanager (Azure#18525) Define new replacer to replace keys in recording (Azure#18294) [purview] add purview nspkg to ci (Azure#18523) ignore analysis for swagger readmes (Azure#18520) [purview] add azure-purview-nspkg (Azure#18518) [AppConfiguration] Appconfig consistency (Azure#18493) [Container Registry] Improved samples (Azure#18263) [Container Registry] renamings (Azure#18492) [ServiceBus] internal code rename and sample readme update (Azure#18516) [EventHub] update link in sample readme (Azure#18517) Post Process Event Names Script (Azure#18419) [Tables] use etag from entity if match condition is given (Azure#18271) adding operation-location to headers that are scrubbed (Azure#18514) [Tables] Adds support for AzureNamedKeyCredential (Azure#18456) [Tables] delete_entity takes an entity instead of row and partition key (Azure#18269) [Tables] Removed TableEntity attribute wrapper (Azure#18489) [EventHub&ServiceBus] Bump uAMQP dependency (Azure#17942) [ServiceBus] add keyword override support to update_ methods in mgmt module (Azure#18210) Add compatibility switch to disable CAE (Azure#18148) ...
No description provided.