手动测试数据管道

Python 中的 ETL 与 ELT

Jake Roach

Data Engineer

测试数据管道

应充分测试数据管道

  • 验证提取、转换、加载是否符合预期

$$

验证管道可降低上线后的运维成本

  • 发现并修复数据质量问题
  • 提升数据可靠性

测试数据管道的工具与方法

  • 端到端测试
  • 在"检查点"验证数据
  • 单元测试
Python 中的 ETL 与 ELT

测试与生产环境

用于构建和运行数据管道的测试与生产环境。

Python 中的 ETL 与 ELT

端到端测试管道

数据管道的端到端测试。

端到端测试

  • 确认管道可重复稳定运行
  • 在管道检查点验证数据
  • 同行评审并采纳反馈
  • 确保消费者可用且满意
Python 中的 ETL 与 ELT

验证管道检查点

# Extract, transform, and load data as part of a pipeline
...

# Take a look at the data made available in a Postgres database
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
Python 中的 ETL 与 ELT

验证 DataFrame

# Extract, transform, and load data, as part of a pipeline
...

# Take a look at the data made available in a Postgres database
loaded_data = pd.read_sql("SELECT * FROM clean_stock_data", con=db_engine)

# Compare the two DataFrames.
print(clean_stock_data.equals(loaded_data))
True
Python 中的 ETL 与 ELT

让我们一起练习吧!

Python 中的 ETL 与 ELT

Preparing Video For Download...