aminalaee / sqladmin

SQLAlchemy Admin for FastAPI and Starlette
https://aminalaee.dev/sqladmin/
BSD 3-Clause "New" or "Revised" License
1.78k stars 183 forks source link

Specify particular column to be searched. #788

Open JakNowy opened 1 month ago

JakNowy commented 1 month ago

Checklist

Is your feature related to a problem? Please describe.

I can specify columns to search against, using column_sortable_list. But afaik, it always searches in all columns, which is often unnecessary costly.

Describe the solution you would like.

I would like to be able to pass search terms as keywords eg. "field1 = 'abc'", so that it's the only filter executed on the database level, rather than "field1 = 'abc', field2 = 'abc'".

Describe alternatives you considered

Even better, the filters could be able to differentiate column type and pick more optimal operator than ilike for columns like int or primary key and leverage their indicies. Maybe even between operators for numbers and timestamps?

Additional context

No response

onejgordon commented 1 month ago

Looks related to https://github.com/aminalaee/sqladmin/issues/459. We'd find this extremely useful as well.