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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import json
from utils.datahub_util import build_column_lineages
to_tb = "dwt_nsr_asin_detail"
sources = [
{
"form": "dwd_nsr_asin_rank",
"mappings": [
("asin", "asin"),
]
},
{
"form": "dim_fd_asin_info",
"mappings": [
("fd_account_name", "account_name"),
]
},
{
"form": "dim_cal_asin_history_detail",
"mappings": [
("asin_title", "title"),
("asin_img_url", "img_url"),
("asin_img_type", "img_type"),
("asin_rating", "rating"),
("asin_total_comments", "total_comments"),
("asin_price", "price"),
("asin_weight", "weight"),
("asin_launch_time", "launch_time"),
("asin_volume", "volume"),
("asin_brand_name", "brand_name"),
("asin_buy_box_seller_type", "buy_box_seller_type"),
("asin_crawl_date", "last_update_time")
]
},
{
"form": "dwt_flow_asin",
"mappings": [
("asin_bsr_orders_change", "bsr_orders_change"),
("asin_ao_val", "ao_val"),
("bsr_orders", "bsr_orders"),
]
},
]
if __name__ == '__main__':
config = []
for source in sources:
for mapping in source["mappings"]:
config.append(
{
"from": f"{source['form']}.{mapping[0]}",
"to": f"{to_tb}.{mapping[1]}",
},
)
pass
url = build_column_lineages(config)
print(url)
pass
pass