from modules.report_handler import Report_handler from modules.json_handler import Json_handler from modules.report_designer import Report_designer import configparser import json import os config = configparser.ConfigParser() config.read(os.path.join(os.path.dirname(__file__), 'config', 'db_creds.ini')) config_info = config['DB'] db_name = config_info['db_name'] db_user = config_info['scrutinizer_user'] db_pass = config_info['scrutinizer_host'] db_host = config_info['scrutinizer_host'] dash_handler = Dash_handler() report_handler = Report_handler() db_handler = DB_handler(db_name, db_user, db_pass, db_host) report_obj_query = report_handler.get_report_object('country count') db_handler.open_connection() things = db_handler.execute_query(report_obj_query) print(things) db_handler.close_connection()
import json import os config = configparser.ConfigParser() config.read(os.path.join(os.path.dirname(__file__), 'config', 'db_creds.ini')) config_info = config['DB'] db_name = config_info['db_name'] db_user = config_info['scrutinizer_user'] db_pass = config_info['scrutinizer_host'] db_host = config_info['scrutinizer_host'] dash_handler = Dash_handler() report_handler = Report_handler() json_handler = Json_handler() report_designer = Report_designer() db_handler = DB_handler(db_name, db_user, db_pass, db_host) #takes in the primary dashbaord object def delete_saved_reports(report_object): db_handler.open_connection() for report in report_object: report_name = report['name'] delete_report_query = report_handler.delete_saved_report(report_name) db_handler.execute_query(delete_report_query) db_handler.close_connection() return #takes in the designed report object
# iniate database configuration information. config = configparser.ConfigParser() config.read(os.path.join(os.path.dirname(__file__), 'config', 'db_creds.ini')) config_info = config['DB'] db_name = config_info['db_name'] db_user = config_info['scrutinizer_user'] db_pass = config_info['scrutinizer_password'] db_host = config_info['scrutinizer_host'] ## iniate all modules to handle various portions of the Script. dash_handler = Dash_handler() report_handler = Report_handler() json_handler = Json_handler() report_designer = Report_designer() db_handler = DB_handler(db_name, db_user, db_pass, db_host) # create the dashboard. def create_dashboard(dashbaord_name): #find next available dashID dashboard_id_query = dash_handler.available_dash_id() dashboard_id = db_handler.execute_query(dashboard_id_query)[0] #create dashboard create_dashboard_query = dash_handler.create_dashboard( dashbaord_name, dashboard_id) db_handler.execute_query(create_dashboard_query) #make dash visible