bid_rows=session.execute('SELECT bids.bid_id FROM bids WHERE bids.offer_id = :offer_id',{'offer_id':offer_row[0]})
forbid_rowinbid_rows:
num_bids+=1
session.execute('DELETE FROM transactions WHERE transactions.bid_id = :bid_id',{'bid_id':bid_row[0]})
session.execute('DELETE FROM eventlog WHERE eventlog.linked_type = :type_ind AND eventlog.linked_id = :bid_id',{'type_ind':int(Concepts.BID),'bid_id':bid_row[0]})
session.execute('DELETE FROM automationlinks WHERE automationlinks.linked_type = :type_ind AND automationlinks.linked_id = :bid_id',{'type_ind':int(Concepts.BID),'bid_id':bid_row[0]})
session.execute('DELETE FROM prefunded_transactions WHERE prefunded_transactions.linked_type = :type_ind AND prefunded_transactions.linked_id = :bid_id',{'type_ind':int(Concepts.BID),'bid_id':bid_row[0]})
session.execute('DELETE FROM history WHERE history.concept_type = :type_ind AND history.concept_id = :bid_id',{'type_ind':int(Concepts.BID),'bid_id':bid_row[0]})
session.execute('DELETE FROM xmr_swaps WHERE xmr_swaps.bid_id = :bid_id',{'bid_id':bid_row[0]})
session.execute('DELETE FROM actions WHERE actions.linked_id = :bid_id',{'bid_id':bid_row[0]})
session.execute('DELETE FROM addresspool WHERE addresspool.bid_id = :bid_id',{'bid_id':bid_row[0]})
session.execute('DELETE FROM xmr_split_data WHERE xmr_split_data.bid_id = :bid_id',{'bid_id':bid_row[0]})
session.execute('DELETE FROM bids WHERE bids.bid_id = :bid_id',{'bid_id':bid_row[0]})
session.execute('DELETE FROM message_links WHERE linked_type = :type_ind AND linked_id = :linked_id',{'type_ind':int(Concepts.BID),'linked_id':bid_row[0]})
session.execute('DELETE FROM eventlog WHERE eventlog.linked_type = :type_ind AND eventlog.linked_id = :offer_id',{'type_ind':int(Concepts.OFFER),'offer_id':offer_row[0]})
session.execute('DELETE FROM automationlinks WHERE automationlinks.linked_type = :type_ind AND automationlinks.linked_id = :offer_id',{'type_ind':int(Concepts.OFFER),'offer_id':offer_row[0]})
session.execute('DELETE FROM prefunded_transactions WHERE prefunded_transactions.linked_type = :type_ind AND prefunded_transactions.linked_id = :offer_id',{'type_ind':int(Concepts.OFFER),'offer_id':offer_row[0]})
session.execute('DELETE FROM history WHERE history.concept_type = :type_ind AND history.concept_id = :offer_id',{'type_ind':int(Concepts.OFFER),'offer_id':offer_row[0]})
session.execute('DELETE FROM xmr_offers WHERE xmr_offers.offer_id = :offer_id',{'offer_id':offer_row[0]})
session.execute('DELETE FROM sentoffers WHERE sentoffers.offer_id = :offer_id',{'offer_id':offer_row[0]})
session.execute('DELETE FROM actions WHERE actions.linked_id = :offer_id',{'offer_id':offer_row[0]})
session.execute('DELETE FROM offers WHERE offers.offer_id = :offer_id',{'offer_id':offer_row[0]})
session.execute('DELETE FROM message_links WHERE linked_type = :type_ind AND linked_id = :linked_id',{'type_ind':int(Concepts.OFFER),'offer_id':offer_row[0]})