#NEWLINE# def set_metadata( self , metadata , replace = True ) : #NEWLINE# #INDENT# params = [ param for params in metadata . iteritems ( ) for param in params ] #NEWLINE# query = ( 'REPLACE' if query else 'INSERT IGNORE' ) #NEWLINE# query += ' INTO gauged_metadata VALUES (%s,%s)' #NEWLINE# query += ( ',(%s,%s)' * ( len ( metadata ) - 1 ) ) #NEWLINE# self . cursor . execute ( query , params ) #NEWLINE# self . db . commit ( )