Postgres

Last Updated: 2022-01-19

Overview

Grouparoo's Postgres Integration is configurable as both a Source and a Destination that enables you to import and export customer data to and from one or more Postgres databases. Postgres is a relational database management system (RDBMS). You can use Grouparoo to sync data between a Postgres database and other services to operationalize your data.

Sources

Source NameDescription
Postgres Import TableImport or update Records from a Postgres database table.
Postgres Import QueryImport or update Records via a custom Postgres query.

Destinations

Destination NameDescription
Postgres Export RecordExport Records to a Postgres table. Groups will be exported to a secondary table linked by a foreign key.

Setup

To work with the Postgres Plugin, you must first install it in an existing Grouparoo project. Grouparoo supports syncing with Postgres databases stored on a local machine or remotely, provided that there is no firewall or VPN prohibiting the connection.

App

To connect Postgres to Grouparoo, you create an App to tell Grouparoo how to connect to Postgres. This specifies the connection details for the database you want to sync data to or from.

App Options

In Grouparoo, provide the options that best describe how you would like to connect to Postgres.

Postgres App Options

App OptionDescription
Host (required)The Postgres Database host. This field, if left blank, will default to ‘localhost’.
Port (required)The Postgres port. If left blank, this defaults to 5432.
Database (required)The Postgres Database name.
Schema (required)Schema used to read tables. The Plugin works inside a single schema. This field, if left blank, will default to ‘public’.
UserThe Postgres User, if you need to supply credentials to log into this database for access.
PasswordThe Postgres User’s password. If you don't have a password and you are connecting to a local host, leave this value as undefined.
SSLBoolean field to indicate if the connection will require the use of SSL connection. When set to ‘true’, the application will use ssl if supported by the server. If you need custom SSL certificates, the following fields will be where you supply those.
SSL CertificateIf using SSL, this is the SSL certificate used for the connection. Default: null
SSL KeyIf using SSL, this is the SSL certificate key used for the connection. Default: null
SSL Certificate AuthorityIf using SSL, this is the SSL certificate authority (CA) for the connection. Default: null

Postgres Import Table

This source reads from a single schema or table in your Postgres database using a primary or foreign key. Properties are generated from this table from row values or aggregations of row values.

Postgres Import Table Options

Options

There is one option to set for a Postgres Table Import Source. You need to choose the table from your database that will serve as the location for Grouparoo to scan for changes to Properties.

Option NameDescription
Table (required)The table you want to scan for updates to your data.

Mapping

Defining Mappings is a critical part of the process. It tells Grouparoo which Record to associate with the imported data.

If you are using Postgres Import Table as the primary source, choose the database column that uniquely identifies Records in your Model. This will often be the primary key of the table that represents your Model.

In secondary sources, choose the database column that ties this table to your primary source. This will often be a foreign key in your table.

Schedule

Create a schedule to actively pull new data from this Postgres table. If the recurring option is not selected, you are creating a one-time sync. There are also options to confirm records exist when running a schedule and to enable refresh. When Recurring is selected, you will see a field for entering the frequency, in minutes, of recurrence.

Postgres Import Table Schedule


Options

Configure a schedule for your project and determine how Grouparoo should check for new data by selecting filling out the options for this Source.

Option NameDescription
column (required)Select which column Grouparoo should check to look for new data. Often, this would be a column like “updated_at” - Grouparoo remembers the most recent values so it can be based on an incremental count as well.

Filters

If there is a subset of rows data you want to specifically include or exclude from your Postgres database table, create a Filter.

Properties

Properties populate your Records with data from your Postgres table based on table columns. Create a Property to be able to use row data in Grouparoo.

Postgres Import Table Properties


Options

Option NameDescription
Column Name (required)Choose the column that will be the source of data for this Grouparoo Property.
Aggregation Method (required)Aggregation methods determine how to use the row values in the table. Postgres supports the standard set of aggregation methods for table sources.

Filters

If there is a subset of data for a specific primary or foreign key you want to include from your database table, create a Filter(https://www.grouparoo.com/docs/getting-started/product-concepts#filter).

Postgres Import Query

A Query Source works differently than a table-based source in that there are no any options to choose in setting up the connection to this type of source. A Query Source is a more flexible way to build properties.

This type of Source provides the ability to write custom SQL code to extract data from one or more tables and import the result into Grouparoo.

Postgres Export Record

Sync Modes

A Destination’s sync mode determines what to update in a Destination. The following are supported by Postgres:

  • Sync: Add, update, and remove Postgres Exported Properties as needed.This option looks for new records, changes to existing records, and deletions.
  • Additive: Add and update Postgres Exported Properties as needed, but do not remove anybody. This option looks for new Records to add to Postgres and changes to existing Postgres Records, but does not keep track of deletions.
  • Enrich: Only update those Properties that already exist in Postgres. Do not add or remove Properties. This option will only update existing Properties in the Postgres database.

Destination Options

To further clarify how Postgres should sync data, select from the options provided that are specific to your database.

Postgres Import Table Properties


Destination OptionDescription
Table (Required)The name of the table used to export Records. You must choose a table that already exists in the Postgres database you are syncing to.
Primary Key (Required)The primary key of the table. This will be used in the mapping of properties.
Groups Table (Required)The name of the table used to export groups. This table must already exist in your database and must use a foreign key to relate to the primary key you have already designated for in the previous field.
Group Foreign Key (Required)The column name for the foreign key that the groups table uses to reference the records table.
Group Column Name (Required)The column name used to store group names.

Record Data

Postgres Export Record Data


Required Properties

In a Postgres Export Record Destination, you must choose the Grouparoo Property to map to the column listed as the primary key in the Postgres database table that this Destination syncs to. Therefore, the Exported property listed as required will be whatever is designated as the Primary Key in the Postgres table.

Optional Properties

In addition to the required mapping for your table’s primary key, any other columns in the table can also have mappings to Grouparoo properties.

Group Data

You can also use Grouparoo Groups to assign records to a Group in Postgres. This information is recorded in a table that lists the Grouping alongside a foreign key that relates to the associated Record being assigned to that Group in the Postgres database.

Notes

We strive to keep our documentation accurate, easy to use, and up to date. If you notice that something has changed or is not addressed in the process of setting up your Grouparoo connection with Postgres, please let us know by reaching out to help@grouparoo.com.

As always, if you need support using Grouparoo, reach out to community members in our Slack channel. We are always happy to help!

Join us on Slack