Skip to content

Change intermediate ephemeral models to macros, fix failing test - #33

Open
LewisDavies wants to merge 4 commits into
fivetran:mainfrom
LewisDavies:emphemeral-to-macros
Open

Change intermediate ephemeral models to macros, fix failing test#33
LewisDavies wants to merge 4 commits into
fivetran:mainfrom
LewisDavies:emphemeral-to-macros

Conversation

@LewisDavies

Copy link
Copy Markdown

Pull Request
Are you a current Fivetran customer?
Lewis Davies, Senior Analytics Engineer, Prisma

What change(s) does this PR introduce?

Addresses #32

  • Fixes test failure in mailchimp__members when automations are enabled
  • Aggregates campaign and automation activity by list_id in addition to member_id
  • Consolidates a number of models into macros
    • int_mailchimp__automation_activities_by_* -> agg_automation_activities
    • int_mailchimp__campaign_activities_by_* -> agg_campaign_activities
  • Other minor fixes

Did you update the CHANGELOG?

  • Yes

Does this PR introduce a breaking change?

  • Yes (please provide breaking change details below.)
  • No (please provide an explanation as to how the change is non-breaking below.)

All models will run just as before so I classed it as non-breaking. However, the results in mailchimp__members could be significantly different and should be highlighted.

Did you update the dbt_project.yml files with the version upgrade (please leverage standard semantic versioning)? (In both your main project and integration_tests)

  • Yes

Is this PR in response to a previously created Bug or Feature Request

How did you test the PR changes?

  • CircleCi
  • Local (please provide additional testing details below)

dbt build was successful, previously duplicated rows have been combined.

Select which warehouse(s) were used to test the PR

  • BigQuery
  • Redshift
  • Snowflake
  • Postgres
  • Databricks
  • Other (provide details below)

Provide an emoji that best describes your current mood

😅

Feedback

We are so excited you decided to contribute to the Fivetran community dbt package! We continue to work to improve the packages and would greatly appreciate your feedback on our existing dbt packages or what you'd like to see next.

@LewisDavies LewisDavies changed the title Ephemeral to macros Change intermediate ephemeral models to macros, fix failing test Nov 17, 2022
sum(case when action_type = 'open' then 1 end) as opens,
sum(case when action_type = 'click' then 1 end) as clicks,
count(distinct case when action_type = 'open' then segment_id end) as unique_opens,
count(distinct case when action_type = 'click' then segment_id end) as unique_clicks

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Note that this model was previously counting the distinct segment_ids, whereas the other models were counting member_ids. The new macro fixes this.

), unsubscribes_xf as (

select
campaign_id as automation_email_id,

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The new macro will use automation_email_id instead of campaign_id here. I changed this because it seems like a bug, but happy to be corrected if not.

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.

1 participant