def add_processed_data_list(data, sess):
    try:
        sess.bulk_save_objects([DetachedAwardProcurement(**fpds_data) for fpds_data in data])
        sess.commit()
    except IntegrityError:
        sess.rollback()
        logger.error('Attempted to insert duplicate FPDS data. Inserting each row in batch individually.')
        for fpds_obj in data:
            insert_statement = insert(DetachedAwardProcurement).values(**fpds_obj).on_conflict_do_update(index_elements=['detached_award_proc_unique'], set_=fpds_obj)
            sess.execute(insert_statement)
        sess.commit()
def add_processed_data_list(data, sess):
    try:
        sess.bulk_save_objects([DetachedAwardProcurement(**fpds_data) for fpds_data in data])
        sess.commit()
    except IntegrityError:
        sess.rollback()
        logger.error('Attempted to insert duplicate FPDS data. Inserting each row in batch individually.')
        for fpds_obj in data:
            insert_statement = insert(DetachedAwardProcurement).values(**fpds_obj).on_conflict_do_update(index_elements=['detached_award_proc_unique'], set_=fpds_obj)
            sess.execute(insert_statement)
        sess.commit()