Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- loans = ses.query(Loan).filter(Loan.id.in_([1, 2])).all()
- loans[0].pledge_amount = Decimal('13')
- s1 = ses.begin_nested()
- loans[0].body_amount = Decimal('14')
- s1.commit()
- s2 = ses.begin_nested()
- loans[1].pledge_amount = Decimal('11')
- ses.rollback()
- ses.commit()
- ses.close()
- loans = ses.query(Loan).filter(Loan.id.in_([1, 2]))
- for l in loans.all():
- print(l.id, l.body_amount, l.pledge_amount)
- 1 6 2
- 2 14 13
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement