This file contains Google Drive operators

Module Contents



Upload a list of files to a Google Drive folder.

class, drive_folder, gcp_conn_id='google_cloud_default', delete=False, ignore_if_missing=False, chunk_size=100 * 1024 * 1024, resumable=False, delegate_to=None, impersonation_chain=None, **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 be deleted after upload (optional)

See also

For more information on how to use this operator, take a look at the guide: LocalFilesystemToGoogleDriveOperator

  • local_paths (Union[Sequence[pathlib.Path], Sequence[str]]) -- Python list of local file paths

  • drive_folder (Union[pathlib.Path, str]) -- path of the Drive 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, then don't fail even if all files can't be uploaded.

  • chunk_size (int) -- File will be uploaded in chunks of this many bytes. Only used if resumable=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.

  • delegate_to (Optional[str]) -- The account to impersonate using domain-wide delegation of authority, if any. For this to work, the service account making the request must have domain-wide delegation enabled.

  • impersonation_chain (Optional[Union[str, Sequence[str]]]) -- 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


Remote file ids after upload

Return type


template_fields = ['local_paths', 'drive_folder'][source]
execute(self, context)[source]

This is the main method to derive when creating an operator. Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

Was this entry helpful?