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.

Source Distribution

sqlalchemy-querybuilder-0.1.2.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqlalchemy_querybuilder-0.1.2-py2.py3-none-any.whl (5.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sqlalchemy-querybuilder-0.1.2.tar.gz.

File metadata

File hashes

Hashes for sqlalchemy-querybuilder-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3dff18ce67849318e937db0274557f9178b4839916db07e22558cdc40aaddb45
MD5 cb405ce2c4329024dbea3bcef03ac952
BLAKE2b-256 7cdfde5be8709234b582264699985d0b8a4492002a1030fca11d76e02ec5e5e8

See more details on using hashes here.

File details

Details for the file sqlalchemy_querybuilder-0.1.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for sqlalchemy_querybuilder-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b292b65ca0bacd9c4ad59e6168d950141775ae3b71135da6dfda91ca6ca72320
MD5 efa28e9b46f4733964ed649677bc8c35
BLAKE2b-256 11ba8e1b627f70ba807c41b1b7243e480a410315601001ca5f7528f59e460302

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page