コード例 #1
0
def get_budget_data(conn_ins, company_name, scenario, period_range_list):
    period_range_str = date_utils.get_sql_where_clause_for_dates(
        period_range_list)

    query_sql_str = "SELECT * FROM budget WHERE company = \'" + company_name + "\' AND scenario = \'" + scenario + "\' AND period " + period_range_str + " ;"
    budget_df = db_controller.get_query_from_db(conn_ins, query_sql_str)
    return budget_df
コード例 #2
0
def get_project_respreads_data(conn_ins, company_name, data_date,
                               period_range_list):
    period_range_str = date_utils.get_sql_where_clause_for_dates(
        period_range_list)

    query_sql_str = "SELECT * FROM project_respread WHERE company = \'" + company_name + "\' AND data_date = \'" + data_date + "\' AND period " + period_range_str + " ;"
    budget_adjustment_df = db_controller.get_query_from_db(
        conn_ins, query_sql_str)
    return budget_adjustment_df
コード例 #3
0
def get_tb_mapping_company(conn_ins, company_name, forecast_start_date,
                           plant_id):
    query_sql_str = "SELECT * FROM tb_mapping WHERE effective_end_date > \'" + str(
        forecast_start_date
    ) + "\' AND lower(company) = lower(\'" + company_name + "\');"
    if plant_id:
        query_sql_str = "SELECT * FROM tb_mapping WHERE plant_id = \'" + plant_id + "\' AND effective_end_date > \'" + str(
            forecast_start_date
        ) + "\' AND lower(company) = lower(\'" + company_name + "\');"
    # print (query_sql_str);
    tb_mapping_df = db_controller.get_query_from_db(conn_ins, query_sql_str)
    return tb_mapping_df.groupby(['fsli'])
コード例 #4
0
def get_budget_input_data_for_pxq(conn_ins, budget_scenario, company):
    pxq_account_name_list = [
        'On-Peak Generation', 'Off-Peak Generation', 'Total Generation',
        'Realized On-Peak Power Price', 'Realized Off-Peak Power Price',
        'Fossil Fuel Consumed', 'Delivered Fuel'
    ]

    account_name_str = " in ("

    for item in pxq_account_name_list:
        account_name_str += "\'" + item + "\' , "

    account_name_str = account_name_str[:-2]

    account_name_str += ")"

    # print (account_name_str);

    query_sql_str = "SELECT * FROM budget WHERE scenario = \'" + budget_scenario + "\' AND company=\'" + company + "\' AND account_name " + account_name_str + ";"

    budget_data_for_pxq_df = db_controller.get_query_from_db(
        conn_ins, query_sql_str)
    return budget_data_for_pxq_df
コード例 #5
0
def get_respreads(conn_ins, company, scenario):
    query_sql_str = "SELECT * FROM project_respread WHERE company = \'" + company + "\' AND scenario = \'" + scenario + "\';"
    respreads_df = db_controller.get_query_from_db(conn_ins, query_sql_str)
    return respreads_df
コード例 #6
0
def get_ltsa_capex(conn_ins, company, scenario, version):
    query_sql_str = "select sum(value), company, period from financials where scenario = \'" + scenario + "\' and version = \'" + version + "\' and account = 'LTSA Capex' group by company, period;"
    maintenance_capex_df = db_controller.get_query_from_db(
        conn_ins, query_sql_str)
    return maintenance_capex_df
コード例 #7
0
def get_tb_mapping(conn_ins, plant_id, data_date):
    query_sql_str = "SELECT * FROM tb_mapping WHERE plant_id = \'" + plant_id + "\' AND \'" + data_date + "\' >= effective_start_date AND \'" + data_date + "\' <= effective_end_date;"
    tb_mapping_df = db_controller.get_query_from_db(conn_ins, query_sql_str)
    return tb_mapping_df.groupby(['fsli'])
コード例 #8
0
def get_entity_plant_id(conn_ins, entity_name):
    # print (entity_name);
    query_sql_str = "SELECT plant_id FROM entity_name_mapping WHERE entity_name = \'" + entity_name + "\';"
    plant_id_df = db_controller.get_query_from_db(conn_ins, query_sql_str)
    return plant_id_df.iloc[0]['plant_id']
コード例 #9
0
def get_dispatch(conn_ins, company, scenario):
    query_sql_str = "SELECT * FROM dispatch WHERE company = \'" + company + "\' AND scenario = \'" + scenario + "\'"
    dispatch_df = db_controller.get_query_from_db(conn_ins, query_sql_str)
    return dispatch_df
コード例 #10
0
def get_financials(conn_ins, company, scenario, version):
    query_sql_str = "SELECT * FROM financials WHERE company =\'" + company + "\' AND scenario = \'" + scenario + "\' AND version = \'" + version + "\'"
    financials_df = db_controller.get_query_from_db(conn_ins, query_sql_str)
    return financials_df
コード例 #11
0
def get_pxq_input_data(conn_ins, scenario, company):
    query_sql_str = "SELECT * FROM pxq_input WHERE scenario = \'" + scenario + "\' AND company = \'" + company + "\';"
    pxq_input_data_df = db_controller.get_query_from_db(
        conn_ins, query_sql_str)
    return pxq_input_data_df
コード例 #12
0
def get_headcount(conn_ins, scenario, company):
    query_sql_str = "SELECT * FROM labor_headcount WHERE scenario = \'" + scenario + "\' AND company = \'" + company + "\';"
    headcount_df = db_controller.get_query_from_db(conn_ins, query_sql_str)
    return headcount_df
コード例 #13
0
def get_census(conn_ins, scenario, company):
    query_sql_str = "SELECT * FROM labor_census WHERE scenario = \'" + scenario + "\' AND company = \'" + company + "\';"
    census_df = db_controller.get_query_from_db(conn_ins, query_sql_str)
    return census_df