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 stripe package with running total model #60

Merged
merged 10 commits into from
Mar 21, 2023

Conversation

fivetran-reneeli
Copy link
Contributor

Are you a current Fivetran customer?

Internal
What change(s) does this PR introduce?

  • Introduces a running_total model to alleviate runtime errors resulting from the daily_overview model exceeding disc capacity upon running.
    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.)

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?

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

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.

@fivetran-reneeli
Copy link
Contributor Author

  • docs regen

@fivetran-reneeli fivetran-reneeli requested review from fivetran-catfritz and removed request for fivetran-joemarkiewicz March 13, 2023 21:08
Copy link
Contributor

@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.

I was able to reproduce the resources exceeded bug by running the main branch, and running the new branch fixed it! So from that aspect I would say it's all working great!

Now that we've solved the issue, and thinking about what a new user might experience, I'm curious why this was moved to an int model? It seems like the final model is a straight select * from only the new int model, and since we're running int models as tables instead of ephemeral, we're generating two identical tables in the output (int_stripe__account_running_total is the same as stripe__daily_overview).

If the reason is to keep the final model code clean, I think all we need to do is add a {{ config(materialized='view') }} to the int_stripe__account_running_total model. I think this could help since the other final models get the benefit of most of the int models being generated as tables, while here we avoid generating duplicate tables in the user's warehouse. I tested it out locally with a full refresh, and it panned out with our internal data, so let me know what you think!

Lastly just some small things. We need to update the installation version in the README, and I also left a few suggestions in in-line comments.

CHANGELOG.md Outdated
# dbt_stripe v0.10.0
[#60](https://github.com/fivetran/dbt_stripe/pull/60) includes the following changes:
## 🚨 Breaking Changes 🚨:
- - Introduces a `int_stripe__account_running_totals` model to alleviate runtime errors resulting from the `stripe__daily_overview` model exceeding disc capacity upon running.
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
- - Introduces a `int_stripe__account_running_totals` model to alleviate runtime errors resulting from the `stripe__daily_overview` model exceeding disc capacity upon running.
- Introduces a `int_stripe__account_running_totals` model to alleviate runtime errors resulting from the `stripe__daily_overview` model exceeding disc capacity upon running.

Just a small edit removing extra bullet.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would help to offer a little explanation for how this change is beneficial. Maybe highlight you shifted logic from the final to the int and maybe add an "under the hood" section. Doesn't have to be too much but maybe something about how/why changing the int models from ephemeral to tables helps with the runs.

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 point, added more to the changelog!

@@ -25,6 +25,7 @@ with date_spine as (
), final as (

select
date_spine.account_id,
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this added to help with the join? I would add the reason for this addition to the changelog.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true, added!


- name: int_stripe__incomplete_charges
description: Each record represents a charge that is incomplete.

Copy link
Contributor

Choose a reason for hiding this comment

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

This was helpful to understand what the different int models do!

@fivetran-reneeli
Copy link
Contributor Author

fivetran-reneeli commented Mar 16, 2023

Thanks for the review @fivetran-catfritz!
-- update: actually, after talking with Joe, I think we should keep the materialization as a table because view would not solve the compute issue. Though i'm working through how to avoid having the duplicate tables, gonna see what happens if we just move what we had in the int model to the final daily overview model

Comment on lines +12 to +13
account_id,
{{ dbt_utils.generate_surrogate_key(['account_id','date_day']) }} as account_daily_id,
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I didn't catch this before, but I'm getting a test failure from

    combination_of_columns:
            - date_day
            - source_relation

Guessing this test needs to be adjusted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, added account_id, forgot I included that field now. Should be good now, thanks for catching!

CHANGELOG.md Outdated
Comment on lines 5 to 9
- Introduces a `int_stripe__account_running_totals` model to alleviate runtime errors resulting from the `stripe__daily_overview` model exceeding disc capacity upon running.
- Add `account_id` in `int_stripe__account_rolling_totals` for use as part of the join in the case where more than 1 `account_id` exists.

## Under the Hood
- The previous logic from `stripe__daily_overview` has been moved to the intermediate `int_stripe__account_running_totals` model to help optimize runtime.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think some of this applies anymore.

Copy link
Contributor

Choose a reason for hiding this comment

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

And the README install sections still needs to be adjusted for the breaking change version.

Copy link
Contributor

@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.

Ran and tested locally. Reviewed updates. LGTM.

@fivetran-reneeli fivetran-reneeli merged commit d7f54bf into main Mar 21, 2023
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