# PostgreSQL

PostgreSQL is one of the most widely used open-source relational databases in the world. Sending data to PostgreSQL with Coupler.io lets you store, query, and analyze data from any supported source using the full power of SQL — including joins, aggregations, views, and more.

## Why use PostgreSQL as a Coupler.io destination?

* **SQL-native analysis** — query your imported data with any SQL tool, BI platform, or ORM without exporting anything
* **Type enforcement** — Coupler.io detects and maps column types automatically, so your data lands in PostgreSQL cleanly structured
* **Any source, one database** — combine data from Google Ads, Stripe, YouTube, Facebook Ads, and dozens of other sources into a single PostgreSQL database
* **Supabase compatible** — if you run Supabase, it uses PostgreSQL under the hood, so you can load data into it using this destination
* **Scheduled refreshes** — keep your tables up to date automatically on the interval that fits your workflow

## Prerequisites

* A running PostgreSQL instance (self-hosted, cloud-hosted, or Supabase)
* A database user with the following privileges:
  * **CREATE** at the database level
  * **CREATE** at the schema level
  * **INSERT** on the target table
* If your database restricts inbound connections, allowlist these Coupler.io IPs:
  * `34.123.243.115`
  * `34.170.96.92`

## Quick start

{% hint style="success" %}
If you're using Supabase, just grab your connection credentials from the Supabase dashboard (Settings → Database) and use them in the PostgreSQL destination setup below.
{% endhint %}

{% stepper %}
{% step %}
**Create a new data flow and add your source.** Log in to Coupler.io, click **Add data flow**, and configure your data source — this can be any source Coupler.io supports, such as Google Ads, Stripe, or YouTube.
{% endstep %}

{% step %}
**Select PostgreSQL as your destination.** In the destination step, choose **PostgreSQL** from the list.
{% endstep %}

{% step %}
**Connect your PostgreSQL account.** Click **+ Add Account** and fill in your connection credentials:

* **Host** — hostname, IPv4, or IPv6 address of your PostgreSQL server
* **Port** — default is `5432`
* **Database** — the name of the target database
* **User** — your PostgreSQL username
* **Password** — your PostgreSQL password

Once filled in, click **Connect** to verify the connection.
{% endstep %}

{% step %}
**Set your target schema and table.** Enter the schema name and table name where Coupler.io should write data. If the schema or table doesn't exist yet, Coupler.io will create them automatically on the first run.
{% endstep %}

{% step %}
**Choose a write mode.**

* **Replace** — drops all existing rows in the table and loads fresh data on each run. Best for dashboards and reports that always reflect the latest state.
* **Append** — adds new rows below existing data without removing anything. Best for event logs, transaction history, or any time-series data.

{% hint style="warning" %}
If you use Append mode and your source data structure changes (e.g., new columns are added), you'll need to manually update the PostgreSQL table schema before the next run.
{% endhint %}
{% endstep %}

{% step %}
**Run your data flow.** Click **Save and Run** to trigger the first manual run. Coupler.io will connect to your database, create the table if needed, and load your data. Once the run completes successfully, you can set up a schedule.
{% endstep %}
{% endstepper %}

## Supported features

| Feature              | Supported |
| -------------------- | --------- |
| Replace mode         | Yes       |
| Append mode          | Yes       |
| Automatic scheduling | Yes       |
| Type enforcement     | Yes       |
| Templates            | No        |
