def __init__(self, db_params, table_name="assoc"): # def __init__(self, user='******', host='localhost', pw_='', db='derived', table_name="tmp_assoc"): # the connection to the database only has to occur once therefor, it can occur in the initialization self.host = db_params['host'] self.db = db_params['db'] self.table_name = table_name self.assoc_db = DatabaseHandle(**db_params)
def get_code_and_str(self, db_params, tbl: str, encoding: str, str_col: str) -> List[List]: self.cond_db = DatabaseHandle(**db_params) exec_str = f''' SELECT {encoding}, {str_col} FROM {tbl}''' self.cond_db.cursor.execute(exec_str) query: List[List] = self.cond_db.cursor.fetchall() return query
def __init__(self, db_params, table_name="ModelStorage"): #def __init__(self, user='******', host='localhost', pw_='', db='knowledge', table_name="ModelStorage"): # the connection to the database only has to occur once therefor, it can occur in the initialization self.host = db_params['host'] self.db = db_params['db'] self.table_name = table_name self.rel_db = DatabaseHandle(**db_params)
def __init__(self, db_params): self.know_db = DatabaseHandle(**db_params)
def __init__(self, db_params, table_name="tmp"): # the connection to the database only has to occur once therefor, it can occur in the initialization self.host = db_params['host'] self.db = db_params['db'] self.table_name = table_name self.map_db = DatabaseHandle(**db_params)