Skip to content

Consider supporting method chaining to simplify query creation \ data selection \ data reading (OData Functions). #115

@ktvanzwol

Description

@ktvanzwol

In the python data science ecosystem method chaining is a common way of simplifying query creation and data manipulations.

  1. Polars Expressions and Contexts
  2. Pandas has similar options

I came across a recent odata python client, odata-bc, that implemented method chaining for complex queries that resulted in very readable code:

from odata import OData, Q
from datetime import date

client = OData("http://localhost:42001/api/data-store/v1/odata")

test_results = (
    client("TestResults")
        .filter((Q("StartDateTime") >= date(2026, 1, 1)) & (Q("StartDateTime") <= date(2026, 12, 31)))
        .select("Name","StartDateTime" ,"EndDateTime" ,"Outcome", "OperatorId", "TestStationId", "Id")
        .orderby("StartDateTime")
        .fetch()
)

test_results.head()

This is just intended as illustration of the concept, the odata-bc library has its limitations with no public repository or documentations.

AB#3752518

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions