'Takes a SQL file and executes it as many separate statements.
(Some backends, such as Postgres, don\'t work otherwise.)'

def execute_many(self, sql, regex="(?mx)    ([^';]*    (?:'[^']*'[^';]*)*)", comment_regex='(?mx)    (?:^\\s*$)|(?:--.*$)'):

    sql = '\n'.join([x.strip().replace('%', '%%') for x in re.split(comment_regex, sql) if x.strip()])
    for st in re.split(regex, sql)[1:][::2]:
        self.execute(st)
