使用 Python 的 ETL 和 ELT
Jake Roach
Data Engineer
应充分测试数据管道
$$
验证可减少上线后的维护成本
测试数据管道的工具与方法


端到端测试
# 作为管道的一部分,抽取、转换并加载数据
...
# 查看 Postgres 数据库中可用的数据
loaded_data = pd.read_sql("SELECT * FROM clean_stock_data", con=db_engine)
print(loaded_data.shape)
(6438, 4)
print(loaded_data.head())
timestamps volume open close
1997-05-15 13:30:00 1443120000 0.121875 0.097917
1997-05-16 13:30:00 294000000 0.098438 0.086458
1997-05-19 13:30:00 122136000 0.088021 0.085417
# 作为管道的一部分,抽取、转换并加载数据
...
# 查看 Postgres 数据库中可用的数据
loaded_data = pd.read_sql("SELECT * FROM clean_stock_data", con=db_engine)
# 比较两个 DataFrame
print(clean_stock_data.equals(loaded_data))
True
使用 Python 的 ETL 和 ELT