Skip to main content

Python RQL Filtering

Project description

Python RQL

pyversions PyPi Status codecov PyPI status Quality Gate Status

RQL

RQL (Resource query language) is designed for modern application development. It is built for the web, ready for NoSQL, and highly extensible with simple syntax. This is a query language fast and convenient database interaction. RQL was designed for use in URLs to request object-style data structures.

RQL Reference

Notes

Parsing is done with Lark (cheatsheet). The current parsing algorithm is LALR(1) with standard lexer.

Supported operators

  1. Comparison (eq, ne, gt, ge, lt, le, like, ilike, search)
  2. List (in, out)
  3. Logical (and, or, not)
  4. Constants (null(), empty())
  5. Ordering (ordering)
  6. Select (select)
  7. Tuple (t)

Example

from py_rql import parse
from py_rql.exceptions import RQLFilterError

try:
    tree = parse('eq(key,value)')
except RQLFilterError:
    pass

Notes

  1. Values with whitespaces or special characters, like ',' need to have "" or ''
  2. Supported date format is ISO8601: 2019-02-12
  3. Supported datetime format is ISO8601: 2019-02-12T10:02:00 / 2019-02-12T10:02Z / 2019-02-12T10:02:00+03:00

Development

  1. Python 3.6+
  2. Install dependencies requirements/dev.txt

Testing

  1. Python 3.6+
  2. Install dependencies requirements/test.txt

Check code style: flake8 Run tests: pytest

Tests reports are generated in tests/reports.

  • out.xml - JUnit test results
  • coverage.xml - Coverage xml results

To generate HTML coverage reports use: --cov-report html:tests/reports/cov_html

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

lib-rql-1.0.0.tar.gz (13.3 kB view hashes)

Uploaded Source

Built Distribution

lib_rql-1.0.0-py3-none-any.whl (17.1 kB view hashes)

Uploaded 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