def market_to_api2(source, target, record_file='api2.record'): """anti_fraud数据库api2表的etl主函数 :param source: 源数据库引擎 :param target: 目标数据库引擎 :param record_file: 负责记录装载id的文件名,默认为 app2.record """ # 初始化对象 extract = Extract(source, target, record_file) transform = Transform() load = Load(target, record_file) # 抽取数据 market_df = extract.market() draw_samples = extract.draw_samples() # 转换数据 reshaped_market = transform.reshape_market(market_df) aggregated_samples = transform.aggregate_from_samples(draw_samples) api2_df = transform.compile_dfs(reshaped_market, aggregated_samples) # 装载数据 load.loading(api2_df)