def __init__(self, config, db_name, log_root_path): """ :type config: dict :param config: the DB configuration file :type db_name: str :param config: name of an existing DB :type log_root_path: str :param log_root_path: the log path """ self._db_util = DbUtil() self._dsl_util = DslUtil() self._logging_util = LoggingUtil() self._log_path = log_root_path + "export-graph-" + db_name + ".log" self._logger = self._logging_util.get_logger(self._log_path) self._fileHandler = self._logging_util.get_file_handler( self._logger, self._log_path, "info") self._db_name = db_name self._config = config self._cnx = self._db_util.get_connection(self._config) self._db_util.set_database(self._cnx, self._db_name) self._db_util.set_settings(self._cnx)
def __init__(self, db_name, config, log_root_path): """ :type db_name: str :param db_name: the name of the DB to initialize/connect to, it cannot be null and must follow the format allowed in MySQL (http://dev.mysql.com/doc/refman/5.7/en/identifiers.html). If a DB having a name equal already exists in Gitana, the existing DB will be dropped and a new one will be created :type config: dict :param config: the DB configuration file :type log_root_path: str :param log_root_path: the log path """ self._db_name = db_name self._config = config self._log_root_path = log_root_path self._db_util = DbUtil() self._logging_util = LoggingUtil() log_path = self._log_root_path + "db-schema-" + db_name self._logger = self._logging_util.get_logger(log_path) self._fileHandler = self._logging_util.get_file_handler( self._logger, log_path, "info") self._cnx = self._db_util.get_connection(self._config)
def __init__(self, config, project_name, repo_name, repo_path, logger): """ :type config: dict :param config: the DB configuration file :type project_name: str :param project_name: the name of an existing project in the DB :param repo_name: repo name :type repo_name: str :param repo_path: git repo path :type repo_name: str :type logger: logger object to log messages :param logger: logging.Logger """ try: self._config = config self._project_name = project_name self._repo_name = repo_name self._logger = logger self._db_util = DbUtil() self._cnx = self._db_util.get_connection(self._config) self._git_dao = GitDao(config, logger) self._git_querier = GitQuerier(repo_path, logger) except: self._logger.error("DB connection failure") raise
def __init__(self, db_name, config, log_root_path): """ :type db_name: str :param config: name of an existing DB :type config: dict :param config: the DB configuration file :type log_root_path: str :param log_root_path: the log path """ self._dsl_util = DslUtil() self._date_util = DateUtil() self._db_util = DbUtil() self._logging_util = LoggingUtil() self._log_path = log_root_path + "export-activity-report-" + db_name self._logger = self._logging_util.get_logger(self._log_path) self._fileHandler = self._logging_util.get_file_handler( self._logger, self._log_path, "info") self._db_name = db_name self._config = config self._cnx = self._db_util.get_connection(self._config) self._db_util.set_database(self._cnx, self._db_name) self._db_util.set_settings(self._cnx) self._chart_generator = ChartGenerator(self._cnx, self._logger) self._html_generator = HtmlGenerator(self._logger)
def __init__(self, config, logger): """ :type config: dict :param config: the DB configuration file :type logger: Object :param logger: logger """ try: self._config = config self._logger = logger self._db_util = DbUtil() self._cnx = self._db_util.get_connection(self._config) except: self._logger.error("GitDao init failed") raise
def __init__(self, db_name, project_name, repo_name, github_repo_full_name, tokens, config, log_root_path): """ :type db_name: str :param db_name: the name of an existing DB :type project_name: str :param project_name: the name of an existing project in the DB :type repo_name: str :param repo_name: the name of an existing repository in the DB :type url: str :param url: full name of the GitHub repository :type tokens: list str :param token: list of GitHub tokens :type config: dict :param config: the DB configuration file :type log_root_path: str :param log_root_path: the log path """ self._log_path = log_root_path + "map-vcs-github-users-" + db_name + "-" + project_name + "-" + repo_name self._project_name = project_name self._db_name = db_name self._repo_name = repo_name self._tokens = tokens self._active_token = 0 self._url = github_repo_full_name config.update({'database': db_name}) self._config = config self._logging_util = LoggingUtil() self._logger = self._logging_util.get_logger(self._log_path) self._db_util = DbUtil() self._cnx = self._db_util.get_connection(self._config) self._git_dao = GitDao(self._config, self._logger) self._github_querier = GitHubQuerier(self._url, self._tokens[self._active_token], self._logger)
def __init__(self): self.db_util = DbUtil()
def test(): dbUtil = DbUtil() sql = "SELECT * FROM abitree.tbl_test" res = dbUtil.exeQuery(sql, None) print(res) return "hello12"