Build sqlalchemy queries from jQuery-Query json
Project description
This package implements a sqlalchemy query builder for json data generated with (but not limited to) jQuery QueryBuilder.
Installation
#!python pip install sqlalchemy-querybuilder
Quickstart
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
WARNING
sqlalchemy-querybuilder does not do any kind of json validation.
Filter class
Filter accepts two arguments, models and query:
models - can either be a module defining classes which inherit from :py:func:declarative_base or a dict of such classes with the name of the tables as keys
query - a SQLAlchemy query object. Optionaly loaded with some entity.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for sqlalchemy_querybuilder-0.1b0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79b543c3d428342beb3979ad25084921c7923ef861eeb179aa71a8fac77559d5 |
|
MD5 | 669b3c390df583b2af9d23f13b2cd6da |
|
BLAKE2b-256 | 91c58a1d5c1595054b6e95d476e305d4fc7ef58adc05c65794bbbf50def64182 |