Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update api_calls to extract_summary #138

Merged
merged 14 commits into from
Nov 21, 2024
Merged

Conversation

fivetran-catfritz
Copy link
Contributor

@fivetran-catfritz fivetran-catfritz commented Nov 18, 2024

PR Overview

This PR will address the following Issue/Feature:

This PR will result in the following new package version:

  • v1.9.1 no schema change

Please provide the finalized CHANGELOG entry which details the relevant changes included in this PR:

Features

  • For Fivetran Platform Connectors created after November 2024, Fivetran has deprecated the api_call event in favor of extract_summary (release notes).
  • Accordingly, we have updated the fivetran_platform__connector_daily_events model to support the new extract_summary event while maintaining backward compatibility with the api_call event for connectors created before November 2024.

Under the Hood

  • Replaced the deprecated dbt.current_timestamp_backcompat() function with dbt.current_timestamp() to ensure all timestamps are captured in UTC.

PR Checklist

Basic Validation

Please acknowledge that you have successfully performed the following commands locally:

  • dbt run –full-refresh && dbt test
  • dbt run (if incremental models are present) && dbt test

Before marking this PR as "ready for review" the following have been applied:

  • The appropriate issue has been linked, tagged, and properly assigned
  • All necessary documentation and version upgrades have been applied
  • docs were regenerated (unless this PR does not include any code or yml updates)
  • BuildKite integration tests are passing
  • Detailed validation steps have been provided below

Detailed Validation

Please share any and all of your validation steps:

  • Updated seed data to make sure the values for extract_summary are pulled through.

    • D7UqnKYn6OT04HkUcPNjXA95qqp=,2024-11-18 16:26:29.719,2024-11-19 20:30:53.878,aft_gleeful,INFO,"{""total_queries"":15,""total_rows"":4810}",extract_summary,,456abc
      h7UqnKYn6OT04HkUcPNjXA95qlp=,2024-11-19 16:26:29.719,2024-11-19 20:30:53.878,aft_gleeful,INFO,"{""total_queries"":5,""total_rows"":4810}",extract_summary,,456abc
    • Screenshot 2024-11-19 at 1 22 46 PM
  • Consistency tests pass

    • Screenshot 2024-11-19 at 1 21 40 PM

If you had to summarize this PR in an emoji, which would it be?

💃

@fivetran-catfritz fivetran-catfritz self-assigned this Nov 18, 2024
Copy link
Contributor

@fivetran-jamie fivetran-jamie left a comment

Choose a reason for hiding this comment

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

looks great to me! just minor requests but this is approved

@@ -63,7 +80,7 @@ connector_event_counts as (

spine as (

{% if execute %}
{% if execute and flags.WHICH in ('run', 'build') %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you note in the "under the hood" section of the CHANGELOG that this release supports dbt compile on a new schema before dbt run due to the above change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, updated!

@@ -78,7 +95,7 @@ spine as (
{{ fivetran_utils.fivetran_date_spine(
datepart = "day",
start_date = "cast('" ~ first_date[0:10] ~ "' as date)",
end_date = dbt.dateadd("week", 1, dbt.date_trunc('day', dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp()))
end_date = dbt.dateadd("week", 1, dbt.date_trunc('day', dbt.current_timestamp()))
Copy link
Contributor

Choose a reason for hiding this comment

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

super duper minor -- would you mind updating the parallel line in the row_count__connector_daily_events test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. updated!

Copy link
Contributor Author

@fivetran-catfritz fivetran-catfritz left a comment

Choose a reason for hiding this comment

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

Thanks @fivetran-jamie made the updates!

@@ -78,7 +95,7 @@ spine as (
{{ fivetran_utils.fivetran_date_spine(
datepart = "day",
start_date = "cast('" ~ first_date[0:10] ~ "' as date)",
end_date = dbt.dateadd("week", 1, dbt.date_trunc('day', dbt.current_timestamp_backcompat() if target.type != 'sqlserver' else dbt.current_timestamp()))
end_date = dbt.dateadd("week", 1, dbt.date_trunc('day', dbt.current_timestamp()))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. updated!

@@ -63,7 +80,7 @@ connector_event_counts as (

spine as (

{% if execute %}
{% if execute and flags.WHICH in ('run', 'build') %}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, updated!

Copy link
Contributor

@fivetran-joemarkiewicz fivetran-joemarkiewicz left a comment

Choose a reason for hiding this comment

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

LGTM with one small question/request around a comment from a previous update and if we should change it.

Comment on lines +1 to +3
# Fivetran Platform dbt Package ([Docs](https://fivetran.github.io/dbt_fivetran_log/))

<p align="left">
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for making this change as well!

Comment on lines 21 to 23
where event_subtype in (
'api_call', 'extract_summary', 'records_modified', 'create_table', 'alter_table',
'create_schema', 'change_schema_config') -- all schema changes
Copy link
Contributor

Choose a reason for hiding this comment

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

Small note that I know isn't related to your changes directly, but is it accurate to have the comment all schema changes in this filter? For example, api_call and extract_summary are not inherently schema changes and we make this clear in the below case when statement where we categorize perform the following:

when event_subtype in ('create_table', 'alter_table', 'create_schema', 'change_schema_config') then 'schema_change'

If this is true, can we change this comment to be all relevant event subtypes or something along those lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense--updated!

Copy link
Contributor Author

@fivetran-catfritz fivetran-catfritz left a comment

Choose a reason for hiding this comment

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

Updated.

@fivetran-catfritz fivetran-catfritz merged commit 244f2c5 into main Nov 21, 2024
10 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
3 participants