azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

delete_entity with TableEntity requires RowKey to be string

Open mtin opened this issue 3 years ago • 1 comments

When using create_entity or upsert_entity and passing a TableEntity the SDK takes care of converting the property data types. For example, the RowKey could have type UUID. See _add_entity_properties.

delete_entity also offers an overload accepting a TableEntity - but then uses PartitionKey and RowKey directly, raising a TypeError: PartitionKey or RowKey must be of type string. when I use my same object that I pass to create/upsert.

Is this expected behaviour? I can cast to string, but wouldn't it be more consistent if this would be handled by the SDK? 😇

mtin avatar Sep 21 '22 10:09 mtin

Hi @mtin thanks for the feedback, we'll get back to you asap.

l0lawrence avatar Sep 21 '22 15:09 l0lawrence

Hi @mtin , thanks for your patience!

We found more issues while working on this one - not only has issue in UUID type, also in other entity's property types like datetime and bytes - after our investigation. And somehow you could pass UUID type to create/upsert operations is actually a "bug", the key types are not expected to be other types except string. So for this issue, casting to string in your end is a simple work around for now, we will close your PR as it only concentrates on accepting UUID type. Instead, we are thinking about a new design in serialization to resolve issues while dealing with UUID, datetime and bytes types, we'll fix them soon.

Thanks!

YalinLi0312 avatar Nov 30 '22 23:11 YalinLi0312