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

Feature/normalized billing model #81

Closed
wants to merge 24 commits into from

Conversation

fivetran-reneeli
Copy link
Contributor

to be completed

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 please see below for my comments and questions. Additionally, there are a few items that are leaving me a bit puzzled when reviewing the resulting data. I schedule some time for later today to discuss in more detail and determine next steps.

Before we meet, it would be great if you can review the questions and make any necessary changes.

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

The result from this code does not look accurate. We are seeing duplicates as a result of the header union and this is resulting in us double counting total amounts.

image

Additionally, using the above header_id as an example, I am confused how the line items achieve the total we are seeing. 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

model has been updated to remove duplicates

Copy link
Contributor

Choose a reason for hiding this comment

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

As of the latest updates there are still some duplicates. I was able to narrow it down to needing parentheses in this where clause to separate the index and not null clauses.

where line_item_index = 1
and discount_amount is not null or tax_amount is not null or fee_amount is not null or refund_amount is not null

models/common_data_models/stripe__line_item_enhanced.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 thanks for making these updates! There were a few final comments I have, but I ended up consolidating and moving the changes to PR #82. This way there is a more clean PR (with less initial review comments) that we can share externally with the community and where they can add their own comments.

We will like close this out, but please review the minor changes between the branches to understand the updates I applied.

Comment on lines +4 to +10
- name: stripe__line_item_enhanced
description: Add description
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- header_id
- line_item_id
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this test is failing at the moment

Copy link
Contributor

Choose a reason for hiding this comment

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

As of the latest updates there are still some duplicates. I was able to narrow it down to needing parentheses in this where clause to separate the index and not null clauses.

where line_item_index = 1
and discount_amount is not null or tax_amount is not null or fee_amount is not null or refund_amount is not null

@fivetran-joemarkiewicz
Copy link
Contributor

Closing this as PR #82 will address this

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