def __init__(self, config, sgdb=None): Main._check_configuration(config) self.cli = CLI() self.config = config self.log = LOG(self.config.get("log_dir", None)) self.sgdb = sgdb if self.sgdb is None and not self.config.get("new_migration", None): if self.config.get("database_engine") == 'mysql': from mysql import MySQL self.sgdb = MySQL(config) elif self.config.get("database_engine") == 'oracle': from oracle import Oracle self.sgdb = Oracle(config) elif self.config.get("database_engine") == 'mssql': from mssql import MSSQL self.sgdb = MSSQL(config) elif self.config.get("database_engine") == 'postgresql': from postgresql import PostgreSQL self.sgdb = PostgreSQL(config) else: raise Exception("engine not supported '%s'" % self.config.get("database_engine")) self.db_migrate = SimpleDBMigrate(self.config)
def __init__(self, config=None, sgdb=None, db_migrate=None, execution_log=None): self.cli = CLI() self.config = config or {} self.log = LOG(self.config.get("log_dir", None)) self.sgdb = sgdb if self.sgdb is None and not self.config.get("new_migration", None): if self.config.get("db_engine") is 'mysql': from mysql import MySQL self.sgdb = MySQL(config) elif self.config.get("db_engine") is 'oracle': from oracle import Oracle self.sgdb = Oracle(config) self.db_migrate = db_migrate or SimpleDBMigrate(config) if execution_log: self.execution_log = execution_log