Downloads data from Google Cloud Storage to Local Filesystem¶
The Google Cloud Storage (GCS) is used to store large data from various applications. This page shows how to download data from GCS to local filesystem.
Prerequisite Tasks¶
To use these operators, you must do a few things:
Select or create a Cloud Platform project using the Cloud Console.
Enable billing for your project, as described in the Google Cloud documentation.
Enable the API, as described in the Cloud Console documentation.
Install API libraries via pip.
pip install 'apache-airflow[google]'Detailed information is available for Installation.
GCSToLocalFilesystemOperator¶
GCSToLocalFilesystemOperator
allows you to download
data from GCS to local filesystem.
Below is an example of using this operator to download a file from GCS.
download_file = GCSToLocalFilesystemOperator(
task_id="download_file",
object_name=FILE_NAME,
bucket=BUCKET_NAME,
filename=PATH_TO_SAVED_FILE,
)