Skip to content

Commit

Permalink
fix(sql): case_when sqla v1.3 backwards compat
Browse files Browse the repository at this point in the history
  • Loading branch information
machow committed Oct 5, 2022
1 parent b11d6a5 commit 9e87fb1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion siuba/sql/verbs/conditional.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ def _case_when(__data, cases):
# handle when expressions
#if ii+1 == n_items and expr is True:
# else_val = val
if callable(expr):
if expr is True:
# note: only sqlalchemy v1.3 requires wrapping in literal
whens.append((sql.literal(expr), val))
elif callable(expr):
whens.append((expr(__data), val))
else:
whens.append((expr, val))
Expand Down

0 comments on commit 9e87fb1

Please sign in to comment.