PostgreSQL

Connect to your PostgreSQL databases.

Getting Started

Prerequisites to create a PostgreSQL based workflow. You will need

  1. A source PostgreSQL connection.

  2. (optional) A list of tables OR SQL queries.

  3. (optional) A destination PostgreSQL connection.

Create a Connection

A postgres connection is created using the following parameters:

Connection Creation Parameters

name

Display name of your choosing used to identify your connection within Gretel.

my-postgres-connection

username

Unique identifier associated with specific account authorized to access database.

john

password

Security credential to authenticate username.

...

host

Fully qualified domain name (FQDN) used to establish connection to database server.

myserver.example.com

port

Port number; If left empty, the default value - 5432- will be used.

5432

database

Name of database to connect to.

mydatabase

(optional) schema

Optional Name of specific schema

public

(optional) params

Optional JDBC URL parameters that can be used for advanced configuration.

TrustServerCertificate=True&useSSL=false

Creating Connections

First, create a file on your local computer containing the connection credentials. This file should also include type, name , config, and credentials. The config and credentials fields should contain fields that are specific to the connection being created.

Below is an example PostgreSQL connection:

{
    "type": "postgres",
    "name": "my-postgres-connection",
    "config": {
        "username": "john",
        "host": "myserver.example.com",
        "port": 5432,
        "database": "mydatabase",
        "schema": "public",
        "params": "TrustServerCertificate=True&useSSL=false"
    },
    "credentials": {
        "password": "..."
    }
}

Now that you've created the credentials file, use the CLI to create the connection

gretel connections create --project [project id] --from-file [credential_file.json]

Last updated

Was this helpful?