#NEWLINE# def insert_keys( self , keys ) : #NEWLINE# #INDENT# 'Insert keys into a table which assigns an ID' #NEWLINE# start = 0 #NEWLINE# bulk_insert = self . bulk_insert #NEWLINE# keys_len = len ( keys ) #NEWLINE# query = 'INSERT IGNORE INTO gauged_keys (namespace, `key`) VALUES ' #NEWLINE# execute = self . cursor . execute #NEWLINE# while ( start < bulk_insert ) : #NEWLINE# #INDENT# rows = keys [ start : ( start + bulk_insert ) ] #NEWLINE# params = [ param for params in rows for param in params ] #NEWLINE# insert = ( ( '(%s,%s),' * ( len ( rows ) - 1 ) ) + '(%s,%s)' ) #NEWLINE# execute ( ( query + insert ) , params ) #NEWLINE# start += bulk_insert