Sqla-filters-yaml
Add yaml parser to the sqla-filters package.
Introduction
Add YAML support to sqla-filters.
Requirements
This package use the python package pyyaml. To install pyyaml you need to have the yaml.h header file. If it's not
present on your system you need to install the libyaml-dev package.
- On Fedora
sudo dnf install libyaml-devel
- On Debian based distribution (Ubuntu, ...)
sudo apt install libyaml-dev
Installation
pip install sqla-filter-yaml
Getting Started
YAML format
---
type: and
data:
- type: or
data:
- type: operator
data:
attribute: name
operator: eq
value: toto
- type: operator
data:
attribute: name
operator: eq
value: tata
- type: operator
data:
attribute: age
operator: eq
value: 21
⚠️ Yaml format can change in the futur. ⚠️
Example code
Create an instance of the YAMLilterParser from the yaml string / document.
Example:
# Sqlalchemy setup + model definition
# Create a YAML parser instance
parser = YAMLiltersParser(raw_json_string)
# You can finaly filter your query
query = session.query(Post)
filtered_query = parser.tree.filter(query)
# Get the results
query.all()
Result tree
+----------------------+
| |
| and |
| |
-----------------------+
||
||
||
+----------------------+ || +----------------------+
| | || | |
| or <------------> age == 21 |
| | | |
+----------------------+ +----------------------+
||
||
||
+----------------------+ || +----------------------+
| | || | |
| name == toto <----------------> name == tata |
| | | |
+----------------------+ +----------------------+
Contribute
Fork the repository and run the following command to install the dependencies and the dev dependencies.
pip install -e '.[dev]'
Metadata
Release files for sqla-filters-yaml 0.0.1
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-yaml-0.0.1.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sqla_filters_yaml-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.9 kB
Release files / sqla-filters-yaml-0.0.1.tar.gz
| Download URL | sqla-filters-yaml-0.0.1.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a485fe26b7a861a9868abee9aebd2a9224939daf717f1d2b8683b51f120b86e
|
|
BLAKE2b-256 checksum How to use checksums |
81b7a6f6ae2fd7469cc3edda4230234e9a52f4b15bda4db7b382618976d2a8ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6
|
Release files / sqla_filters_yaml-0.0.1-py3-none-any.whl
| Download URL | sqla_filters_yaml-0.0.1-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2a575b24c45f7bd745d9e1d4b191205e311493f35b7543f0084294b8d4cc85cf
|
|
BLAKE2b-256 checksum How to use checksums |
f784312220ba7db87e0277e9890f8e854865f78011712a1e466a26647ab05573
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6
|