始める無料で始める

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 によるデータパイプラインの構築

コースを見る

実践的なインタラクティブ演習

理論を実践に変える、インタラクティブな演習のひとつをお試しください

演習を開始する