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

Support limiting .find() to specific fields #4

Open
yrd opened this issue Dec 16, 2021 · 0 comments
Open

Support limiting .find() to specific fields #4

yrd opened this issue Dec 16, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@yrd
Copy link
Member

yrd commented Dec 16, 2021

If find() gets a keyword argument fields: Iterable[str], resulting model objects should only cache those fields. There are two possibilities for what could happen when an unavailable field gets accessed:

  • The corresponding value gets fetched. This could however have more implications, as it would mean that __get__ will potentially block / become awaitable depending on the pardigm.
  • An exception is raised. A new method (which is sync or async, depending on context) is defined that fetches all (or only a subset) of the currently unavailable field values. It could be called something like refresh.

The latter approach is probably both easier to implement and better to use in terms of supporting both sync and async frameworks.

@yrd yrd self-assigned this Dec 16, 2021
@yrd yrd added the enhancement New feature or request label Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant