Skip to content

Commit

Permalink
removed try/except wrapper on upsert method, added _process_table_err…
Browse files Browse the repository at this point in the history
…or instead of create call (#13815)

fixes #13678
  • Loading branch information
seankane-msft authored Sep 16, 2020
1 parent ce22a3f commit 33b03e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
10 changes: 2 additions & 8 deletions sdk/tables/azure-data-tables/azure/data/tables/_table_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,6 @@ def upsert_entity( # pylint:disable=R1710
partition_key = entity['PartitionKey']
row_key = entity['RowKey']
entity = _add_entity_properties(entity)

try:
metadata = None
if mode is UpdateMode.MERGE:
Expand All @@ -556,10 +555,5 @@ def upsert_entity( # pylint:disable=R1710
raise ValueError("""Update mode {} is not supported.
For a list of supported modes see the UpdateMode enum""".format(mode))
return _trim_service_metadata(metadata)
except ResourceNotFoundError:
return self.create_entity(
partition_key=partition_key,
row_key=row_key,
table_entity_properties=entity,
**kwargs
)
except HttpResponseError as error:
_process_table_error(error)
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,5 @@ async def upsert_entity(
raise ValueError("""Update mode {} is not supported.
For a list of supported modes see the UpdateMode enum""".format(mode))
return _trim_service_metadata(metadata)
except ResourceNotFoundError:
return await self.create_entity(
partition_key=partition_key,
row_key=row_key,
table_entity_properties=entity,
**kwargs
)
except HttpResponseError as error:
_process_table_error(error)

0 comments on commit 33b03e6

Please sign in to comment.