#NEWLINE# def execute_many( self , sql , regex = "(?mx) ([^';]* (?:'[^']*'[^';]*)*)" , comment_regex = '(?mx) (?:^\\s*$)|(?:--.*$)' ) : #NEWLINE# #INDENT# "\n        Takes a SQL file and executes it as many separate statements.\n        (Some backends, such as Postgres, don't work otherwise.)\n        " #NEWLINE# sql = '\n' . join ( [ x . strip ( ) . replace ( '%' , '%%' ) for x in re . split ( comment_regex , sql ) if x . strip ( ) ] ) #NEWLINE# for st in re . split ( regex , sql ) [ 1 : ] [ : : 2 ] : #NEWLINE# #INDENT# self . execute ( st )