#NEWLINE# def _collect_delete_commands( base_mapper , uowtransaction , table , states_to_delete ) : #NEWLINE# #INDENT# 'Identify values to use in DELETE statements for a list of\n    states to be deleted.' #NEWLINE# delete = util . defaultdict ( list ) #NEWLINE# for ( state , state_dict , mapper , has_identity , connection ) in states_to_delete : #NEWLINE# #INDENT# if ( ( not has_identity ) or ( table not in mapper . _pks_by_table ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# params = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# delete [ connection ] . append ( params ) #NEWLINE# for col in mapper . _pks_by_table [ table ] : #NEWLINE# #INDENT# params [ col . key ] = value = mapper . _get_committed_state_attr_by_column ( state , state_dict , col ) #NEWLINE# if ( value is None ) : #NEWLINE# #INDENT# raise orm_exc . FlushError ( "Can't delete from table using NULL for primary key value" ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ( mapper . version_id_col is not None ) and table . c . contains_column ( mapper . version_id_col ) ) : #NEWLINE# #INDENT# params [ mapper . version_id_col . key ] = mapper . _get_committed_state_attr_by_column ( state , state_dict , mapper . version_id_col ) #NEWLINE# #UNINDENT# #UNINDENT# return delete