Skip to content
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

_to_entity_int32 is not appropriate for Python integers #35554

Open
minerjaime opened this issue May 8, 2024 · 4 comments
Open

_to_entity_int32 is not appropriate for Python integers #35554

minerjaime opened this issue May 8, 2024 · 4 comments
Assignees
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

Comments

@minerjaime
Copy link

minerjaime commented May 8, 2024

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 Python ints?

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!

@github-actions github-actions bot added 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. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. Tables labels May 8, 2024
Copy link

github-actions bot commented May 8, 2024

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @klaaslanghout.

@minerjaime
Copy link
Author

To bypass this issue, I have resorted to storing these particular "large" int values as strings and making the appropriate casts in the python code.

@swathipil
Copy link
Member

Hi @minerjaime - thanks for opening an issue! We'll take a look asap!

@swathipil swathipil removed the Service Attention This issue is responsible by Azure service team. label May 9, 2024
@github-actions github-actions bot added the needs-team-triage This issue needs the team to triage. label May 9, 2024
@YalinLi0312
Copy link
Member

Hi @minerjaime , we've noticed the inappropriate encoding in Tables and we're working on it. We'll ship a beta with new encoding in next month, stay tuned!

@YalinLi0312 YalinLi0312 added feature-request This issue requires a new behavior in the product in order be resolved. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that needs-team-triage This issue needs the team to triage. labels May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

3 participants