Watch Neon Developer Days #3 🚀

Import data from Heroku

This guide describes how to import your data from Heroku Postgres to Neon.

The instructions assume that you have installed the Heroku CLI, which is used to transfer data from Heroku. For installation instructions, see The Heroku CLI.

To migrate your data from Heroku to Neon:

  1. Create a Neon project and copy the connection string
  2. Retrieve your Heroku app name and database name
  3. Import your data
  4. Verify that your data was imported

Create a Neon project and copy the connection string

  1. Navigate to the Projects page in the Neon Console.

  2. Click New Project.

  3. Specify your project settings and click Create Project.

  4. After creating a project, you are directed to the Neon Dashboard, where a connection string with your password is provided under Connection Details. Copy the connection string. It is required to import your data from Heroku.

    The example connection string used the instructions that follow is:

Retrieve your Heroku app name and database name

  1. Log in to Heroku and select the project you want to import data from.
  2. Select Overview and copy the name of the Heroku Postgres database, which appears under Installed add-ons.
  3. Click Settings and copy your Heroku App Name.

note

You can also retrieve the Heroku Postgres database name using the following Heroku CLI command:

where <app> is the Heroku App Name.

For example:

Import your data

From your terminal, run the following Heroku CLI command:

where:

  • [app] is the name of the Heroku app
  • [heroku-pg-database] is the name of the Heroku PostgreSQL database
  • [neon-connection-string] is the Neon connection string

For example:

Verify that your data was imported

  1. Log in to the Neon Console.
  2. Select the Neon project that you transferred data to.
  3. Select the Tables tab.
  4. In the sidebar, verify that your database tables appear under the Tables heading.

Need help?

Join the Neon community forum to ask questions or see what others are doing with Neon. Neon Pro Plan users can open a support ticket from the console. For more detail, see Getting Support.

Last updated on

Edit this page
Was this page helpful?