Skip to content

Avoid Pydantic validation on search query #570

@DennyD17

Description

@DennyD17

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions