@Profiler.profile
def test_orm_flush(n):
 session = Session(bind=engine)
 for chunk in range(0, n, 1000):
  customers = session.query(Customer).filter(Customer.id.between(chunk, (chunk + 1000))).all()
  for customer in customers:
   customer.description += 'updated'
  session.flush()
 session.commit()

@ Profiler . profile def test_orm_flush ( n ) : session = Session ( bind = engine ) for chunk in range ( 0 , n , 1000 ) : customers = session . query ( Customer ) . filter ( Customer . id . between ( chunk , ( chunk + 1000 ) ) ) . all ( ) for customer in customers : customer . description += 'updated' session . flush ( ) session . commit ( )
update statements via the orm flush process .