石油焦百川查询sql调整

This commit is contained in:
jingboyitiji 2025-03-26 13:32:46 +08:00
parent 8573211441
commit deab1ec0bb
2 changed files with 4 additions and 3 deletions

View File

@ -304,7 +304,7 @@ table_name = 'v_tbl_crude_oil_warning'
baichuan_table_name = 'V_TBL_BAICHUAN_YINGFU_VALUE' baichuan_table_name = 'V_TBL_BAICHUAN_YINGFU_VALUE'
# select BAICHUAN_ID, DATA_DATE, DATA_VALUE from V_TBL_BAICHUAN_YINGFU_VALUE where BAICHUAN_ID in ('1588348470396475286', '1666') # select BAICHUAN_ID, DATA_DATE, DATA_VALUE from V_TBL_BAICHUAN_YINGFU_VALUE where BAICHUAN_ID in ('1588348470396475286', '1666')
# 开关 # 开关
is_train = False # 是否训练 is_train = True # 是否训练
is_debug = False # 是否调试 is_debug = False # 是否调试
is_eta = True # 是否使用eta接口 is_eta = True # 是否使用eta接口
is_market = False # 是否通过市场信息平台获取特征 ,在is_eta 为true 的情况下生效 is_market = False # 是否通过市场信息平台获取特征 ,在is_eta 为true 的情况下生效

View File

@ -2224,13 +2224,14 @@ def addtimecharacteristics(df, dataset):
def get_baichuan_data(baichuanidnamedict): def get_baichuan_data(baichuanidnamedict):
baichuanidlist = [str(k) for k in baichuanidnamedict.keys()] baichuanidlist = [str(k) for k in baichuanidnamedict.keys()]
baichuanidlist= [f"'{id}'" for id in baichuanidlist] baichuanidlist= [f"'{id}'" for id in baichuanidlist]
startdate = str(config.start_year)+'0101'
# 连接数据库 # 连接数据库
db = config.db_mysql db = config.db_mysql
if db is None: if db is None:
db.connect() db.connect()
# 执行SQL查询 select BAICHUAN_ID,DATA_DATE,DATA_VALUE from V_TBL_BAICHUAN_YINGFU_VALUE where BAICHUAN_ID in ('1588348470396475286','1666'); # 执行SQL查询 select BAICHUAN_ID,DATA_DATE,DATA_VALUE from V_TBL_BAICHUAN_YINGFU_VALUE where BAICHUAN_ID in ('1588348470396475286','1666');
sql = f"SELECT BAICHUAN_ID,DATA_DATE,DATA_VALUE FROM {global_config['baichuan_table_name']} WHERE BAICHUAN_ID in ({','.join(baichuanidlist)})" sql = f"SELECT BAICHUAN_ID,DATA_DATE,DATA_VALUE FROM {global_config['baichuan_table_name']} WHERE DATA_DATE >= {startdate} AND BAICHUAN_ID in ({','.join(baichuanidlist)})"
print(sql)
# 获取查询结果 # 获取查询结果
results = db.execute_query(sql) results = db.execute_query(sql)
df = pd.DataFrame(results, columns=[ df = pd.DataFrame(results, columns=[