Stuck in filters
russell310 opened this issue · 2 comments
russell310 commented
How to use filters here? If you added some examples it will be helpful. For example if we want to filter user table by first_name, last_name, email or status, How we can achieve?
zxul767 commented
The documentation for SQLModel
explains this in a lot of detail: https://sqlmodel.tiangolo.com/tutorial/where/
jonra1993 commented
Hello @russell310 here you can find a couple of ways to do that https://github.com/jonra1993/fastapi-alembic-sqlmodel-async/blob/main/backend/app/app/api/v1/endpoints/user.py at the end they are just sql queries using sqlmodel which is a layer above sqlalchemy.
This endpoint already does a search by first name and last name. It uses pg_trgm for a smarter search