From 940f7d85e94a81194ffd2058d18891c8904ef454 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Mon, 20 Mar 2023 18:28:08 +0800 Subject: [PATCH] update --- dags/jh/price/third_price.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dags/jh/price/third_price.py b/dags/jh/price/third_price.py index 985b14f..c1871c2 100644 --- a/dags/jh/price/third_price.py +++ b/dags/jh/price/third_price.py @@ -7,6 +7,7 @@ from pykalman import KalmanFilter from pymongo import UpdateOne import transbigdata as tbd from sklearn.neighbors import NearestNeighbors +from sqlalchemy import create_engine year_month = int(dateutils.format_date(dateutils.add_months(datetime.now(), months=-2), '%Y%m')) before_year_month = int(dateutils.format_date(dateutils.add_months(datetime.now(), years=-1, months=-1), '%Y%m')) @@ -83,10 +84,11 @@ monthly_data.loc[(monthly_data["异常第三方"].isna()) & (monthly_data.dbscan monthly_data = monthly_data.sort_values(by=["city", "region", "name"]) # In[14]: +# community_base_price = oracle.scan_by_sql_to_data_frame(f"select commid, year_month, avg_price, calc_type,confidence, cityname from community_base_price_gj where year_month > {before_year_month}") -community_base_price = oracle.scan_by_sql_to_data_frame( - f"select commid, year_month, avg_price, calc_type,confidence, cityname from community_base_price_gj where year_month > {before_year_month}") +engine = create_engine("postgresql+psycopg2://postgres:postgres@192.168.0.236:5432/warehouse", echo=False) +community_base_price = pd.read_sql(f"select gujia_bds_id as commid,gujiabds_clc_yrmo_val as year_month, gujia_comm_basic_prc as avg_price, urbn_nm as cityname,gujia_bds_clmtd as calc_type, gujia_bds_cfdrg as confidence from t_app_p9pha_plda.avm_community_base_price_gj_h where gujiabds_clc_yrmo_val>{before_year_month} ", con=engine) community_base_price = community_base_price.sort_values(by=['commid', 'year_month'], ascending=[True, True]) # In[15]: