def __get_retrieve_Stat_ModelStatsTable_Statement(resp_word_ID, model_ID): table = 'T_MODEL_STATISTICS' wC = ['int_word_rsp_var_id', 'int_model_id'] wV = [resp_word_ID, model_ID] wO = ['=']*len(wC) sC = ['flt_model_score', 'flt_score_variance', 'int_score_count'] return DB_util.generateSelectStatement( table, whereColumns=wC, whereValues=wV, whereOperators=wO, selectColumns=sC)
def __get_retrieve_Stat_DataStatsTable_Statement(resp_data_ID, pred_data_ID): table = 'T_DATA_STATISTICS' wC = ['int_data_rsp_var_id', 'int_data_prd_var_id'] wV = [resp_data_ID, pred_data_ID] wO = ['=']*len(wC) sC = ['adj_prd_feature_importance', 'flt_feat_imp_variance', 'int_feat_imp_count'] return DB_util.generateSelectStatement( table, whereColumns=wC, whereValues=wV, whereOperators=wO, selectColumns=sC)
def __get_retrieve_WordSeriesMetaData_Statement(seriesID, columnName): table = WordColumnTableLink[columnName] sC = [columnName] wC = ['int_word_series_ID'] wV = [seriesID] wO = ['='] return DB_util.generateSelectStatement( table, whereColumns=wC, whereValues=wV, whereOperators=wO, selectColumns=sC)
def __get_retrieve_WordSeriesID_Statement(seriesName): table = 'T_WORD_SERIES' sC = ['int_word_series_ID'] wC = ['int_word_series_name'] wV = [seriesName] wO = ['=']*len(wC) return DB_util.generateSelectStatement( table, whereColumns=wC, whereValues=wV, whereOperators=wO, selectColumns=sC)
def __get_retrieve_DataSeriesTicker_Statement(seriesID): table = 'T_DATA_SERIES' sC = ['txt_data_ticker'] wC = ['int_data_series_ID'] wV = [seriesID] wO = ['='] return DB_util.generateSelectStatement( table, whereColumns=wC, whereValues=wV, whereOperators=wO, selectColumns=sC)
def __get_completeWordHistory_WordHistoryTable_Statement(seriesID): table = 'T_WORD_HISTORY' wC = ['int_word_master_id'] wV = [seriesID] wO = ['=']*len(wC) sC = ['dt_date_time','flt_word_value'] return DB_util.generateSelectStatement( table, whereColumns=wC, whereValues=wV, whereOperators=wO, selectColumns=sC, order_=(['dt_date_time'], 'ASC'))
def __get_retrieveAllStats_DataStatsTable_Statement(resp_data_ID): table = 'T_DATA_STATISTICS' wC = ['int_data_rsp_var_id'] wV = [resp_data_ID] wO = ['='] sC = ['int_data_prd_var_id', 'adj_prd_feature_importance'] oC = (['adj_prd_feature_importance'],'desc') return DB_util.generateSelectStatement( table, whereColumns=wC, whereValues=wV, whereOperators=wO, selectColumns=sC, order_=oC)
def __get_completeDataHistory_DataHistoryTable_Statement(seriesID, selectCount=False): table = 'T_DATA_HISTORY' sC = ['dt_date_time','flt_data_value'] wC = ['int_data_series_ID'] wV = [seriesID] wO = ['='] return DB_util.generateSelectStatement( table, whereColumns=wC, whereValues=wV, whereOperators=wO, selectCount=selectCount, selectColumns=sC, order_=(['dt_date_time'], 'ASC'))
def retrieve_DataSeries_All(cursor, column=ID, limit_=None, order_=False): table = 'T_DATA_SERIES' # Find Select Column if column == ID: sC = ['int_data_series_ID'] elif column == TICKER: sC = ['txt_data_ticker'] else: raise NameError # Implement Ordering order_ = (sC, 'ASC') if order_ else None # Generate and Execute Statement statement = DB_util.generateSelectStatement(table, selectColumns=sC, order_=order_, limit_=limit_) (success, results) = DB_util.retrieveDBStatement(cursor, statement, expectedColumnCount=1) return results # Don't care about success. If not successful, will fail with error
def __get_retrieve_DataSeriesID_Statement(name=None, ticker=None): table = 'T_DATA_SERIES' sC = ['int_data_series_ID'] wC = [] wV = [] if ticker is not None: wC.append('txt_data_ticker') wV.append(ticker) if name is not None: wC.append('txt_data_name') wV.append(name) wO = ['=']*len(wC) return DB_util.generateSelectStatement( table, whereColumns=wC, whereValues=wV, whereOperators=wO, selectColumns=sC)