A library to filter SQLAlchemy queries using a JSON-like filter specification. Current version: 0.13.0, supports SQLAlchemy 1.4, Python 3.7+. Release cadence is irregular.
pip install sqlalchemy-filtersVerified import paths — ran on the pinned version, not inferred.
Filters a SQLAlchemy query with a simple filter specification.
Upgrade to Python 3.7+ and sqlalchemy-filters >=0.13.0.
Use 'eq', 'ne', 'gt', 'lt', 'ge', 'le', 'like', 'ilike', 'in', 'not_in', 'any', 'not_any'.
Pass `auto_join=False` to `apply_filters` to prevent automatic joins.
Ensure hybrid attributes are properly defined with expressions.
Use `from sqlalchemy_filters import apply_filters`.
Check that the field exists on the model and the operator is one of: eq, ne, gt, lt, ge, le, like, ilike, in, not_in, any, not_any.
Disable auto-join with `auto_join=False` or explicitly add the join in the query.