Skip to main content

django-dsl

Licence Version

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:

DB image

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)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-domain-specific-language-1.2.6.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file django-domain-specific-language-1.2.6.tar.gz.

File metadata

  • Download URL: django-domain-specific-language-1.2.6.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for django-domain-specific-language-1.2.6.tar.gz
Algorithm Hash digest
SHA256 c5d965add7d8cd0c131f6c4c38597e1ea989269240c1b4a85cd75a138406b9dc
MD5 72393ec5eeafe4309211fea9bbeaabc2
BLAKE2b-256 7c141bb38f14c6451c2081eded850b656cef6d285f216538834090be5a9e31c2

See more details on using hashes here.

File details

Details for the file django_domain_specific_language-1.2.6-py3-none-any.whl.

File metadata

  • Download URL: django_domain_specific_language-1.2.6-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for django_domain_specific_language-1.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 f8dd543dc882d90be831e74b9d1e24baa1998bfa37e7dda25ccfeff58d33a6f3
MD5 f8c2b2834e3e0445aac8f28382ec7780
BLAKE2b-256 d9e0bb790100d48928ec7c0e0551ea0233b30d95d231f294de7dbab0ba6093f5

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.2.6 This release

2 files

1.2.4

1 file

1.2.3

1 file

1.2.2

1 file

1.2.1

1 file

1.2.0

1 file

1.1.1

1 file

1.1.0

1 file

1.0.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page