Welcome to sqlalchemy-querybuilder’s documentation

sqlalchemy-querybuilder is a package that implements a sqlalchemy query builder for rules generated with (but not limited to) jQuery QueryBuilder.

Project Status: Active – The project has reached a stable, usable state and is being actively developed. builds.sr.ht status codecov readthedocs

Quick start

Parsing rules using sqlalchemy-querybuilder is very simple:

from sqlalchemy_querybuilder import Filter
from myapp import models, query

rules = {
        "condition": "OR",
        "rules": [{
                   "field": "mytable.myfield",
                   "operator": "equal",
                   "value": "foo"

myfilter = Filter(models, query)

That would produce the following SQL query:

SELECT * FROM mytable WHERE mytable.myfield = 'foo'

The following attributes from the rules are ignored and therefore can be omitted:

  • id
  • type
  • input


There's no rule syntax validation. Rules should be compatible with jquery QueryBuilder.