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:
- Extend the QueryNode and the compiler in ryx-query to support the OVER (...) clause.
- Implement a Window expression class in Python that integrates with the existing annotation system. Label: advanced
To support complex analytics, Ryx needs to support SQL Window Functions.
Goal: Allow the use of
RANK(),DENSE_RANK(),ROW_NUMBER(), andLEAD/LAGwithinannotate().Example usage:
Implementation hint: