def process_and_add(data, contract_type, sess, sub_tier_list, county_by_name, county_by_code, state_code_list, country_list, exec_comp_dict, now, threaded=False):
    " Start the processing for data and add it to the DB.\n\n        Args:\n            data: an object containing the data gathered from the feed\n            contract_type: a string indicating whether the atom feed being checked is 'award' or 'IDV'\n            sess: the database connection\n            sub_tier_list: a dictionary containing all the sub tier agency information keyed by sub tier agency code\n            county_by_name: a dictionary containing all county codes, keyed by state and county name\n            county_by_code: a dictionary containing all county names, keyed by state and county code\n            state_code_list: a dictionary containing all state names, keyed by state code\n            country_list: a dictionary containing all country names, keyed by country code\n            exec_comp_dict: a dictionary containing all the data for Executive Compensation data keyed by DUNS number\n            now: a timestamp indicating the time to set the updated_at to\n            threaded: a boolean indicating whether the process is running as a thread or not\n    "
    if threaded:
        for value in data:
            tmp_obj = process_data(value['content'][contract_type], sess, atom_type=contract_type, sub_tier_list=sub_tier_list, county_by_name=county_by_name, county_by_code=county_by_code, state_code_list=state_code_list, country_list=country_list, exec_comp_dict=exec_comp_dict)
            tmp_obj['updated_at'] = now
            insert_statement = insert(DetachedAwardProcurement).values(**tmp_obj).on_conflict_do_update(index_elements=['detached_award_proc_unique'], set_=tmp_obj)
            sess.execute(insert_statement)
    else:
        for value in data:
            tmp_obj = process_data(value['content'][contract_type], sess, atom_type=contract_type, sub_tier_list=sub_tier_list, county_by_name=county_by_name, county_by_code=county_by_code, state_code_list=state_code_list, country_list=country_list, exec_comp_dict=exec_comp_dict)
            try:
                statement = insert(DetachedAwardProcurement).values(**tmp_obj)
                sess.execute(statement)
                sess.commit()
            except IntegrityError:
                sess.rollback()
                tmp_obj['updated_at'] = now
                sess.query(DetachedAwardProcurement).filter_by(detached_award_proc_unique=tmp_obj['detached_award_proc_unique']).update(tmp_obj, synchronize_session=False)
                sess.commit()
Start the processing for data and add it to the DB.

Args:
    data: an object containing the data gathered from the feed
    contract_type: a string indicating whether the atom feed being checked is 'award' or 'IDV'
    sess: the database connection
    sub_tier_list: a dictionary containing all the sub tier agency information keyed by sub tier agency code
    county_by_name: a dictionary containing all county codes, keyed by state and county name
    county_by_code: a dictionary containing all county names, keyed by state and county code
    state_code_list: a dictionary containing all state names, keyed by state code
    country_list: a dictionary containing all country names, keyed by country code
    exec_comp_dict: a dictionary containing all the data for Executive Compensation data keyed by DUNS number
    now: a timestamp indicating the time to set the updated_at to
    threaded: a boolean indicating whether the process is running as a thread or not
def process_and_add(data, contract_type, sess, sub_tier_list, county_by_name, county_by_code, state_code_list, country_list, exec_comp_dict, now, threaded=False):
    " Start the processing for data and add it to the DB.\n\n        Args:\n            data: an object containing the data gathered from the feed\n            contract_type: a string indicating whether the atom feed being checked is 'award' or 'IDV'\n            sess: the database connection\n            sub_tier_list: a dictionary containing all the sub tier agency information keyed by sub tier agency code\n            county_by_name: a dictionary containing all county codes, keyed by state and county name\n            county_by_code: a dictionary containing all county names, keyed by state and county code\n            state_code_list: a dictionary containing all state names, keyed by state code\n            country_list: a dictionary containing all country names, keyed by country code\n            exec_comp_dict: a dictionary containing all the data for Executive Compensation data keyed by DUNS number\n            now: a timestamp indicating the time to set the updated_at to\n            threaded: a boolean indicating whether the process is running as a thread or not\n    "
    if threaded:
        for value in data:
            tmp_obj = process_data(value['content'][contract_type], sess, atom_type=contract_type, sub_tier_list=sub_tier_list, county_by_name=county_by_name, county_by_code=county_by_code, state_code_list=state_code_list, country_list=country_list, exec_comp_dict=exec_comp_dict)
            tmp_obj['updated_at'] = now
            insert_statement = insert(DetachedAwardProcurement).values(**tmp_obj).on_conflict_do_update(index_elements=['detached_award_proc_unique'], set_=tmp_obj)
            sess.execute(insert_statement)
    else:
        for value in data:
            tmp_obj = process_data(value['content'][contract_type], sess, atom_type=contract_type, sub_tier_list=sub_tier_list, county_by_name=county_by_name, county_by_code=county_by_code, state_code_list=state_code_list, country_list=country_list, exec_comp_dict=exec_comp_dict)
            try:
                statement = insert(DetachedAwardProcurement).values(**tmp_obj)
                sess.execute(statement)
                sess.commit()
            except IntegrityError:
                sess.rollback()
                tmp_obj['updated_at'] = now
                sess.query(DetachedAwardProcurement).filter_by(detached_award_proc_unique=tmp_obj['detached_award_proc_unique']).update(tmp_obj, synchronize_session=False)
                sess.commit()