开始使用免费开始使用

使用 zip 配对输入

您的团队有一条将文件上传到特定云存储位置的流水线。同事使用 zip() 搭配 expand_kwargs(),将每个文件与其云存储目标一一配对:

@task
def get_files():
    return ["users.csv", "orders.csv", "products.csv"]

@task
def get_destinations():
    return ["s3://bronze/users/", "s3://bronze/orders/", "s3://bronze/products/"]

@task
def upload(file_to_upload):
    # Simulate uploading a file to cloud storage
    print(f"Uploading {file_to_upload[0]} to {file_to_upload[1]}")

files = get_files()
destinations = get_destinations()
upload.expand(file_to_upload=files.zip(destinations))

Airflow 将创建多少个 upload 实例?

本练习是课程的一部分

使用 Airflow 构建数据流水线

查看课程

动手互动练习

通过我们的互动练习之一,将理论转化为实践

开始练习