PostgreSQL

This article describes how to create and maintain connections to your PostgreSQL database.

Before you can write your transformed data to a table in PostgreSQL, you should first establish a connection to your PostgreSQL database.

Create a PostgreSQL connection

Simple example

A PostgreSQL connection can be created as follows:

CREATE POSTGRES CONNECTION postgress_connection
    CONNECTION_STRING = 'jdbc:postgresql://cdc2.c02eyuedjkh9.eu-west-1.rds.amazonaws.com:5432/auction'
    USER_NAME = 'your username'
    PASSWORD = 'your password';

When using PostgreSQL, it is not necessary to specify the database itself in the connection string.

Alter a PostgreSQL connection

Some connection options are considered mutable, meaning that in some cases, you can run a SQL command to alter an existing PostgreSQL connection rather than create a new one.

To change the database you are connecting to but keep everything else the same without having to create an entirely new connection, you can run the following command:

ALTER POSTGRES CONNECTION my_postgres_connection
    SET CONNECTION_STRING = 'jdbc:postgresql://postgresql-cluster-1.cnpkgni9k2tq.us-east-1.rds.amazonaws.com/database'

Drop a PostgreSQL connection

If you no longer need a certain connection, you can easily drop it with the following SQL command:

DROP CONNECTION my_postgres_connection; 

However, note that if there are existing tables or jobs that are dependent upon the connection in question, the connection cannot be deleted.


Learn More

Last updated