Enable your PostgreSQL database to accept connections from
Cloud Data Fusion. To do this securely, we recommend that you use a
private Cloud Data Fusion instance.
Required roles
To get the permissions that
you need to connect to a PostgreSQL database,
ask your administrator to grant you the
following IAM roles:
Dataproc Worker (roles/dataproc.worker)
on the Dataproc service account in the project that contains the cluster
Cloud Data Fusion Runner (roles/datafusion.runner)
on the Dataproc service account in the project that contains the cluster
To use Cloud SQL without the Cloud SQL Auth Proxy:
Cloud SQL Client (roles/cloudsql.client)
on the project that contains the Cloud SQL instance
Enter your PostgreSQL password as a secure key to encrypt in your
Cloud Data Fusion instance. For more information about keys, see
Cloud KMS.
In the Cloud Data Fusion UI, click System admin >
Configuration.
Click Make HTTP Calls.
Configuration.
In the dropdown menu, choose PUT.
In the path field, enter namespaces/default/securekeys/pg_password.
In the Body field, enter {"data":"POSTGRESQL_PASSWORD"}.
Replace POSTGRESQL_PASSWORD with your PostgreSQL
password.
Click Send.
Password.
The Response field notifies you of any errors.
Connect to Cloud SQL for PostgreSQL
In the Cloud Data Fusion UI, click the menu menu
and navigate to the Wrangler page.
Click Add connection.
Choose Database as the source type to connect.
Add connection.
Under Google Cloud SQL for PostgreSQL, click Upload.
Choose source.
Upload a JAR file that contains your PostgreSQL driver. Your JAR file must
follow the format NAME-VERSION.jar. If
your JAR file doesn't follow this format, rename it before you upload.
Click Next.
Enter the driver's name, class name, and version in the fields.
Click Finish.
In the Add connection window that opens, click Google Cloud SQL for
PostgreSQL. Your JAR name should appear under Google Cloud SQL for
PostgreSQL.
JAR uploaded.
Fill in the required connection fields. In the Password field, select the
secure key you stored previously.
This ensures that your password is retrieved using Cloud KMS.
Choose password.
In the Connection string field, enter your connection string as:
Click Test connection to ensure that the connection can be
established with the database.
Click Add connection.
After your PostgreSQL database is connected, you can apply transformations to
your data (in Wrangler), create a pipeline,
and write your output to a sink (in Studio).
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025年10月16日 UTC."],[],[]]