Ryx currently supports CASE WHEN internally for bulk updates, but it is not exposed as a high-level API for annotate().
Goal: Implement a Case and When API allowing users to create conditional columns in their result sets.
Example usage:
posts = await Post.objects.annotate(
status=Case(
When(views__gt=1000, then=Value("viral")),
When(views__gt=100, then=Value("popular")),
default=Value("normal")
)
)
Implementation hint:
- Create Case, When, and Value classes in ryx/queryset.py.
- Update the Rust compiler in ryx-query to handle these new AST nodes and generate the corresponding CASE WHEN ... THEN ... ELSE ... END SQL. Label: advanced
Ryx currently supports
CASE WHENinternally for bulk updates, but it is not exposed as a high-level API forannotate().Goal: Implement a
CaseandWhenAPI allowing users to create conditional columns in their result sets.Example usage:
Implementation hint: