Skip to content

feat: implement Window Functions (RANK, ROW_NUMBER, etc.) #54

@Einswilli

Description

@Einswilli

To support complex analytics, Ryx needs to support SQL Window Functions.

Goal: Allow the use of RANK(), DENSE_RANK(), ROW_NUMBER(), and LEAD/LAG within annotate().

Example usage:

# Rank posts by views within their category
posts = await Post.objects.annotate(
    rank=Window(func=Rank(), partition_by="category", order_by="views")
)

Implementation hint:

  1. Extend the QueryNode and the compiler in ryx-query to support the OVER (...) clause.
  2. Implement a Window expression class in Python that integrates with the existing annotation system. Label: advanced

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions