-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add unpaginated versions of multi-row get methods (w/tests) #62
Conversation
Okay, sure. Not tonight, might take a couple days, but I'm fine with the alternate approach. 👍 |
Nice, thanks! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #62 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 64 64
Lines 4282 4336 +54
=========================================
+ Hits 4282 4336 +54 ☔ View full report in Codecov by Sentry. |
Includes update to docstrings about using limit=0, and tests.
Includes tests and doctest updates. I considered using the allow_limit_0 arg/attribute to also bypass flagging itemsPerPage=0 in get_paginated, but I ran into complications when setting up the tests. Finally I decided that it went against the entire point of a pagination method to be able to bypass pagination and just added the flagging.
Okay, I rolled back the original branch (well, renamed it and did a fresh checkout) and implemented the alternate method, including checks on the endpoint creator and crud router (with a flag to bypass the checks). The force push is for the new branch. |
Sorry, could you refactor it to use It's a dumb example, but I think it makes more sense with |
I'd opted for |
...Actually, come to think of it, an interesting aspect of changing it to Anyone who wants to provide an unlimited get in their (presumably private, as in my cases) API will have to create an endpoint specifically for it, but I'm okay with that. |
No need to do sanitization in the automatically generated endpoints after all: the refactor coming in the next commit will make it so that unlimited gets are done with limit=None, which can't really be provided via path or query params.
I guess everything worked out even better, great! |
Description
Per #59, this PR is to add new methods to
FastCRUD
to do multi-row gets (without and with joins) that return all rows in a single list without pagination.Changes
Added new methods
get_multi_all
andget_multi_joined_all
that are basically copies minus theoffset
,limit
, andreturn_total_count
args as well as without wrapping the list of result rows in adict
(since that happens in the existing methods to help with pagination).Tests
test_get_multi.py
andtest_get_multi_joined.py
for bothsqlalchemy
andsqlmodel
were copied into new files and adjusted to test the new methods (including removing tests that only made sense in the context of pagination).Checklist