def _delete_current_allocs(conn, allocs):
 for alloc in allocs:
  rp_id = alloc.resource_provider.id
  consumer_id = alloc.consumer_id
  del_sql = _ALLOC_TBL.delete().where(sa.and_((_ALLOC_TBL.c.resource_provider_id == rp_id), (_ALLOC_TBL.c.consumer_id == consumer_id)))
  conn.execute(del_sql)

def _delete_current_allocs ( conn , allocs ) : for alloc in allocs : rp_id = alloc . resource_provider . id consumer_id = alloc . consumer_id del_sql = _ALLOC_TBL . delete ( ) . where ( sa . and_ ( ( _ALLOC_TBL . c . resource_provider_id == rp_id ) , ( _ALLOC_TBL . c . consumer_id == consumer_id ) ) ) conn . execute ( del_sql )
deletes any existing allocations that correspond to the allocations to be written .