airflow.providers.google.suite.transfers.local_to_drive
¶
This file contains Google Drive operators.
Module Contents¶
Classes¶
Upload a list of files to a Google Drive folder. |
- class airflow.providers.google.suite.transfers.local_to_drive.LocalFilesystemToGoogleDriveOperator(local_paths, drive_folder, gcp_conn_id='google_cloud_default', delete=False, ignore_if_missing=False, chunk_size=100 * 1024 * 1024, resumable=False, impersonation_chain=None, folder_id='root', show_full_target_path=True, **kwargs)[source]¶
Bases:
airflow.models.BaseOperator
Upload a list of files to a Google Drive folder.
This operator uploads a list of local files to a Google Drive folder. The local files can optionally be deleted after upload.
See also
For more information on how to use this operator, take a look at the guide: LocalFilesystemToGoogleDriveOperator
- Parameters
local_paths (collections.abc.Sequence[pathlib.Path] | collections.abc.Sequence[str]) – Python list of local file paths
drive_folder (pathlib.Path | str) – path of the Drive folder, if folder_id is given, drive_folder is a sub path of the folder.
gcp_conn_id (str) – Airflow Connection ID for GCP.
delete (bool) – Should the local files be deleted after upload?
ignore_if_missing (bool) – If True, don’t fail even if some files can’t be uploaded.
chunk_size (int) – File will be uploaded in chunks of this many bytes. Only used when resumable is set to True. Pass in a value of -1 if the file is to be uploaded as a single chunk. Note that Google App Engine has a 5MB limit on request size, so you should never set your chunk size larger than 5MB, or to -1.
resumable (bool) – True if this is a resumable upload. False means upload in a single request.
impersonation_chain (str | collections.abc.Sequence[str] | None) – Optional service account to impersonate using short-term credentials, or chained list of accounts required to get the access token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account
folder_id (str) – The base/root folder id for each local path in the Drive folder.
show_full_target_path (bool) – If true then it reveals full available file path in the logs.
- Returns
Remote file ids after upload.