Commit a0670622 by chenyuanjie

fix

parent db06cf50
...@@ -34,7 +34,8 @@ if __name__ == '__main__': ...@@ -34,7 +34,8 @@ if __name__ == '__main__':
report_type = date_type report_type = date_type
report_date = date_info report_date = date_info
elif date_type == 'month_week': elif date_type == 'month_week':
export_tb = f"{site_name}_asin_related_30_day" export_tb = f"{site_name}_asin_related_30_day_copy"
export_tb_target = f"{site_name}_asin_related_30_day"
report_type = '30_day' report_type = '30_day'
report_date = date.today() report_date = date.today()
else: else:
...@@ -85,6 +86,7 @@ if __name__ == '__main__': ...@@ -85,6 +86,7 @@ if __name__ == '__main__':
DBUtil.engine_exec_sql(engine, sql) DBUtil.engine_exec_sql(engine, sql)
print("数据类型修改完成,准备创建索引!") print("数据类型修改完成,准备创建索引!")
if date_type == 'month':
sql = f""" sql = f"""
CREATE INDEX {export_tb}_asin_idx ON {export_tb} USING btree ( CREATE INDEX {export_tb}_asin_idx ON {export_tb} USING btree (
"asin" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST "asin" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
...@@ -96,6 +98,15 @@ if __name__ == '__main__': ...@@ -96,6 +98,15 @@ if __name__ == '__main__':
""" """
DBUtil.engine_exec_sql(engine, sql) DBUtil.engine_exec_sql(engine, sql)
print("索引创建完成,准备插入流程记录表!") print("索引创建完成,准备插入流程记录表!")
elif date_type == 'month_week':
# 构建索引并交换表名
DBUtil.exchange_tb(
engine=engine,
source_tb_name=export_tb,
target_tb_name=export_tb_target,
cp_index_flag=True
)
print("索引创建完成,准备插入流程记录表!")
sql = f""" sql = f"""
REPLACE INTO selection.workflow_everyday REPLACE INTO selection.workflow_everyday
......
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