-
Notifications
You must be signed in to change notification settings - Fork 1
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
ValueError (Delete) #72
Comments
Hey @Ysnz thanks for reporting the bug. I'm going to try and replicate it to confirm the bug. |
Hey @EricOuma I can confirm the bug that has been reported. I will start working on a fix. Please assign this to me and mark it as a bug. |
@KengoWada Let me know how you plan to approach the problem before you make a PR. |
@EricOuma this is my current solution in - delete_params = {"filter_by": f"id:{[int(obj['id']) for obj in self.data]}"}
+ object_ids = []
+ for obj in self.data:
+ try:
+ object_id = int(obj["id"])
+ except ValueError:
+ object_id = str(obj["id"])
+ object_ids.append(object_id)
+
+ if all(isinstance(id_, int) for id_ in object_ids):
+ filter_by = f"id:{object_ids}"
+ else:
+ filter_by = f"id: {object_ids}".replace("'", "")
+
+ delete_params = {"filter_by": filter_by} WDYT |
What happens if you don't convert it to an integer at all; just using the
id as is. I don't think typesense is aware that its an integer.
…On Fri, 9 Feb 2024, 18:31 Kengo Wada, ***@***.***> wrote:
@EricOuma <https://github.com/EricOuma> this is my current solution
- delete_params = {"filter_by": f"id:{[int(obj['id']) for obj in self.data]}"}
+ object_ids = []+ for obj in self.data:+ try:+ object_id = int(obj["id"])+ except ValueError:+ object_id = str(obj["id"])+ object_ids.append(object_id)++ if all(isinstance(id_, int) for id_ in object_ids):+ filter_by = f"id:{object_ids}"+ else:+ filter_by = f"id: {object_ids}".replace("'", "")++ delete_params = {"filter_by": filter_by}
WDYT
—
Reply to this email directly, view it on GitHub
<#72 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AH4HSZEGQFOFI5D5AQQL5XLYSY6LNAVCNFSM6AAAAABCKT77FKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZWGEZTKNRYG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@EricOuma Yeah, that's the way to go. You need to remove the single quotes that Python adds to strings. According to Typesense - delete_params = {"filter_by": f"id:{[int(obj['id']) for obj in self.data]}"}
+ delete_params = {"filter_by": f"id: {[obj['id'] for obj in self.data]}".replace("'", "")} |
Description
When attempting to delete an object in the admin interface, an internal server error occurs. The error is specifically related to the attempt to convert a UUID ('90b608d0-1684-4b5e-adf3-fb5c0c21ca96') to an integer during the deletion process.
How To Reproduce
Steps to reproduce the behavior:
Expected behavior
The deletion process should occur without errors, and the object with the provided UUID should be deleted successfully.
Additional context
The issue is related to the attempt to convert UUIDs to integers during the deletion process, resulting in a ValueError.
Screenshots
The text was updated successfully, but these errors were encountered: