How to Replicate Database Views in the Destination
Use Case
You want to replicate data from a view in your source database in your destination.
Recommendation
Fivetran does not sync views directly from the source database because changes to the data in the underlying tables make it hard to accurately track incremental updates to the view itself. We recommend that you re-create the view in your destination.
To re-create a view in your destination, do the following:
- Sync all of the underlying tables used in the view in your database connectors.
- Copy the view definition code from your source database.
- Create a new dbt transformation. Learn how in our dbt transformation documentation.
- Paste your view definition code so it is re-created exactly in your destination.
Considerations
Each source database has different mechanisms for extracting the code for the view quickly.
- PostgreSQL: Use the
definition
column in thepg_views
system table