-
Notifications
You must be signed in to change notification settings - Fork 29
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the issue
Hi team,
Thank you for working on this dbt packages, this is very convenient to retrieve statistics about Fivetran sync.
However, we bumped into this bug from fivetran_platform__audit_table table, which is raised when the sync happened in midnight.
When the event write_to_table_start happened before the cutoff date, and write_to_table_end + sync_end happened after that, that lead to NULL in the write_to_table_start column of the model.
When that happened frequently, we will have duplicate unique keys unique_table_sync_key, since every other information is the same, and write_to_table_start now is NULL.
Relevant error log or model output
Failure in test unique_fivetran_platform__audit_table_unique_table_sync_key (models/fivetran_platform.yml)
Data example:
[
{
"write_to_table_start" : null,
"write_to_table_end" : "2026-01-07T17:00:50.669Z", -> convert to 00:00:50 in GMT+7
"sync_start" : null,
"sync_end" : "2026-01-07T17:02:22.036Z",
"unique_table_sync_key" : "3b6cae944fc459a3f06db5b6d7994fe0",
"write_to_table_start_day" : null
},
{
"write_to_table_start" : null,
"write_to_table_end" : "2026-01-04T17:01:37.339Z",
"sync_start" : null,
"sync_end" : "2026-01-04T17:02:51.399Z",
"unique_table_sync_key" : "3b6cae944fc459a3f06db5b6d7994fe0",
"write_to_table_start_day" : null
}
]
The unique_table_sync_key is duplicated since schema+table+connection_id is the same,
the syncs started before midnight at both day, ended before midnight.Expected behavior
model test passes
Possible solution
Since we are implementing lookback of 7 days of the last write_to_table_start_day anyway, I would suggest to filter only those who have sync_start and write_to_table_start is not null, to ensure data integrity.
It's confusing to have rows with write_to_table_start and sync_start is null, while the end timestamp is recorded.
dbt Project configurations
models:
fivetran_log:
+schema: fivetran_log
staging:
+schema: staging
vars:
fivetran_platform_using_destination_membership: false
Package versions
packages:
- package: fivetran/fivetran_log
version: [">=2.5.0", "<2.6.0"]
What database are you using dbt with?
redshift
How are you running this dbt package?
dbt Core™
dbt Version
1.10.13
Additional Context
No response
Are you willing to open a PR to help address this issue?
- Yes.
- Yes, but I will need assistance.
- No.