Sqlalchemy Case Statement: Valueerror: Too Many Values To Unpack (expected 2)
Does anyone know why the following SqlAlchemy CASE statement fails with the following error message: casePrimaryApprover = case( [ (and_( (agreement.approvi
Solution 1:
I fixed it. Same issue as in SqlAlchemy Case with multiple conditions `and_` more than two values?
My second-last closing parenthesis had to be before the 'Y'.
casePrimaryApprover = case(
[
(and_(
(agreement.approving_official_id.is_not(None)),
(approver.current_flag == 'Y'),
(approver.inactive_date.is_(None)),
(approver.organizationalstat == 'EMPLOYEE'),
or_(
(participatingIc.ic_nihsac == func.substr(approver.nihsac, 1, 3)),
(externalPeoplePrimaryApprover.id.is_not(None))
)
), 'Y')
],
else_ = 'N'
)
Post a Comment for "Sqlalchemy Case Statement: Valueerror: Too Many Values To Unpack (expected 2)"