#NEWLINE# def _bulk_update( mapper , mappings , session_transaction , isstates , update_changed_only ) : #NEWLINE# #INDENT# base_mapper = mapper . base_mapper #NEWLINE# cached_connections = _cached_connection_dict ( base_mapper ) #NEWLINE# def _changed_dict( mapper , state ) : #NEWLINE# #INDENT# return dict ( ( ( k , v ) for ( k , v ) in state . dict . items ( ) if ( ( k in state . committed_state ) or ( k in mapper . _primary_key_propkeys ) ) ) ) #NEWLINE# #UNINDENT# if isstates : #NEWLINE# #INDENT# if update_changed_only : #NEWLINE# #INDENT# mappings = [ _changed_dict ( mapper , state ) for state in mappings ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# mappings = [ state . dict for state in mappings ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# mappings = list ( mappings ) #NEWLINE# #UNINDENT# if session_transaction . session . connection_callable : #NEWLINE# #INDENT# raise NotImplementedError ( 'connection_callable / per-instance sharding not supported in bulk_update()' ) #NEWLINE# #UNINDENT# connection = session_transaction . connection ( base_mapper ) #NEWLINE# for ( table , super_mapper ) in base_mapper . _sorted_tables . items ( ) : #NEWLINE# #INDENT# if ( not mapper . isa ( super_mapper ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# records = _collect_update_commands ( None , table , ( ( None , mapping , mapper , connection , ( mapping [ mapper . _version_id_prop . key ] if mapper . _version_id_prop else None ) ) for mapping in mappings ) , bulk = True ) #NEWLINE# _emit_update_statements ( base_mapper , None , cached_connections , super_mapper , table , records , bookkeeping = False )