While the steps for replicating a database view are almost the same as those for replicating a table, there are some slight differences.

Verify the database user’s permissions

To replicate the view, the Stitch database user must have the appropriate level of permissions to access it.

If you don’t see the view you want in the Stitch app, it may be because the Stitch user has insufficient permissions. Verify that the Stitch user’s permissions and, if necessary, grant any that are missing.

For a refresher on the permissions Stitch needs, refer to the articles linked below:

Set the view to replicate

Note that any parent objects - like the database containing the view - must also be set to replicate. If they aren’t, set them to replicate before continuing.

  1. Click into the database integration from the Stitch Dashboard page.
  2. Navigate to the view you want to replicate.
  3. Click the icon next to the Sync Status column to set the view to replicate.
  4. Once a view has been set to replicate, the View Settings page will display.

Define the view’s Primary Key setting

Next, you’ll define the Primary Key setting for the view. There are two options:

  • No Primary Key: If selected, the view will be replicated using Append-Only Incremental Replication. This means that existing rows will not be updated, and any new rows will be appended to the end of the table.
  • Custom Primary Key: If selected, the field or fields you define will be used as the view’s Primary Keys. To add additional fields, click the Add button.

Note that you can change the Primary Key setting - including adding or removing fields to the Custom Primary Key - at any time, but doing so will require a full re-replication of the view. This is to ensure that there aren’t any gaps in the data.

Define the view’s Replication Method

The last step is to define the Replication Method for the view:

  • Incremental Replication: If selected, Stitch will only replicate new and/or updated data (based on the Replication Key you define) during every replication attempt. When using Incremental Replication, keep in mind that:
    • Replication Keys are required to use Incremental Replication. When Stitch replicates your data, it will store the last recorded maximum value in the Replication Key column and compare it against the data source - not what’s in your data warehouse - to identify new/updated data. Any row with a Replication Key value greater than or equal to the stored value is where Stitch will begin the next replication attempt.
    • If no Primary Key is selected for the view, data will be replicated using Append-Only Incremental Replication
  • Full Table Replication: If selected, Stitch will replicate the entire contents of the view on every replication attempt. As this can increase latency and quickly use up your row limit, it’s the most inefficient way to use Stitch.

After you’ve finished defining the view’s settings, click Save Settings.

Questions? Feedback?

Did this article help? If you have questions or feedback, feel free to submit a pull request with your suggestions, open an issue on GitHub, or reach out to us.

Tags: replication