Upload data from Local Filesystem to Google Drive¶
The Google Drive is used to store large data from various applications. This page shows how to upload data from local filesystem to Google Drive.
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.
LocalFilesystemToGoogleDriveOperator¶
LocalFilesystemToGoogleDriveOperator
allows you to upload
data from local filesystem to GoogleDrive.
When you use this operator, you can upload a list of files.
Below is an example of using this operator to upload data from local filesystem to Google Drive.
upload_single_file = LocalFilesystemToGoogleDriveOperator(
gcp_conn_id=CONNECTION_ID,
task_id="upload_single_file",
local_paths=SINGLE_FILE_LOCAL_PATHS,
drive_folder=DRIVE_FOLDER,
)