Ship faster with database branching workflows: Add prod-like data to your preview and local dev environments.
Integration guides/Replication

Replicate data with Fivetran

Learn how to replicate data from Neon with Fivetran

Enrollment Pause for Logical Replication Beta

We have temporarily paused new enrollments in our Logical Replication Beta program. This pause is aimed at evaluating the feature's performance and incorporating feedback from our early adopters. Please stay tuned for updates, and thank you for your interest. We plan to reopen enrollment again soon.

Neon's logical replication feature allows you to replicate data from your Neon Postgres database to external destinations.

Fivetran is an automated data movement platform that helps you centralize data from disparate sources, which you can then manage directly from your browser. Fivetran extracts your data and loads it into your data destination.

In this guide, you will learn how to define a Neon Postgres database as a data source in Fivetran so that you can replicate data to one or more of Fivetran's supported destinations.


Enable logical replication in Neon


Enabling logical replication modifies the Postgres wal_level configuration parameter, changing it from replica to logical for all databases in your Neon project. Once the wal_level setting is changed to logical, it cannot be reverted. Enabling logical replication also restarts all computes in your Neon project, meaning active connections will be temporarily dropped before automatically reconnecting.

To enable logical replication in Neon:

  1. Select your project in the Neon Console.
  2. On the Neon Dashboard, select Project settings.
  3. Select Beta.
  4. Click Enable to enable logical replication.

You can verify that logical replication is enabled by running the following query from the Neon SQL Editor:

SHOW wal_level;

Create a Postgres role for replication

We recommend using a dedicated Postgres role for replicating data. The role must have the REPLICATION privilege. The default Postgres role created with your Neon project and roles created using the Neon Console, CLI, or API are granted membership in the neon_superuser role, which has the required REPLICATION privilege.

To create a role in the Neon Console:

  1. Navigate to the Neon Console.
  2. Select a project.
  3. Select Roles.
  4. Select the branch where you want to create the role.
  5. Click New Role.
  6. In the role creation dialog, specify a role name.
  7. Click Create.

The role is now created and you are provided with the password for the role, which you can show, copy, or download.

Grant schema access to your Postgres role

If your replication role does not own the schemas and tables you are replicating from, make sure to grant access. Run these commands for each schema:

GRANT USAGE ON SCHEMA <schema_name> TO <role_name>;
GRANT SELECT ON ALL TABLES IN SCHEMA <schema_name> TO <role_name>;

Granting SELECT ON ALL TABLES IN SCHEMA instead of naming the specific tables avoids having to add privileges later if you add tables to your publication.

Create a publication

Create the Postgres publication. Include all tables you want to replicate as part of the publication:

CREATE PUBLICATION fivetran_pub FOR TABLE <tbl1, tbl2, tbl3>;

The publication name is customizable. Refer to the Postgres docs if you need to add or remove tables from your publication.

Create a replication slot

Fivetran requires a dedicated replication slot. Only one source should be configured to use this replication slot.

Fivetran uses the pgoutput plugin in Postgres for decoding WAL changes into a logical replication stream. To create a replication slot called fivetran_slot that uses the pgoutput plugin, run the following command on your database using your replication role:

SELECT pg_create_logical_replication_slot('fivetran_pgoutput_slot', 'pgoutput');

The name assigned to the replication slot is fivetran_pgoutput_slot. You will need to provide this name when you set up your Fivetran source.


To prevent storage bloat, Neon automatically removes inactive replication slots after a period of time if there are other active replication slots. If you have or intend on having more than one replication slot, please see Unused replication slots to learn more.

Create a Postgres source in Fivetran

  1. Log in to your Fivetran account.

  2. On the Select your datasource page, search for the PostgreSQL source and click Set up.

  3. In your connector setup form, enter a value for Destination Schema Prefix. This prefix applies to each replicated schema and cannot be changed once your connector is created. In this example, we'll use neon as the prefix.

  4. Enter the connection details for your Neon database. You can get these details from your Neon connection string, which you'll find in the Connection Details widget on the Dashboard of your Neon project. For example, let's say this is your connection string:


    From this string, the values in the Fivetran Create a source dialog would show as below. Your actual values will differ, with the exception of the port number.

    • Host:
    • Port: 5432
    • Username: alex
    • Password: AbC123dEf
    • Database Name: dbname
  5. For Connection Method, select Logical replication of the WAL using the pgoutput plugin and enter values for the Replication Slot and Publication Name. You deifned these values earlier (fivetran_pgoutput_slot and fivetran_pub, respectively).

    Fivetran connector setup

  6. If you are using Neon's IP Allow feature to limit IP addresses that can connect to Neon, add Fivetran's IPs to your allowlist in Neon.

    Fivetran IP addresses

    For instructions, see Configure IP Allow. You'll need to do this before you can validate your connection in the next step. If you are not using Neon's IP Allow feature, you can skip this step.

  7. Click Save & Test. Fivetran tests and validates the connection to your database. Upon successful completion of the setup tests, you can sync your data using Fivetran.

    During the test, Fivetran asks you to confirm the certificate chain by selecting the certificate to use as the trust anchor. Select the CN=ISRG Root X1, 0=Internet Security Research Group, C=US option. This certificate is valid unitl until 2035-06-04.

    When the connection test is completed, you should see an All connection tests passed! message in Fivetran, as shown below:

    Fivetran all connections passed message

  8. Click Continue.

  9. On the Select Data to Sync page, review the connector schema and select any columns you want to block or hash.

    Fivetran select data to sync page

  10. Click Save & Continue.

  11. On the How would you like to handle changes? page, specify how you would like to handle future schema changes. For this example, we'll select We will allow all new schemas, tables and columns. Choose the option that best fits your organization's requirements.

    Fivetran how to handle changes

  12. Click Continue. Your data is now ready to sync.

    Fivetran data is ready to sync page

  13. Click Start Initial Sync to enable syncing.


Need help?

Join our Discord Server to ask questions or see what others are doing with Neon. Users on paid plans can open a support ticket from the console. For more detail, see Getting Support.

Last updated on

Edit this page
Was this page helpful?