添加数据库异常判断
This commit is contained in:
		
							parent
							
								
									08c10b19b9
								
							
						
					
					
						commit
						7099e71b5c
					
				@ -139,6 +139,7 @@ def predict_main():
 | 
			
		||||
            sqlitedb.create_table('most_model', columns="ds datetime, most_common_model TEXT")
 | 
			
		||||
        sqlitedb.insert_data('most_model', (datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'), most_common_model,), columns=('ds', 'most_common_model',))
 | 
			
		||||
 | 
			
		||||
    try:
 | 
			
		||||
        if is_weekday:
 | 
			
		||||
            logger.info('今天是周一,更新预测模型')
 | 
			
		||||
            # 上传预警信息到数据库
 | 
			
		||||
@ -157,6 +158,8 @@ def predict_main():
 | 
			
		||||
            else:
 | 
			
		||||
                warning_data_df['id'] = range(1, 1 + len(warning_data_df))
 | 
			
		||||
            warning_data_df.to_sql(table_name,  con=engine, if_exists='append', index=False)
 | 
			
		||||
    except:
 | 
			
		||||
        logger.info('上传预警信息到数据库失败')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    if is_corr:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user