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

implement count function #336

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

wiseaidev
Copy link
Contributor

@wiseaidev wiseaidev commented Aug 8, 2022

Related to #283

Implemented as described here. I think I forget to implement the second one with FILTER. It seems like we don't have to pass FILTER in args cause it will work the same as passing multiple fields.

Note that passing LIMIT 0 0 into the query will not work as described in the docs, it will throw an exception. It seems like the docs are outdated or something. The default value LIMIT 0 10 works.

await model.find((model.field1 == value1) & (model.field2 == value2), ...).count()

@wiseaidev wiseaidev force-pushed the impl-count branch 3 times, most recently from 8b6fe19 to 688db86 Compare August 8, 2022 11:32
Signed-off-by: wiseaidev <business@wiseai.dev>
Signed-off-by: wiseaidev <business@wiseai.dev>
@codecov-commenter
Copy link

codecov-commenter commented Aug 10, 2022

Codecov Report

Merging #336 (fe1dd1b) into main (dcd84e0) will decrease coverage by 0.13%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #336      +/-   ##
==========================================
- Coverage   77.25%   77.12%   -0.14%     
==========================================
  Files          12       12              
  Lines        1165     1154      -11     
==========================================
- Hits          900      890      -10     
+ Misses        265      264       -1     
Flag Coverage Δ
unit 77.12% <100.00%> (-0.14%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aredis_om/model/model.py 86.21% <100.00%> (-0.06%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Signed-off-by: wiseaidev <business@wiseai.dev>
@wiseaidev
Copy link
Contributor Author

@dvora-h, this PR is ready for reviews!

@wiseaidev wiseaidev changed the title implement count functionality implement count function Aug 11, 2022
@XChikuX
Copy link

XChikuX commented May 16, 2023

@chayim
Copy link
Contributor

chayim commented Jun 5, 2023

Missed this in the GH notifications. Looking today there's an implementation of count. This would change that implementation.

IMHO we should combine the ideas. Yours uses a batch size, which can be more performant based on data types (great)! though it should make use of DEFAULT_PAGE_SIZE for the batch argument, much like all. WDYT @wiseaidev?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants