Build sqlalchemy queries from jQuery-Query json
pip install sqlalchemy-querybuilder==0.1.5
This package implements a sqlalchemy query builder for json data generated with (but not limited to) jQuery QueryBuilder.
#!python pip install sqlalchemy-querybuilder
Using sqlalchemy-querybuilder is very simple:
#!python from sqlalchemy_querybuilder import Filter from myapp import models, query rule = { "condition": "OR", "rules": [{ "field": "mytable.myfield", "operator": "equal", "value": "foo" }, ], } myfilter = Filter(models, query) print(myfilter)
The following attributes from the rules are ignored and therefore can be omitted:
id
type
input
sqlalchemy-querybuilder does not do any kind of json validation.
Filter
accepts two arguments, models
and query
:
declarative_base
or a dict of such classes with the name of the tables
as keys.Bugfixes
Improvements