from utils.datahub_util import build_column_lineages

to_tb = "dwd_bsr_asin_rank"
sources = [
    {
        "form": "dim_bsr_asin_rank_history",
        "mappings": [
            ("asin", "asin"),
            ("category_id", "category_id"),
            ("bsr_rank", "bsr_rank"),
            # ("", "is_1_day_flag"),
            # ("", "is_7_day_flag"),
            # ("", "is_30_day_flag"),
            # ("", "bsr_count"),
            # ("", "is_asin_new"),
            # ("", "is_asin_bsr_new"),
            # ("", "last_bsr_day"),
            ("site_name", "site_name"),
            ("date_info", "date_info"),
        ]
    },
]

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
