How Can I Use the REST API to Identify Which Tables Require a Re-Sync?
Question
I am seeing Re-sync Table Warning alerts for over 100 Fivetran connections in my account. How can I identify which specific tables are affected so I can automate re-syncs through the REST API?
Environment
All database connectors
Answer
There is no REST API endpoint that details which specific tables are listed in the Re-sync Table Warning dashboard alert. You can make a call to the Retrieve Connection Details endpoint, which outlines the title of the warning, but the specific tables are not listed.
However, you can use the Fivetran Platform Connector to get this information. It sends events to the LOG table in your destination. You can query those events to retrieve the details of the relevant tables that require a re-sync. You can find these events in the FIVETRAN_METADATA.LOG table, where the MESSAGE_EVENT is forced_resync_table.
The following sample query lists all tables that received a re-sync warning for connections associated with that destination:
SELECT MESSAGE_DATA,
CONNECTOR_ID
FROM FIVETRAN_METADATA.LOG
WHERE EVENT = 'WARNING'
AND MESSAGE_EVENT = 'forced_resync_table'
AND TIME_STAMP > '<date>'; -- filter for recent date
The query above provides the schema and list of tables in the MESSAGE_DATA field. When you identify the affected tables, use the Re-sync Table API endpoint to automate the re-syncs.