diff options
| author | Federico Caselli <cfederico87@gmail.com> | 2023-02-24 21:32:46 +0100 |
|---|---|---|
| committer | Federico Caselli <cfederico87@gmail.com> | 2023-02-24 21:33:47 +0100 |
| commit | 16d3dad4490fc4915096b7963f21e6b591b15ba7 (patch) | |
| tree | 862b2f69df4b45ef427435e96c35a2012c05ff93 /examples/nested_sets | |
| parent | 8b108297d075ae68178cd18a9cb4d06feee7e075 (diff) | |
| download | sqlalchemy-16d3dad4490fc4915096b7963f21e6b591b15ba7.tar.gz | |
update case statement to v2 syntax
Change-Id: If278ea170e0a17b1e8ace2d470fb2fbdb7a6e9c1
References: #9370
References: #9365
Diffstat (limited to 'examples/nested_sets')
| -rw-r--r-- | examples/nested_sets/nested_sets.py | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/examples/nested_sets/nested_sets.py b/examples/nested_sets/nested_sets.py index 0450551f3..2412eaf9e 100644 --- a/examples/nested_sets/nested_sets.py +++ b/examples/nested_sets/nested_sets.py @@ -54,21 +54,17 @@ def before_insert(mapper, connection, instance): connection.execute( personnel.update(personnel.c.rgt >= right_most_sibling).values( lft=case( - [ - ( - personnel.c.lft > right_most_sibling, - personnel.c.lft + 2, - ) - ], + ( + personnel.c.lft > right_most_sibling, + personnel.c.lft + 2, + ), else_=personnel.c.lft, ), rgt=case( - [ - ( - personnel.c.rgt >= right_most_sibling, - personnel.c.rgt + 2, - ) - ], + ( + personnel.c.rgt >= right_most_sibling, + personnel.c.rgt + 2, + ), else_=personnel.c.rgt, ), ) |
