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

Make sure get_m2m works when no rows match #1090

Closed
dantownsend opened this issue Oct 1, 2024 · 1 comment
Closed

Make sure get_m2m works when no rows match #1090

dantownsend opened this issue Oct 1, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@dantownsend
Copy link
Member

If you use get_m2m to get the related objects:

https://piccolo-orm.readthedocs.io/en/latest/piccolo/schema/m2m.html#get-m2m

It will raise a ValueError if there are no matching objects, because under the hood Piccolo uses the is_in clause which requires at least one value.

We should handle this edge case and return an empty list instead.

@dantownsend
Copy link
Member Author

Fixed by #1089

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Closed
Development

No branches or pull requests

1 participant