Sqla-filters
Introduction
The purpose of this project is to set the basic class so that you can create a tree that will be then used to filter a request made with the SQLAlchemy ORM.
Currently, the elements provided are as Follows:
- the nodes (see: the table Below)
- the class SqlaFilterTree which contains the tree and allows to print it.
- the class BaseSqlaParser which serves as the basis if you create a parser that allows generating a tree.
This project is also for me a way to experience the namespace packages.
Installation
pip install sqla-filters
Operators
The following operators are or will be implemented:
| support | operators | name | code |
|---|---|---|---|
| [x] | like | like | like() |
| [x] | eq | equal | operators.eq |
| [x] | not_eq | not equal | operators.ne |
| [x] | null | null | is None |
| [x] | not_null | not null | is not None |
| [x] | gt | greater than | operators.gt |
| [x] | gte | greater than or equal | operators.ge |
| [x] | lt | lower than | operators.lt |
| [x] | lte | lower than or equal | operators.le |
| [x] | in | in | in_() |
| [x] | not_in | not in | ~.in_() |
| [x] | contains | contains | operators.contains |
Tree
This is an example of what a tree looks like.
+----------------------+
| |
| and |
| |
-----------------------+
||
||
||
+----------------------+ || +----------------------+
| | || | |
| or <------------> age == 21 |
| | | |
+----------------------+ +----------------------+
||
||
||
+----------------------+ || +----------------------+
| | || | |
| name == toto <----------------> name == tata |
| | | |
+----------------------+ +----------------------+
Contribute
You can contribute to the project using different ways.
1 | Classical
Fork the repository and run the following command to install the dependencies and the dev dependencies.
pip install -e '.[dev]'
Pipenv Pipefile is also available if needed.
2 | Using namespace features
If you want to contribute using the namespace features it's really simple. First create your own project and use the following directories structure.
ProjectFolder
|______src
|______sqla_filters
|______parser
This is an example to create new parser.
You can find example with the following repositories:
Metadata
Release files for sqla-filters 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sqla-filters-0.0.2.tar.gz | 8.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sqla_filters-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.3 kB
Release files / sqla-filters-0.0.2.tar.gz
| Download URL | sqla-filters-0.0.2.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1a2632c556569ad4978fc676b28c942ec36cbbedae93d8532411927db1a94336
|
|
BLAKE2b-256 checksum How to use checksums |
d8033862382c5ffe9bff33ae5b561dc6b16288785237e215e852d279dbd4fe4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.6
|
Release files / sqla_filters-0.0.2-py3-none-any.whl
| Download URL | sqla_filters-0.0.2-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf49535b8a46a5ab8cf364984c437c136e788c48d112668c7a52f360b828f26a
|
|
BLAKE2b-256 checksum How to use checksums |
15badde7cadf267add75f765633737fb5b3976744433733231450b2203dfe1b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.6
|