def run(self, data): sqlFile = FileUtil.getDataFile(self.sqlFile) DeleteDatabaseCommand(host=self.dbHost, user=self.dbUser, password=self.dbPassword, database=self.dbName).execute() CreateDatabaseCommand(host=self.dbHost, user=self.dbUser, password=self.dbPassword, database=self.dbName).execute() ImportDatabaseCommand(host=self.dbHost, user=self.dbUser, password=self.dbPassword, database=self.dbName, sqlFile=sqlFile).execute() self.requestCommandBuilder.build(CreateOpalDatabaseCommand, dbName=self.dbName, dbHost=self.dbHost, dbUrl=self.dbUrl, dbDriver=self.dbDriver, dbUser=self.dbUser, dbPassword=self.dbPassword).execute() extensionFactory = ImportDataCommand.createLimeSurveyExtensionFactory(database=self.dbName, prefix=self.prefix) self.requestCommandBuilder.build(ImportDataCommand, dsName=self.dsName, tables=self.tables, incremental=None, unit=None, extensionFactory=extensionFactory).execute()
def execute(self): file = OpalFile(self.opalPath) self.opalRequest.content_upload(FileUtil.getDataFile(self.localFile)).accept('text/html').content_type( 'multipart/form-data').post().resource(file.get_ws()) return self.opalRequest.send()