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

Feature request: Utility method for counting entities. #126

Open
huysamen opened this issue Sep 11, 2018 · 3 comments
Open

Feature request: Utility method for counting entities. #126

huysamen opened this issue Sep 11, 2018 · 3 comments

Comments

@huysamen
Copy link
Contributor

Like the .list() method, but maybe just select the keys and return the count. I will try and do the implementation sometime and make a PR.

@sebelga
Copy link
Owner

sebelga commented Sep 11, 2018

Hello,
I am not sure this would be the best practice to implement a counter. I would go either by saving the entities in an entity group under an ancestor entity that has a count property (an update this count property in a transaction when creating or deleting an entity). If there is a lot of write I would go with a sharding counter (https://cloud.google.com/appengine/articles/sharding_counters)
What do you think?

@micaww
Copy link
Contributor

micaww commented Sep 11, 2018 via email

@sebelga
Copy link
Owner

sebelga commented Sep 12, 2018

Yeah, I am not against adding a utiliy helper for a counter like @huysamen suggests. I think we would then need to indicate in the Docs other options that might be more efficient according to the use cases.

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

No branches or pull requests

3 participants