django-mongoengine-rql


Namedjango-mongoengine-rql JSON
Version 0.2.2 PyPI version JSON
download
home_pagehttps://connect.cloudblue.com/community/api/rql/
SummaryDjango Mongoengine RQL Filtering
upload_time2023-07-03 13:36:05
maintainer
docs_urlNone
authorIngram Micro
requires_python>=3.8,<4.0
licenseApache-2.0
keywords rql filter django mongo mongoengine
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Django Mongoengine RQL

[![pyversions](https://img.shields.io/pypi/pyversions/django-mongoengine-rql.svg)](https://pypi.org/project/django-mongoengine-rql/)
[![PyPi Status](https://img.shields.io/pypi/v/django-mongoengine-rql.svg)](https://pypi.org/project/django-mongoengine-rql/)
[![PyPI status](https://img.shields.io/pypi/status/django-mongoengine-rql.svg)](https://pypi.org/project/django-mongoengine-rql/)
[![PyPI Downloads](https://img.shields.io/pypi/dm/django-mongoengine-rql)](https://pypi.org/project/django-mongoengine-rql/)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=django-mongoengine-rql&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=django-mongoengine-rql)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=django-mongoengine-rql&metric=coverage)](https://sonarcloud.io/summary/new_code?id=django-mongoengine-rql)


## Introduction

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 for fast and convenient database interaction. RQL was designed for use in URLs to request object-style data structures.

This library is a Django-Mongoengine specific implementation of RQL filtering.

[RQL Reference](https://connect.cloudblue.com/community/api/rql/)

[Django RQL](https://github.com/cloudblue/django-rql)

[Django Mongoengine](https://github.com/MongoEngine/django-mongoengine)

## Install

`Django Mongoengine RQL` can be installed from [pypi.org](https://pypi.org/project/django-mongoengine-rql/) using pip:

```
$ pip install django-mongoengine-rql
```

## Documentation

This library is fully based on [Django RQL](https://github.com/cloudblue/django-rql), so there are no specific docs for it.
Full documentation for Django-RQL is available at [https://django-rql.readthedocs.org](https://django-rql.readthedocs.org).

## Example

```python
# filters.py
from dj_mongoengine_rql.filter_cls import MongoengineRQLFilterClass
from py_rql.constants import FilterLookups
from your_docs import Document

class DocFilters(MongoengineRQLFilterClass):
    MODEL = Document
    SELECT = True
    FILTERS = (
        'filter1',
        {
            'filter': 'filter2',
            'source': 'related_doc__doc_field',
        },
        {
            'namespace': 'ns1',
            'filters': ('ns1f',),
        },
        {
            'filter': 'filter3',
            'lookups': {FilterLookups.EQ, FilterLookups.IN},
        },
    )


# views.py
from dj_rql.drf.backend import RQLFilterBackend
from dj_rql.drf.paginations import RQLContentRangeLimitOffsetPagination
from rest_framework import mixins
from rest_framework.viewsets import GenericViewSet

class DRFViewSet(mixins.ListModelMixin, GenericViewSet):
    queryset = Document.objects.all()
    rql_filter_class = DocFilters
    pagination_class = RQLContentRangeLimitOffsetPagination
    filter_backends = (RQLFilterBackend,)

```

## Notes

Due to implementation and Mongo engine features there may be some limitations in filtering, for example:
* `distinct` setting is not supported for filters
* annotations are not supported, as well


## Development

1. Python 3.8+
2. Install dependencies `pip install poetry && poetry install`
3. We use `isort` library to order and format our imports, and `black` - to format the code. 
   We check it using `flake8-isort` and `flake8-black` libraries (automatically on `flake8` run).  
   For convenience you may run `docker compose run format` to format the code.

## Testing

1. Python 3.8+
0. Install dependencies `pip install poetry && poetry install`

Check code style: `poetry run flake8`
Run tests: `poetry run pytest`
Run integration tests: `docker compose run app_test`

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`

## License

`Django Mongoengine RQL` is released under the [Apache License Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).

            

Raw data

            {
    "_id": null,
    "home_page": "https://connect.cloudblue.com/community/api/rql/",
    "name": "django-mongoengine-rql",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "rql,filter,django,mongo,mongoengine",
    "author": "Ingram Micro",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/cf/f0/1ec1c7b8b5174b5b9c5afa4464cfe94b9db71a43cd23c0cf5397605c6224/django_mongoengine_rql-0.2.2.tar.gz",
    "platform": null,
    "description": "# Django Mongoengine RQL\n\n[![pyversions](https://img.shields.io/pypi/pyversions/django-mongoengine-rql.svg)](https://pypi.org/project/django-mongoengine-rql/)\n[![PyPi Status](https://img.shields.io/pypi/v/django-mongoengine-rql.svg)](https://pypi.org/project/django-mongoengine-rql/)\n[![PyPI status](https://img.shields.io/pypi/status/django-mongoengine-rql.svg)](https://pypi.org/project/django-mongoengine-rql/)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/django-mongoengine-rql)](https://pypi.org/project/django-mongoengine-rql/)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=django-mongoengine-rql&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=django-mongoengine-rql)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=django-mongoengine-rql&metric=coverage)](https://sonarcloud.io/summary/new_code?id=django-mongoengine-rql)\n\n\n## Introduction\n\nRQL (Resource query language) is designed for modern application development. It is built for the web, ready for NoSQL, and highly extensible with simple syntax.\nThis is a query language for fast and convenient database interaction. RQL was designed for use in URLs to request object-style data structures.\n\nThis library is a Django-Mongoengine specific implementation of RQL filtering.\n\n[RQL Reference](https://connect.cloudblue.com/community/api/rql/)\n\n[Django RQL](https://github.com/cloudblue/django-rql)\n\n[Django Mongoengine](https://github.com/MongoEngine/django-mongoengine)\n\n## Install\n\n`Django Mongoengine RQL` can be installed from [pypi.org](https://pypi.org/project/django-mongoengine-rql/) using pip:\n\n```\n$ pip install django-mongoengine-rql\n```\n\n## Documentation\n\nThis library is fully based on [Django RQL](https://github.com/cloudblue/django-rql), so there are no specific docs for it.\nFull documentation for Django-RQL is available at [https://django-rql.readthedocs.org](https://django-rql.readthedocs.org).\n\n## Example\n\n```python\n# filters.py\nfrom dj_mongoengine_rql.filter_cls import MongoengineRQLFilterClass\nfrom py_rql.constants import FilterLookups\nfrom your_docs import Document\n\nclass DocFilters(MongoengineRQLFilterClass):\n    MODEL = Document\n    SELECT = True\n    FILTERS = (\n        'filter1',\n        {\n            'filter': 'filter2',\n            'source': 'related_doc__doc_field',\n        },\n        {\n            'namespace': 'ns1',\n            'filters': ('ns1f',),\n        },\n        {\n            'filter': 'filter3',\n            'lookups': {FilterLookups.EQ, FilterLookups.IN},\n        },\n    )\n\n\n# views.py\nfrom dj_rql.drf.backend import RQLFilterBackend\nfrom dj_rql.drf.paginations import RQLContentRangeLimitOffsetPagination\nfrom rest_framework import mixins\nfrom rest_framework.viewsets import GenericViewSet\n\nclass DRFViewSet(mixins.ListModelMixin, GenericViewSet):\n    queryset = Document.objects.all()\n    rql_filter_class = DocFilters\n    pagination_class = RQLContentRangeLimitOffsetPagination\n    filter_backends = (RQLFilterBackend,)\n\n```\n\n## Notes\n\nDue to implementation and Mongo engine features there may be some limitations in filtering, for example:\n* `distinct` setting is not supported for filters\n* annotations are not supported, as well\n\n\n## Development\n\n1. Python 3.8+\n2. Install dependencies `pip install poetry && poetry install`\n3. We use `isort` library to order and format our imports, and `black` - to format the code. \n   We check it using `flake8-isort` and `flake8-black` libraries (automatically on `flake8` run).  \n   For convenience you may run `docker compose run format` to format the code.\n\n## Testing\n\n1. Python 3.8+\n0. Install dependencies `pip install poetry && poetry install`\n\nCheck code style: `poetry run flake8`\nRun tests: `poetry run pytest`\nRun integration tests: `docker compose run app_test`\n\nTests reports are generated in `tests/reports`.\n* `out.xml` - JUnit test results\n* `coverage.xml` - Coverage xml results\n\nTo generate HTML coverage reports use:\n`--cov-report html:tests/reports/cov_html`\n\n## License\n\n`Django Mongoengine RQL` is released under the [Apache License Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Django Mongoengine RQL Filtering",
    "version": "0.2.2",
    "project_urls": {
        "Homepage": "https://connect.cloudblue.com/community/api/rql/",
        "Repository": "https://github.com/cloudblue/django-mongoengine-rql"
    },
    "split_keywords": [
        "rql",
        "filter",
        "django",
        "mongo",
        "mongoengine"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eef5fca722a0dc933672eff58e92bc0124fa6ea0ba54cbe720095743c4faa102",
                "md5": "637d9bcf63a18d64c034cede65ffa5ba",
                "sha256": "b6df362eef5aa08ccd3893302f3f9199d9472c30c6896b8e6aa4a886a2acf832"
            },
            "downloads": -1,
            "filename": "django_mongoengine_rql-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "637d9bcf63a18d64c034cede65ffa5ba",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 8681,
            "upload_time": "2023-07-03T13:36:04",
            "upload_time_iso_8601": "2023-07-03T13:36:04.574532Z",
            "url": "https://files.pythonhosted.org/packages/ee/f5/fca722a0dc933672eff58e92bc0124fa6ea0ba54cbe720095743c4faa102/django_mongoengine_rql-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cff01ec1c7b8b5174b5b9c5afa4464cfe94b9db71a43cd23c0cf5397605c6224",
                "md5": "6f578cd6fc2c168bd08d2e75f8f03bbf",
                "sha256": "1f53ea201c11394178b0a49145336538139f2e4138f37d91b1d0b111ffea96ff"
            },
            "downloads": -1,
            "filename": "django_mongoengine_rql-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "6f578cd6fc2c168bd08d2e75f8f03bbf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 7793,
            "upload_time": "2023-07-03T13:36:05",
            "upload_time_iso_8601": "2023-07-03T13:36:05.887466Z",
            "url": "https://files.pythonhosted.org/packages/cf/f0/1ec1c7b8b5174b5b9c5afa4464cfe94b9db71a43cd23c0cf5397605c6224/django_mongoengine_rql-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-03 13:36:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cloudblue",
    "github_project": "django-mongoengine-rql",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "django-mongoengine-rql"
}
        
Elapsed time: 0.20587s