Skip to main content

PostgreSQL: Export guide

Learn how to export your Funnel data to a PostgreSQL database. With Funnel's PostgreSQL export, you can send your data directly to a PostgreSQL database for storage, analysis, and reporting.

This destination supports self-managed PostgreSQL servers and managed services, including:

  • Amazon RDS

  • Google Cloud SQL

  • Azure Database for PostgreSQL

  • Supabase

In this guide, you'll learn how to prepare your database, configure the required permissions, connect your database to Funnel, and manage your exports.


Before you start

Before setting up your PostgreSQL export, make sure you have:

  • A PostgreSQL database that is accessible over the internet using IPv4.

  • SSL enabled on your database. Funnel connects using SSL by default.

  • Database administrator access, or assistance from someone who can create users and grant the required permissions.

Step 1: Configure your PostgreSQL database

To export data from Funnel, you'll need a PostgreSQL user with permission to create and manage tables.

We recommend creating a dedicated user for Funnel.

If you already have a user with the required permissions, you can skip to Step 2: Allow Funnel to connect to your database.

1.1 Create a dedicated user, database, and schema (optional)

Run the following SQL commands in your PostgreSQL environment:

-- Create a dedicated user for Funnel CREATE USER funnel_export WITH PASSWORD 'choose-a-strong-password';  -- Optional: Create a database CREATE DATABASE funnel_database;  -- Connect to the database using psql \c funnel_database  -- Create a schema owned by the Funnel user CREATE SCHEMA IF NOT EXISTS funnel AUTHORIZATION funnel_export;

Replace choose-a-strong-password with a secure password.

Note: If you don't specify a schema when configuring your export, Funnel writes to the public schema.

1.2 Grant the required permissions (optional)

If you created a schema owned by funnel_export in the previous step, the user already has the necessary schema permissions.

If you're using an existing schema, run:

-- Allow the user to connect to the database GRANT CONNECT ON DATABASE funnel_database TO funnel_export;  -- Allow the user to use the schema and create tables GRANT USAGE, CREATE ON SCHEMA funnel TO funnel_export;

Funnel needs permission to:

  • Create tables.

  • Add new columns.

  • Delete or truncate existing data.

  • Insert new rows.

Important: We recommend allowing Funnel to create the destination table during the first export.

If you're exporting to an existing table, the Funnel database user must own that table.

PostgreSQL requires table ownership to add columns, which Funnel may need to do when you add fields to an export.

Step 2: Allow Funnel to connect to your database

Your PostgreSQL database must allow incoming connections from Funnel.

2.1 Allowlist Funnel's IP addresses

If your database restricts incoming connections through a firewall, security group, or pg_hba.conf, you'll need to allowlist Funnel's IP addresses.

Use the IP addresses corresponding to your Funnel environment:

app.funnel.io

  • 34.195.70.7

  • 34.205.117.228

  • 44.214.249.94

app.eu.funnel.io

  • 35.156.15.138

  • 35.158.190.91

  • 63.180.53.242

Note: These IP addresses must be confirmed before publishing.

2.2 Make sure your database supports IPv4

Funnel currently connects to PostgreSQL databases using IPv4 only.

If your database hostname resolves exclusively to an IPv6 address, the connection will fail.

You may see an error indicating that the host appears to be IPv6-only.

Using Supabase?

Supabase's direct database connection (db.<project-ref>.supabase.co) is IPv6-only unless you've enabled its IPv4 add-on.

You have two options for connecting Supabase to Funnel.

Option 1: Use the Session pooler (recommended)

  1. Open your Supabase dashboard.

  2. Navigate to Connect.

  3. Select Session pooler.

  4. Use the following connection details when configuring your Funnel export.

Setting

Value

Host

aws-0-<region>.pooler.supabase.com

Port

5432

Username

postgres.<project-ref>

Password

Your existing database password

Database

Your existing database name

Important: Use port 5432 for the Session pooler. The Transaction pooler on port 6543 is not supported.

Option 2: Enable the Supabase IPv4 add-on

If you prefer to use your direct database connection:

  1. Open your Supabase dashboard.

  2. Navigate to Project Settings → Add-ons.

  3. Enable the IPv4 add-on.

  4. Use your direct connection details in Funnel.

Step 3: Create your PostgreSQL export in Funnel

Once your database is configured and accessible, you can create your export.

  1. Open Funnel and navigate to the Export page.

  2. Click + Create Export.

  3. Search for and select PostgreSQL as your destination.

  4. Enter a name for your export.

  5. Enter your PostgreSQL connection details.

Connection settings

Setting

Description

Host

The hostname of your PostgreSQL server, such as mydb.abc123.us-east-1.rds.amazonaws.com.

Port

Your PostgreSQL port, usually 5432.

Database

The name of your database, such as funnel_database.

Username

The database user configured in Step 1.

Password

The password for your database user.

Schema

The schema where Funnel should write data, such as funnel. Defaults to public if left blank.

Table name

The destination table. Use letters, numbers, and underscores only.

Run your first export

After saving your configuration, click Run job to start exporting your data immediately.

Once the export completes, your data will be available in your PostgreSQL destination table.

You can then query it using standard SQL.

How Funnel writes data to PostgreSQL

Understanding how Funnel manages your destination table can help you avoid unexpected changes to your data.

Table creation and column management

Funnel automatically manages the structure of your destination table.

  • New tables: If the destination table doesn't exist, Funnel creates it during the first export.

  • New fields: When you add a field to your export, Funnel automatically adds the corresponding column.

  • Removed fields: If you remove a field from your export, Funnel doesn't delete the existing column. The column remains in the table but is left empty for newly exported rows.

If you no longer need a column, you can remove it manually in PostgreSQL.

PostgreSQL data types

Funnel automatically maps your field types to PostgreSQL column types.

Funnel field type

PostgreSQL column type

Text

TEXT

Number (decimal)

DOUBLE PRECISION

Number (integer)

INTEGER

Date

DATE

Date and time

TIMESTAMP

How data is updated

Funnel refreshes your destination table whenever an export runs.

For exports with a date range:

  1. Funnel deletes existing rows within the selected date range.

  2. Funnel inserts fresh data for that period.

  3. Data within the exported period is updated to reflect the latest values in Funnel.

This means Funnel doesn't append new rows or perform individual row-level upserts.

What happens to data outside the date range?

Rows outside the selected export date range remain in your destination table.

For example, if your export uses Last 6 months, data older than six months remains in the table from previous runs but is no longer updated.

What if my export doesn't include a date field?

If your export doesn't have a date field, Funnel clears the destination table and reloads all rows on every run.

Tip: Avoid manually editing data in the table used by Funnel. Your changes may be overwritten during subsequent exports.

If you need to transform your exported data, we recommend creating a PostgreSQL view or copying the data into a separate table.

Troubleshooting

If your PostgreSQL export isn't working as expected, use the following troubleshooting steps.

The host appears to be IPv6-only

Use an IPv4-compatible hostname. If you're using Supabase, configure the Session pooler on port 5432.

Connection timed out or Network is unreachable

Verify your hostname and port, and confirm that Funnel's IP addresses are allowlisted.

Password authentication failed

Check your username and password.

For the Supabase Session pooler, use postgres.<project-ref> as the username.

SSL is not enabled on the server or server does not support SSL

Enable SSL on your PostgreSQL server.

Permission denied for schema

Grant USAGE and CREATE permissions on the destination schema.

Must be owner of table

Transfer table ownership to your Funnel database user or configure the export to use a new table.

Table name is invalid

Use only letters, numbers, and underscores in your destination table name.

Resolving table ownership errors

If your export fails because the Funnel user doesn't own the destination table, you can transfer ownership using:

ALTER TABLE <schema>.<table> OWNER TO funnel_export;

Alternatively, configure your Funnel export to write to a new table.

Related articles

Did this answer your question?