Commit a1f1538e by chenyuanjie

fix

parent bd92c00a
......@@ -58,21 +58,14 @@ if __name__ == '__main__':
start_day = str(start_day).replace("-", "")
end_day = str(end_day).replace("-", "")
print(f"{date_info}的月初是:{start_day},月末是:{end_day}")
if date_type == 'us':
sql = f"""
create table if not exists {export_tb} (
like {export_master_tb} including defaults including comments
);
delete from {export_tb} where report_date >= '{start_day}' and report_date <= '{end_day}'
"""
else:
sql = f"""
create table if not exists {export_tb} (
like {export_master_tb} including defaults including comments
);
delete from {export_tb} where report_date > '{start_day}' and report_date <= '{end_day}'
"""
year_int = int(year_str)
sql = f"""
CREATE TABLE IF NOT EXISTS {export_tb}
PARTITION OF {export_master_tb}
FOR VALUES FROM ('{year_int}-01-01') TO ('{year_int + 1}-01-01');
DELETE FROM {export_master_tb} WHERE report_date >= '{start_day}' AND report_date <= '{end_day}'
"""
DBUtil.engine_exec_sql(pg_clu_engine, sql)
# 导出表名
......@@ -80,7 +73,7 @@ if __name__ == '__main__':
site_name=site_name,
db_type=db_type,
hive_tb="dwd_buyer_st",
export_tb=export_tb,
export_tb=export_master_tb,
col=[
"search_term",
"report_date",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment