Advanced filtering on your API endpoints with SQLAlchemy and FIQL

Short Form


How robust is the filtering of your API? Let's delve into how a string of text can become a set of instructions to the API on exactly what records should be returned.


Modern web frameworks make it easy to stand up an API with fairly robust filtering, sorting, and pagination out of the box. The point of this demonstration is not to say that the approach we’ll be looking at is better than the approach of some other framework. But, rather to provide a glimpse into how it could be implemented and gain the subject knowledge required to grep the strengths and weaknesses of this as well as other approaches.

During this demonstration, we’ll pull apart the FIQL draft to find it’s strengths and weaknesses. We’ll investigate how SQLAlchemy applies filters, how this effects the strategy for parsing the FIQL expression, and the implication of this strategy. We’ll subclass SqlAlchemy’s Query class to allow filtering directly from a FIQL expression. And, if time permits, we’ll improve our API by adding sorting and pagination.

It is expected that participants are already familiar HTTP, Python, and WSGI.


rest, flask, python, ORM, fiql, sqlalchemy, fiql-parser

Speaking experience

I presented at Open Source Bridge 2016. I found the experience both nerve-racking and enjoyable. You can view the session information with a link to the slides at the below link:


  • Profile pic

    Serge Domkowski

    Kavi Corporation


    I’ve been involved in making web software for about 22 years. I design and write code, talk about code (much to the delight of my wife), play with my son, ride my bicycle, root for the Timbers, drink beer, and once in a while sleep.