Boolean search expression parser for SQLAlchemy
Project description
Changes
This repo has diverged from the original fork. It includes expanded parsing rules; see 0.1.1 changes in the CHANGELOG. It has also been restructured as a standalone pypi package called marvin-sqlalchemy-boolean-search
, as its
primary use is for https://github.com/sdss/marvin. For a more general standalone package, see https://github.com/havok2063/boolean_parser, which rebuilds this repo functionality into a fully fledged python package.
SQLAlchemy-boolean-search
SQLAlchemy-boolean-search translates a boolean search string such as:
"field1=*something* and not (field2==1 or parent.field3<=10.0)"
into its corresponding SQLAlchemy query filter:
and_(DataModel.field1.ilike('%something%'),
not_(or_(DataModel.field2.__eq__(2),
DataModel.parent.field3.__le__(10.0))))
Relationship field names such as 'parent.grandparent.name' are accepted.
The code is stable, is used in production, and enjoys a test coverage of 100%.
Documentation
SQLAlchemy-boolean-search documentation
Authors
- Ling Thio - ling.thio [at] gmail.com
Acknowledgements
This project would not be possible without the use of the following amazing offerings:
Alternative modules
- SQLAlchemy-Searchable adds full text searching and relies on PostgreSQL vectors and triggers.
- sqlalchemy-elasticquery
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 Distribution
Built Distribution
Hashes for marvin-sqlalchemy-boolean-search-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 167e5216e69803cd45597df5f750817883c9c4a1892e58dbe917939606310016 |
|
MD5 | 619216435cf28b1e930ab7371df237dd |
|
BLAKE2b-256 | 54b352f1aef50bd954d9b18342c1b098edd6a076b5aff96c3aea20f2135ef1c8 |
Hashes for marvin_sqlalchemy_boolean_search-0.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 909db3b34e6a6d4ecd13bb3aa9463c5d91ca6b09c2ead22f6bee44cc900932a5 |
|
MD5 | bc596627e0193cfb2fee8fcdf2794350 |
|
BLAKE2b-256 | 93e812dbd70b3126c3ae3beb04c498624cc3cbfdef8b1e41679f3ccf54fd7679 |