odata-query


Nameodata-query JSON
Version 0.9.1 PyPI version JSON
download
home_page
SummaryAn OData query parser and transpiler.
upload_time2023-11-15 07:24:18
maintainer
docs_urlNone
authorOliver Hofkens
requires_python>=3.7,<4.0
licenseMIT
keywords odata query parser
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            OData-Query
===========

.. image:: https://sonarcloud.io/api/project_badges/measure?project=gorillaco_odata-query&metric=alert_status&token=cb35257e036d950788a0f628af7062929318482b
    :alt: Quality Gate Status
    :target: https://sonarcloud.io/dashboard?id=gorillaco_odata-query

.. image:: https://sonarcloud.io/api/project_badges/measure?project=gorillaco_odata-query&metric=coverage&token=cb35257e036d950788a0f628af7062929318482b
    :alt: Coverage
    :target: https://sonarcloud.io/dashboard?id=gorillaco_odata-query

.. image:: https://readthedocs.org/projects/odata-query/badge/?version=latest
    :alt: Documentation Status
    :target: https://odata-query.readthedocs.io/en/latest/?badge=latest

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :alt: Code style: black
    :target: https://github.com/psf/black


``odata-query`` is a library that parses `OData v4`_ filter strings, and can
convert them to other forms such as `Django Queries`_, `SQLAlchemy Queries`_,
or just plain SQL.


Installation
------------

``odata-query`` is available on pypi, so can be installed with the package manager
of your choice:

.. code-block:: bash

    pip install odata-query
    # OR
    poetry add odata-query
    # OR
    pipenv install odata-query


The package defines the following optional ``extra``'s:

* ``django``: If you want to pin a compatible Django version.
* ``sqlalchemy``: If you want to pin a compatible SQLAlchemy version.


The following ``extra``'s relate to the development of this library:

- ``linting``: The linting and code style tools.
- ``testing``: Packages for running the tests.
- ``docs``: For building the project documentation.


You can install ``extra``'s by adding them between square brackets during
installation:

.. code-block:: bash

    pip install odata-query[sqlalchemy]


Quickstart
----------

The most common use case is probably parsing an OData query string, and applying
it to a query your ORM understands. For this purpose there is an all-in-one function:
``apply_odata_query``.

Example for Django:

.. code-block:: python

    from odata_query.django import apply_odata_query

    orm_query = MyModel.objects  # This can be a Manager or a QuerySet.
    odata_query = "name eq 'test'"  # This will usually come from a query string parameter.

    query = apply_odata_query(orm_query, odata_query)
    results = query.all()


Example for SQLAlchemy ORM:

.. code-block:: python

    from odata_query.sqlalchemy import apply_odata_query

    orm_query = select(MyModel)  # This is any form of Query or Selectable.
    odata_query = "name eq 'test'"  # This will usually come from a query string parameter.

    query = apply_odata_query(orm_query, odata_query)
    results = session.execute(query).scalars().all()

Example for SQLAlchemy Core:

.. code-block:: python

    from odata_query.sqlalchemy import apply_odata_core

    core_query = select(MyTable)  # This is any form of Query or Selectable.
    odata_query = "name eq 'test'"  # This will usually come from a query string parameter.

    query = apply_odata_core(core_query, odata_query)
    results = session.execute(query).scalars().all()

.. splitinclude-1

Advanced Usage
--------------

Not all use cases are as simple as that. Luckily, ``odata-query`` is modular
and extendable. See the `documentation`_ for advanced usage or extending the
library for other cases.

.. splitinclude-2

Contact
-------

Got any questions or ideas? We'd love to hear from you. Check out our
`contributing guidelines`_ for ways to offer feedback and
contribute.


License
-------

Copyright © `Gorillini NV`_.
All rights reserved.

Licensed under the MIT License.


.. _odata v4: https://www.odata.org/
.. _django queries: https://docs.djangoproject.com/en/3.2/topics/db/queries/
.. _sqlalchemy queries: https://docs.sqlalchemy.org/en/14/orm/loading_objects.html
.. _documentation: https://odata-query.readthedocs.io/en/latest
.. _Gorillini NV: https://gorilla.co/
.. _contributing guidelines: ./CONTRIBUTING.rst

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "odata-query",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "OData,Query,Parser",
    "author": "Oliver Hofkens",
    "author_email": "oliver@gorilla.co",
    "download_url": "https://files.pythonhosted.org/packages/d6/42/f7244ba6d3e56a405a8acbacce902554689d22117c0be0b511a87e891f26/odata_query-0.9.1.tar.gz",
    "platform": null,
    "description": "OData-Query\n===========\n\n.. image:: https://sonarcloud.io/api/project_badges/measure?project=gorillaco_odata-query&metric=alert_status&token=cb35257e036d950788a0f628af7062929318482b\n    :alt: Quality Gate Status\n    :target: https://sonarcloud.io/dashboard?id=gorillaco_odata-query\n\n.. image:: https://sonarcloud.io/api/project_badges/measure?project=gorillaco_odata-query&metric=coverage&token=cb35257e036d950788a0f628af7062929318482b\n    :alt: Coverage\n    :target: https://sonarcloud.io/dashboard?id=gorillaco_odata-query\n\n.. image:: https://readthedocs.org/projects/odata-query/badge/?version=latest\n    :alt: Documentation Status\n    :target: https://odata-query.readthedocs.io/en/latest/?badge=latest\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :alt: Code style: black\n    :target: https://github.com/psf/black\n\n\n``odata-query`` is a library that parses `OData v4`_ filter strings, and can\nconvert them to other forms such as `Django Queries`_, `SQLAlchemy Queries`_,\nor just plain SQL.\n\n\nInstallation\n------------\n\n``odata-query`` is available on pypi, so can be installed with the package manager\nof your choice:\n\n.. code-block:: bash\n\n    pip install odata-query\n    # OR\n    poetry add odata-query\n    # OR\n    pipenv install odata-query\n\n\nThe package defines the following optional ``extra``'s:\n\n* ``django``: If you want to pin a compatible Django version.\n* ``sqlalchemy``: If you want to pin a compatible SQLAlchemy version.\n\n\nThe following ``extra``'s relate to the development of this library:\n\n- ``linting``: The linting and code style tools.\n- ``testing``: Packages for running the tests.\n- ``docs``: For building the project documentation.\n\n\nYou can install ``extra``'s by adding them between square brackets during\ninstallation:\n\n.. code-block:: bash\n\n    pip install odata-query[sqlalchemy]\n\n\nQuickstart\n----------\n\nThe most common use case is probably parsing an OData query string, and applying\nit to a query your ORM understands. For this purpose there is an all-in-one function:\n``apply_odata_query``.\n\nExample for Django:\n\n.. code-block:: python\n\n    from odata_query.django import apply_odata_query\n\n    orm_query = MyModel.objects  # This can be a Manager or a QuerySet.\n    odata_query = \"name eq 'test'\"  # This will usually come from a query string parameter.\n\n    query = apply_odata_query(orm_query, odata_query)\n    results = query.all()\n\n\nExample for SQLAlchemy ORM:\n\n.. code-block:: python\n\n    from odata_query.sqlalchemy import apply_odata_query\n\n    orm_query = select(MyModel)  # This is any form of Query or Selectable.\n    odata_query = \"name eq 'test'\"  # This will usually come from a query string parameter.\n\n    query = apply_odata_query(orm_query, odata_query)\n    results = session.execute(query).scalars().all()\n\nExample for SQLAlchemy Core:\n\n.. code-block:: python\n\n    from odata_query.sqlalchemy import apply_odata_core\n\n    core_query = select(MyTable)  # This is any form of Query or Selectable.\n    odata_query = \"name eq 'test'\"  # This will usually come from a query string parameter.\n\n    query = apply_odata_core(core_query, odata_query)\n    results = session.execute(query).scalars().all()\n\n.. splitinclude-1\n\nAdvanced Usage\n--------------\n\nNot all use cases are as simple as that. Luckily, ``odata-query`` is modular\nand extendable. See the `documentation`_ for advanced usage or extending the\nlibrary for other cases.\n\n.. splitinclude-2\n\nContact\n-------\n\nGot any questions or ideas? We'd love to hear from you. Check out our\n`contributing guidelines`_ for ways to offer feedback and\ncontribute.\n\n\nLicense\n-------\n\nCopyright \u00a9 `Gorillini NV`_.\nAll rights reserved.\n\nLicensed under the MIT License.\n\n\n.. _odata v4: https://www.odata.org/\n.. _django queries: https://docs.djangoproject.com/en/3.2/topics/db/queries/\n.. _sqlalchemy queries: https://docs.sqlalchemy.org/en/14/orm/loading_objects.html\n.. _documentation: https://odata-query.readthedocs.io/en/latest\n.. _Gorillini NV: https://gorilla.co/\n.. _contributing guidelines: ./CONTRIBUTING.rst\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An OData query parser and transpiler.",
    "version": "0.9.1",
    "project_urls": null,
    "split_keywords": [
        "odata",
        "query",
        "parser"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a094f530982bb3ca4f9ddcc9e054ebfc39d7e667a851acb5819028f1adc1420",
                "md5": "cda79836032f1795a08dbb713389bafc",
                "sha256": "1ef7f45d6bb892e45cd48d0f9d02a7199b95f22ffce2003617399c6b0d044a23"
            },
            "downloads": -1,
            "filename": "odata_query-0.9.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cda79836032f1795a08dbb713389bafc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 34176,
            "upload_time": "2023-11-15T07:24:16",
            "upload_time_iso_8601": "2023-11-15T07:24:16.909437Z",
            "url": "https://files.pythonhosted.org/packages/3a/09/4f530982bb3ca4f9ddcc9e054ebfc39d7e667a851acb5819028f1adc1420/odata_query-0.9.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d642f7244ba6d3e56a405a8acbacce902554689d22117c0be0b511a87e891f26",
                "md5": "c1fa9d01c6f8e7758af25b5e1b07cbe4",
                "sha256": "c47bdba226ee9e3560acf12529a255b79a0163ceb49440ca8d74234c524a5b1f"
            },
            "downloads": -1,
            "filename": "odata_query-0.9.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c1fa9d01c6f8e7758af25b5e1b07cbe4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 27285,
            "upload_time": "2023-11-15T07:24:18",
            "upload_time_iso_8601": "2023-11-15T07:24:18.721205Z",
            "url": "https://files.pythonhosted.org/packages/d6/42/f7244ba6d3e56a405a8acbacce902554689d22117c0be0b511a87e891f26/odata_query-0.9.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-15 07:24:18",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "odata-query"
}
        
Elapsed time: 0.20531s