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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e013f145927630ea5b035e304407887c03182939d8b88ce5b292786b5bcec79 |
|
MD5 | f75cf1d3f099450f74d2d76b4710794b |
|
BLAKE2b-256 | a93fd1b5735e8c9ae86c8bcc2b900d5cb50c94be74c807ac29169a5ea9908c51 |
Hashes for marvin_sqlalchemy_boolean_search-0.2.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 149069c7b72a3290ea60fec2eeca4ab08e4a7ad729ecd0bc6269276170d7d98c |
|
MD5 | e73c5845d7ed4d92ab6ca896ae1107a7 |
|
BLAKE2b-256 | 8918034a6b9b485080cb812f70174ecd14f616cedce162df951ed364363206ef |