Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. loans = ses.query(Loan).filter(Loan.id.in_([1, 2])).all()
  2. loans[0].pledge_amount = Decimal('13')
  3. s1 = ses.begin_nested()
  4. loans[0].body_amount = Decimal('14')
  5. s1.commit()
  6. s2 = ses.begin_nested()
  7. loans[1].pledge_amount = Decimal('11')
  8. ses.rollback()
  9. ses.commit()
  10. ses.close()
  11.  
  12. loans = ses.query(Loan).filter(Loan.id.in_([1, 2]))
  13. for l in loans.all():
  14. print(l.id, l.body_amount, l.pledge_amount)
  15.  
  16. 1 6 2
  17. 2 14 13
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement