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

fix for events incremental #51

Merged
merged 34 commits into from
Nov 5, 2024
Merged

fix for events incremental #51

merged 34 commits into from
Nov 5, 2024

Conversation

fivetran-reneeli
Copy link
Contributor

@fivetran-reneeli fivetran-reneeli commented Oct 25, 2024

PR Overview

This PR will address the following Issue/Feature:
#45 #48

This PR will result in the following new package version:

v0.13.0

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

Breaking Changes (--full-refresh required after upgrading)

  • Added a field called first_open_or_click_event_at in the iterable__user_campaign model. This timestamp shows the first time a user interacted with a campaign, recording the earliest occurring event out of 'emailOpen', 'emailClick', and 'pushOpen'. (PR #50)
  • Corrected the incremental filter in iterable__events model to now use the created_on date field instead of the created_at timestamp.
    • Previously, this would potentially exclude late-arriving new records from populating in the end models if they had an older created_at value than what was present in the model. Switching to created_on widens the criteria.
  • Updated upstream stg_iterable__user_history model from materializing as a table to a view in order to improve performance.
  • In order to ensure no issues a --full-refresh is required after upgrading.

Under the Hood

  • In addition to using created_on in the incremental logic in iterable__events, we introduced a iterable_lookback_window variable to increase the window for accommodating potential late-arriving records. The default is 7 days prior to the maximum created_on value present in the iterable__events model, but you may customize this by setting the var iterable_lookback_window in your dbt_project.yml. See the Lookback Window section of the README for more details.
  • Added a section in the README about the iterable__event_metrics variable and how to use it to specify which event metrics to pivot out.
  • Removes created_on from the uniqueness test in iterable__events. Uniqueness is now tested solely on unique_event_id, a surrogate key made up of event_id (_fivetran_id in the raw table, which is a Fivetran-created unique identifier derived from hashing campaign_id, created_at, and event_name) and _fivetran_user_id (a Fivetran-created column derived from a hash of user_id and/or email).
  • Modified the event seed data to more accurately represent real-life data, with a unique _fivetran_id for each campaign_id, created_at, and event_name.

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
  • [na] Detailed validation steps have been provided below

Detailed Validation

Please share any and all of your validation steps:

  • see internal ticket thread for validation in addition to the below:
image

This error in consistency_user_campaign is expected due to the addition of a new field first_open_or_click_event_at in this branch.

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

💃

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.

@fivetran-reneeli thanks for working through this. This is looking really good I just have a few comments and suggestions before approving. Also, would you please be able to run the validation tests for this package and share the results in the PR description to confirm there are no unexpected changes between dev and prod.

CHANGELOG.md Show resolved Hide resolved
CHANGELOG.md Outdated
- Adds a field called `first_open_or_click_event_at` in the `iterable__user_campaign` model. This timestamp shows the first time a user interacted with a campaign, recording the earliest occurring event out of 'emailOpen', 'emailClick', and 'pushOpen'. ([PR #50](https://github.com/fivetran/dbt_iterable/pull/50))

## Bug Fix
- Updates the incremental logic in `iterable__events` to use the `created_on` date field instead of the `created_at` timestamp. Previously, this would potentially exclude late-arriving new records from populating in the end models if they had an older `created_at` value than what was present in the model. Switching to `created_on` widens the criteria.
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be listed in the breaking change section

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

README.md Show resolved Hide resolved
packages.yml Outdated
Comment on lines 2 to 7
# version: [">=0.10.0", "<0.11.0"]

- git: https://github.com/fivetran/dbt_iterable_source.git
revision: rm_src_freshness
warn-unpinned: false
Copy link
Contributor

Choose a reason for hiding this comment

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

Reminder to swap before merge

Copy link
Contributor

Choose a reason for hiding this comment

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

Same

models/iterable__events.sql Outdated Show resolved Hide resolved
models/iterable__events.sql Outdated Show resolved Hide resolved
@fivetran-reneeli
Copy link
Contributor Author

Thanks @fivetran-joemarkiewicz this is ready for re-review. I updated with the validation test results. Actually, as expected, there was one test failure on consistency_user_campaign, due to the addition of the new first_open_or_click_event_at field.

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.

@fivetran-reneeli thanks for working through these changes! I have a few comments before this is ready for approval. Let me know if you have questions and once this is ready for final review.

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
models/iterable__events.sql Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated
# dbt_iterable v0.13.0
[PR #51](https://github.com/fivetran/dbt_iterable/pull/51) includes the following updates:

## Breaking Changes
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
## Breaking Changes
## Breaking Changes (`--full-refresh` required after upgrading)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

integration_tests/dbt_project.yml Outdated Show resolved Hide resolved
models/iterable__events.sql Outdated Show resolved Hide resolved
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.

@fivetran-reneeli this is really close, just a few small changes before approval. Let me know once their updated. Thanks!

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
models/iterable.yml Show resolved Hide resolved
fivetran-reneeli and others added 6 commits November 1, 2024 15:56
Co-authored-by: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com>
Co-authored-by: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com>
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.

@fivetran-reneeli changes look good to me! Just a small CHANGELOG edit request and a notice that I made a small README change to close a codeblock. Once the CHANGELOG edit is made this is ready for release review.

CHANGELOG.md Outdated Show resolved Hide resolved
- "emailBounce"
- "inAppClick"
- "pushUninstall"
```
Copy link
Contributor

Choose a reason for hiding this comment

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

This ending codeblock was not captured before. It seems the suggestion didn't like the ending codeblock in a codeblock. I just committed this directly to your branch to address the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh gotcha, thank you!

Co-authored-by: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com>
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

@fivetran-reneeli We should probably have the seed files match on both source and transform packages. Can you update one or the other? Not sure what works best here for more robust testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @fivetran-avinash , I believe they're the same now

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@fivetran-avinash fivetran-avinash left a comment

Choose a reason for hiding this comment

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

@fivetran-reneeli Nice work! A few comments before approval.

CHANGELOG.md Show resolved Hide resolved
Copy link
Contributor

@fivetran-avinash fivetran-avinash left a comment

Choose a reason for hiding this comment

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

@fivetran-reneeli Oops, something went wonky here--had two tabs open with comments/suggestions and submitted both. Let me know if you have any questions.

fivetran-reneeli and others added 5 commits November 4, 2024 17:43
Co-authored-by: Avinash Kunnath <108772760+fivetran-avinash@users.noreply.github.com>
Co-authored-by: Avinash Kunnath <108772760+fivetran-avinash@users.noreply.github.com>
Co-authored-by: Avinash Kunnath <108772760+fivetran-avinash@users.noreply.github.com>
Co-authored-by: Avinash Kunnath <108772760+fivetran-avinash@users.noreply.github.com>
Copy link
Contributor

@fivetran-avinash fivetran-avinash left a comment

Choose a reason for hiding this comment

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

@fivetran-reneeli Ready to merge!

@fivetran-reneeli fivetran-reneeli merged commit e2a6b56 into main Nov 5, 2024
8 checks passed
@fivetran-reneeli fivetran-reneeli deleted the release/v0.13.0 branch November 5, 2024 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants