Can I change the primary key in my Destination table?

Last updated on May 30, 2023

Yes, you can change the primary key (PK) in your Destination table after creating the Pipeline. For this, you need to remove the existing PK and create a new one. The primary key is a unique value that identifies a row in a table. Therefore, if Hevo finds duplicate primary key values, an error is displayed in the Destination Workbench.

Perform the following steps:

  1. Click Destinations in the Navigation Bar and select the Destination for which you wish to change the primary key.

    Select a Pipeline

  2. In the left navigation pane, click Workbench.

    Workbench

  3. In the SQL QUERY editor:

    1. Enter the following command to remove the existing primary key:

      ALTER TABLE <table_name> DROP CONSTRAINT <constraint_name>;
      

      Note: Replace the placeholder values in the command above with your own.

    2. Click RUN QUERY.

    3. Enter the following command to add create the new primary key:

      ALTER TABLE <table_name> ADD CONSTRAINT <constraint_name> PRIMARY KEY (<column_name>);
      

      Note: Replace the placeholder values in the command above with your own.

    4. Click RUN QUERY.

    5. Click Refresh Icon (Refresh) to update the primary key for the table.

      Refresh Icon

See Also


Revision History

Refer to the following table for the list of key updates made to this page:

Date Release Description of Change
Nov-07-2022 NA Created as a new document.

Tell us what went wrong