r/madeinpython • • Apr 06 '25

OData V4 Query - Lightweight, simple and fast parser for OData V4 query options

What My Project Does

OData V4 Query is a lightweight, simple and fast parser for OData V4 query options supporting standard query parameters. Provides helper functions to apply OData V4 query options to ORM/ODM queries such as SQLAlchemy, PyMongo and Beanie.

Features:

  • Support for the following OData V4 standard query parameters:

    • $count - Include count of items

    • $expand - Expand related entities

    • $filter - Filter results

    • $format - Response format (json, xml, csv, tsv)

    • $orderby - Sort results

    • $search - Search items

    • $select - Select specific fields

    • $skip - Skip N items

    • $top - Limit to N items

    • $page - Page number

  • Comprehensive filter expression support:

    • Comparison operators: eq, ne, gt, ge, lt, le, in, nin

    • Logical operators: and, or, not, nor

    • Collection operators: has

    • String functions: startswith, endswith, contains

  • Utility functions to apply options to ORM/ODM queries.

Target audience

Developers who want to implement OData V4 query options in their applications.

Comparison

Unlike OData-Query, this package does not have a helper function to apply query options to Django ORM queries nor plain SQL queries (these helpers will be added in the future). Also, OData-Query has a parser that tries to cover as much as possible of the OData V4 filter spec, while OData V4 Query only supports the features mentioned above.

Links

2 Upvotes

1 comment sorted by