airflow.contrib.operators.file_to_gcs

Module Contents

class airflow.contrib.operators.file_to_gcs.FileToGoogleCloudStorageOperator(src, dst, bucket, google_cloud_storage_conn_id='google_cloud_default', mime_type='application/octet-stream', delegate_to=None, gzip=False, *args, **kwargs)[source]

Bases:airflow.models.BaseOperator

Uploads a file to Google Cloud Storage. Optionally can compress the file for upload.

Parameters
  • src (str) – Path to the local file. (templated)

  • dst (str) – Destination path within the specified bucket. (templated)

  • bucket (str) – The bucket to upload to. (templated)

  • google_cloud_storage_conn_id (str) – The Airflow connection ID to upload with

  • mime_type (str) – The mime-type string

  • delegate_to (str) – The account to impersonate, if any

  • gzip (bool) – Allows for file to be compressed and uploaded as gzip

template_fields = ['src', 'dst', 'bucket'][source]
execute(self, context)[source]

Uploads the file to Google cloud storage