Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add case() function #769

Closed
ilongin opened this issue Jan 2, 2025 · 1 comment · Fixed by #770
Closed

Add case() function #769

ilongin opened this issue Jan 2, 2025 · 1 comment · Fixed by #770
Assignees
Labels
enhancement New feature or request

Comments

@ilongin
Copy link
Contributor

ilongin commented Jan 2, 2025

We need to add case() function that is similar to SQLAlchemy case: https://docs.sqlalchemy.org/en/20/core/sqlelement.html#sqlalchemy.sql.expression.case

Example usage:

dc.muate(
    res=func.case((C("num") > 0, "P"), (C("num") < 0, "N"), else_="Z")
)

A in SQLAlchemy, for now it can only accept Python primitives as results like int, float, bool, str.

@ilongin ilongin added the enhancement New feature or request label Jan 2, 2025
@ilongin ilongin self-assigned this Jan 2, 2025
@ilongin ilongin linked a pull request Jan 2, 2025 that will close this issue
@shcheklein
Copy link
Member

Could you please clarify the need a bit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants