airflow.contrib.operators.gcs_delete_operator

This module contains Google Cloud Storage delete operator.

Module Contents

class airflow.contrib.operators.gcs_delete_operator.GoogleCloudStorageDeleteOperator(bucket_name:str, objects:Optional[Iterable[str]]=None, prefix:Optional[str]=None, gcp_conn_id:str='google_cloud_default', google_cloud_storage_conn_id:Optional[str]=None, delegate_to:Optional[str]=None, *args, **kwargs)[source]

Bases: airflow.models.BaseOperator

Deletes objects from a Google Cloud Storage bucket, either from an explicit list of object names or all objects matching a prefix.

Parameters
  • bucket_name (str) – The GCS bucket to delete from

  • objects (Iterable[str]) – List of objects to delete. These should be the names of objects in the bucket, not including gs://bucket/

  • prefix – Prefix of objects to delete. All objects matching this prefix in the bucket will be deleted.

  • gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud Platform.

  • google_cloud_storage_conn_id (str) – (Deprecated) The connection ID used to connect to Google Cloud Platform. This parameter has been deprecated. You should pass the gcp_conn_id parameter instead.

  • delegate_to (str) – The account to impersonate, if any. For this to work, the service account making the request must have domain-wide delegation enabled.

template_fields = ['bucket_name', 'prefix', 'objects'][source]
execute(self, context)[source]