us_asin_image_to_pg14.py
902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import os
import sys
sys.path.append(os.path.dirname(sys.path[0]))
from utils.ssh_util import SSHUtil
from utils.common_util import CommonUtil
from utils.hdfs_utils import HdfsUtils
from utils.db_util import DBUtil
if __name__ == '__main__':
site_name = "de"
# 导出到pg数据库
db_type = "postgresql"
export_tb = "de_asin_image_copy"
# 导出表名
sh = CommonUtil.build_export_sh(
site_name="de",
db_type=db_type,
hive_tb="tmp_asin_image_lzo",
export_tb=export_tb,
col=[
"asin",
"img_url",
"img_order_by",
"created_at",
"updated_at",
"data_type"
],
partition_dict={
"site_name": "de"
}
)
client = SSHUtil.get_ssh_client()
SSHUtil.exec_command_async(client, sh, ignore_err=False)
client.close()
pass