Postgres To Google Cloud Storage Operator

The Google Cloud Storage (GCS) service is used to store large data from various applications. This page shows how to copy data from Postgres to GCS.

Prerequisite Tasks

To use these operators, you must do a few things:

PostgresToGCSOperator

PostgresToGCSOperator allows you to upload data from Postgres database to GCS.

When you use this operator, you can optionally compress the data being uploaded to gzip format.

Below is an example of using this operator to upload data to GCS.

tests/system/providers/google/cloud/transfers/example_postgres_to_gcs.py[source]

    get_data = PostgresToGCSOperator(
        task_id="get_data",
        postgres_conn_id=CONNECTION_ID,
        sql=SQL_SELECT,
        bucket=BUCKET_NAME,
        filename=FILE_NAME,
        gzip=False,
    )

Reference

For further information, look at: * Google Cloud Storage Documentation

Was this entry helpful?