Hello! We use sqlalchemy-filters for that. It's a library that we built for passing SQLAlchemy filtering, pagination and sorting to Nameko endpoints.
You can just call your RPC endpoint by doing something like this:
filters = [{'field': 'name', 'op': '==', 'value': 'name_1'}]
order_by = [
{'field': 'name', 'direction': 'asc'},
{'field': 'id', 'direction': 'desc'},
]
page_number=1
page_size=10
rcp_service.my_endpoint(filters, order_by, page_number, page_size)
And then, use sqlalchemy-filters in my_endpoint to perform the filtering, pagination and sorting.
from sqlalchemy_filters import apply_filters, apply_pagination, apply_sort
# existing SQLAlchemy `query` object
query = apply_filters(query, filters)
query = apply_sort(query, order_by)
query, pagination = apply_pagination(query, page_number=1, page_size=10)
The sqlalchemy-filters API accepts a SQLAlchemy query object as an argument so that you can apply your filters to an already filtered query.
I hope this helps!
Julio