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

Avoid Pydantic validation on search query #570

Open
DennyD17 opened this issue Oct 3, 2023 · 1 comment
Open

Avoid Pydantic validation on search query #570

DennyD17 opened this issue Oct 3, 2023 · 1 comment

Comments

@DennyD17
Copy link

DennyD17 commented Oct 3, 2023

Hey!
There are calls of pydantic.main.validate_model in search queries.
It is very CPU-loaded operations. And especially it affects when there are huge models and queries returning many objects. It is not necessary to validate objects in search queries, just while creating and updating.
Can you please remove it or add some setting to avoid it?

For me qfix is:
redis_om.model.model.RedisModel.validate_primary_key = lambda x: True
pydantic.main.validate_model = lambda x, y: (y, set(y.keys()), False)

@DennyD17
Copy link
Author

@slorello89
Please, have a look on it

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

No branches or pull requests

1 participant