_to_entity_int32 is not appropriate for Python integers #35554
Labels
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
feature-request
This issue requires a new behavior in the product in order be resolved.
needs-team-attention
This issue needs attention from Azure service team or SDK team
Tables
azure-sdk-for-python/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py
Line 148 in 8633144
I have a use case where I'd like to use
Python
integer values within my Cosmos DB table. When the integer values exceed the size allotted to an EdmType.INT32, I receive errors.Since
Python
isn't bound to the same size limitations for its integers, can we get a more appropriate "_to_entity" function for handling Pythonint
s?I would propose this:
def _to_entity_int(value):
int_value = int(value)
if int_value >= 2**63 or int_value < -(2**63):
raise TypeError(_ERROR_VALUE_TOO_LARGE.format(str(int_value), EdmType.INT64))
if int_value >= 2**31 or int_value < -(2**31):
return EdmType.INT64, str(value)
else:
return None, value
Thank you so much!
The text was updated successfully, but these errors were encountered: