Skip to content

Feature/add rows updated and deleted to audit table - #202

Merged
fivetran-savage merged 5 commits into
release_branch/v2.6.0from
feature/add_rows_updated_and_deleted_to_audit_table
Oct 8, 2026
Merged

fivetran-savage merged 5 commits into
release_branch/v2.6.0from
feature/add_rows_updated_and_deleted_to_audit_table

Conversation

@fivetran-savage

Copy link
Copy Markdown
  • GA-1033142
  • Adds rows_loaded per table to fivetran_platform__audit_table
  • Adds total_rows_extracted per connection to fivetran_platform__sync_metrics

@fivetran-savage
fivetran-savage changed the base branch from main to release_branch/v2.6.0 August 6, 2026 17:44

@fivetran-catfritz fivetran-catfritz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments here and in the ticket!

Comment on lines +16 to +18
max(case when event_subtype = 'sync_end'
then cast({{ fivetran_log.fivetran_log_json_parse(string='message_data', string_path=['status']) }} as {{ dbt.type_string() }})
else null end) as sync_status

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

max(status) picks alphabetically (my findings in the ticket).

Suggested fix: add a rank to log first (line 3 above):

then pick the latest sync_end here:

Suggested change
max(case when event_subtype = 'sync_end'
then cast({{ fivetran_log.fivetran_log_json_parse(string='message_data', string_path=['status']) }} as {{ dbt.type_string() }})
else null end) as sync_status
max(case when event_subtype = 'sync_end' and nth_event_subtype_record = 1
then cast({{ fivetran_log.fivetran_log_json_parse(string='message_data', string_path=['status']) }} as {{ dbt.type_string() }})
else null end) as sync_status

table_name,
schema_name,
coalesce(write_to_table_start, backup_write_to_table_start) as write_to_table_start,
case when event_subtype = 'records_extracted'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the ticket for the query, but records_extracted's extra next_write_to_table_start fallback can resolve to a different write-cycle timestamp than records_modified, splitting rows_extracted/rows_loaded across two rows instead of merging.

Comment thread models/fivetran_platform.yml Resolved
@@ -4,22 +4,59 @@ with log as (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanation a few rows down.

Suggested change
select
*,
row_number() over (partition by sync_id, event_subtype order by created_at desc) as nth_event_subtype_record

@fivetran-catfritz fivetran-catfritz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great! approved.

@fivetran-savage
fivetran-savage merged commit f036dbe into release_branch/v2.6.0 Oct 8, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants