Commit 17c72656 by chenyuanjie

店铺报表数据-新增字段-卖家公司信息

parent 3797377f
...@@ -5,7 +5,7 @@ sys.path.append(os.path.dirname(sys.path[0])) ...@@ -5,7 +5,7 @@ sys.path.append(os.path.dirname(sys.path[0]))
from utils.db_util import DBUtil from utils.db_util import DBUtil
from utils.ssh_util import SSHUtil from utils.ssh_util import SSHUtil
from utils.common_util import CommonUtil, DateTypes from utils.common_util import CommonUtil
if __name__ == '__main__': if __name__ == '__main__':
site_name = CommonUtil.get_sys_arg(1, None) site_name = CommonUtil.get_sys_arg(1, None)
...@@ -23,8 +23,6 @@ if __name__ == '__main__': ...@@ -23,8 +23,6 @@ if __name__ == '__main__':
db_type = 'postgresql_test' db_type = 'postgresql_test'
print("导出到测试库中") print("导出到测试库中")
else: else:
# db_type = "postgresql"
# print("导出到PG库中")
db_type = "postgresql_cluster" db_type = "postgresql_cluster"
print("导出到PG集群库库中") print("导出到PG集群库库中")
...@@ -38,7 +36,6 @@ if __name__ == '__main__': ...@@ -38,7 +36,6 @@ if __name__ == '__main__':
# 获取数据库连接 # 获取数据库连接
engine = DBUtil.get_db_engine(db_type, site_name) engine = DBUtil.get_db_engine(db_type, site_name)
# 保证幂等性,先删除原始表同周期的数据 # 保证幂等性,先删除原始表同周期的数据
sql = f""" sql = f"""
drop table if exists {export_tb}; drop table if exists {export_tb};
...@@ -89,7 +86,9 @@ if __name__ == '__main__': ...@@ -89,7 +86,9 @@ if __name__ == '__main__':
"fb_new_asin_num_type", "fb_new_asin_num_type",
"fb_new_asin_rate_type", "fb_new_asin_rate_type",
"usr_mask_type", "usr_mask_type",
"usr_mask_progress" "usr_mask_progress",
"business_name",
"business_addr"
], ],
partition_dict={ partition_dict={
"site_name": site_name, "site_name": site_name,
...@@ -101,7 +100,6 @@ if __name__ == '__main__': ...@@ -101,7 +100,6 @@ if __name__ == '__main__':
client = SSHUtil.get_ssh_client() client = SSHUtil.get_ssh_client()
SSHUtil.exec_command_async(client, sh_report, ignore_err=False) SSHUtil.exec_command_async(client, sh_report, ignore_err=False)
client.close() client.close()
# 创建索引并交换分区 # 创建索引并交换分区
DBUtil.add_pg_part( DBUtil.add_pg_part(
...@@ -116,14 +114,11 @@ if __name__ == '__main__': ...@@ -116,14 +114,11 @@ if __name__ == '__main__':
) )
update_workflow_sql = f""" update_workflow_sql = f"""
update selection.workflow_progress set `status`='导出pg集群完成', status_val=6, over_date=CURRENT_TIME, is_end='是' where page='店铺Feedback' update selection.workflow_progress set `status`='导出pg集群完成', status_val=6, over_date=CURRENT_TIME, is_end='是' where page='店铺Feedback'
and `date_info`='{date_info}' and date_type='{date_type}' and site_name='{site_name}' and `date_info`='{date_info}' and date_type='{date_type}' and site_name='{site_name}'
""" """
CommonUtil.modify_export_workflow_status(update_workflow_sql, site_name, date_type, date_info) CommonUtil.modify_export_workflow_status(update_workflow_sql, site_name, date_type, date_info)
# 关闭链接 # 关闭链接
engine.dispose() engine.dispose()
print("success") print("success")
print("success")
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