Skip to main content

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.

This repo is maintained at https://github.com/havok2063/SQLAlchemy-boolean-search, with changes pushed occassionally.

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

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

marvin-sqlalchemy-boolean-search-0.2.2.tar.gz (9.6 kB view hashes)

Uploaded Source

Built Distribution

marvin_sqlalchemy_boolean_search-0.2.2-py2.py3-none-any.whl (9.2 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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