def runSql(self, migrationName, version):
sys.stdout.write("<STR_LIT>"%(migrationName, version))<EOL>sqlPath = os.path.join(self.migrationDirectory, migrationName)<EOL>sql = open(sqlPath, "<STR_LIT:r>").read()<EOL>try:<EOL><INDENT>if self.session.is_active:<EOL><INDENT>print("<STR_LIT>")<EOL>self.session.commit()<EOL><DEDENT>self.session.begin()<EOL>executeBatch(self.session, sql)<EOL>self.session.add(models.Migration(version, migrationName))<EOL><DEDENT>except:<EOL><INDENT>print("<STR_LIT:\n>")<EOL>self.session.rollback()<EOL>raise<EOL><DEDENT>else:<EOL><INDENT>self.session.commit()<EOL><DEDENT>sys.stdout.write("<STR_LIT:\r>")<EOL>sys.stdout.flush()<EOL>sys.stdout.write("<STR_LIT>"%(migrationName, version))<EOL>
Given a migration name and version lookup the sql file and run it.