Skip to main content

Build sqlalchemy queries from jQuery-Query json

Project description

SQLAlchemy query builder for jQuery QueryBuilder

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 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.

Release History

0.1.1 (2017-11-19)

Bugfixes

  • Fixed issue when models parameter was a dict() of classes.
  • Added missing test for models parameter

0.1 (2017-07-10)

Improvements

  • First release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for sqlalchemy-querybuilder, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size sqlalchemy_querybuilder-0.1.2-py2.py3-none-any.whl (5.7 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size sqlalchemy-querybuilder-0.1.2.tar.gz (3.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page