django-dsl
Requirements
- PLY
- Django
Installation
pip install django-domain-specific-language
Usage
Allows you to search by specifying the name of the column of the database.
Characters allowed:
- Key (column name) :
A-Za-z0-9_. - Value : all except ')' '(' and white space.
Query Parser Syntax:
-
Wildcard Searches: *
- *test : All that ends by test
- test* : All that starts by test
- *test* : All that contains test
\*test\*: All equal to *test*\*test*: All that starts by *test*test\*: All that ends by test*
-
Regex Searches: ~
- ~\W+ : Matches any character which is not a word character.
- \~test : Matches all equal to ~test.
-
Boolean Operators: AND OR NOT
-
Grouping: ( )
-
Date and number Searches (operators: < > <= >=) :
- key>2 : All greater than 2
- key<=2 : All less than or equal to 2
- key>2018-05-04 : All greater than 2018-05-04
- key<=2018-05-04 : All less than or equal to 2018-05-04
-
Date Range Searches (inclusive) (which correspond to SQL queries of BETWEEN):
- key:2018-05-04_2018-05-05
-
Null Searches (which correspond to SQL queries of IS NULL and IS NOT NULL):
- key:True
- key:False
Example
Your database:
The possible researches:
- Country:India AND Product:Ice-cream
- Country:*a* AND NOT Product:~.*e$
In your code:
from django_dsl.run import compile_expr
query = compile_expr(request.GET['expression'])
cls.objects.filter(query)
Metadata
Release files for django-domain-specific-language 1.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-domain-specific-language-1.2.6.tar.gz | 17.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_domain_specific_language-1.2.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.0 kB
Release files / django-domain-specific-language-1.2.6.tar.gz
| Download URL | django-domain-specific-language-1.2.6.tar.gz |
|---|---|
| Size | 17.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c5d965add7d8cd0c131f6c4c38597e1ea989269240c1b4a85cd75a138406b9dc
|
|
BLAKE2b-256 checksum How to use checksums |
7c141bb38f14c6451c2081eded850b656cef6d285f216538834090be5a9e31c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
|
Release files / django_domain_specific_language-1.2.6-py3-none-any.whl
| Download URL | django_domain_specific_language-1.2.6-py3-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f8dd543dc882d90be831e74b9d1e24baa1998bfa37e7dda25ccfeff58d33a6f3
|
|
BLAKE2b-256 checksum How to use checksums |
d9e0bb790100d48928ec7c0e0551ea0233b30d95d231f294de7dbab0ba6093f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
|