Comment 2 for bug 1928083

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.opendev.org/c/openstack/cinder/+/790796
Committed: https://opendev.org/openstack/cinder/commit/55046123f4326ae3caf1c241323f30e4882c57cb
Submitter: "Zuul (22348)"
Branch: master

commit 55046123f4326ae3caf1c241323f30e4882c57cb
Author: Gorka Eguileor <email address hidden>
Date: Tue May 11 17:08:30 2021 +0200

    SQLA 1.4: Fix conditional update Case

    There have been changes in the `case` element in SQLAlchemy 1.4 that
    break our conditional updates.

    Previously SQLA's `case` accepted 3 parameters: whens, value, and else_,
    in that order, and we were passing them as positional arguments.

    New SQLA has changed, and now the signature is:

        def __init__(self, *whens, **kw):

    So we can no longer pass them as positional arguments.

    The solution proposed by this patch relies on passing whens as a keyword
    argument, which is deprecated in 1.4, because that's the compatible way
    between the current SQLA version and 1.4.

    Once the minimum version is bumped to 1.4 we can change our code to pass
    - value = case(whens=value.whens,
    + value = case(*value.whens,

    Closes-Bug: #1928083
    Change-Id: Ia5c4d06affc5acd9a4783f217b6c5375afab50ed