数据管道架构模式
在构建数据管道时,最好将定义函数的文件与实际运行这些函数的文件分离。
在本练习中,您将练习先把管道的组件导入内存,然后使用这些函数端到端运行整条管道。项目结构如下所示,其中 pipeline_utils 存放将用于运行管道的 extract()、transform() 和 load() 函数。
> ls
etl_pipeline.py
pipeline_utils.py
本练习是课程的一部分
使用 Python 的 ETL 和 ELT
练习说明
- 从
pipeline_utils模块导入extract、transform和load函数。 - 使用导入的函数端到端运行数据管道。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Import the extract, transform, and load functions from pipeline_utils
____
# Run the pipeline end to end by extracting, transforming and loading the data
raw_tax_data = ____("raw_tax_data.csv")
clean_tax_data = ____(raw_tax_data)
____(clean_tax_data, "clean_tax_data.parquet")