-
Notifications
You must be signed in to change notification settings - Fork 38
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
Bugfix/join on source relation #95
Conversation
columns: | ||
- name: unique_id | ||
description: Unique identifier of the general ledger line, dependent on `transaction_id`, `transaction_index`, `account_id`, `transaction_type`, `transaction_source`. | ||
description: > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call that the above test is redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is mostly good to go! Just need to update the CHANGELOG --it is definitely a breaking change, good intuition!
- Included `source_relation` in all joins and window functions for models outputting `source_relation`. This is to prevent duplicate records in end models when using the unioning functionality. These updates were in the intermediate models, which flowed to downstream end models: | ||
- `quickbooks__general_ledger` | ||
- `quickbooks__expenses_sales_enhanced` | ||
- In end model `quickbooks__general_ledger`, added `source_relation` as part of the generated surrogate key `unique_id` to prevent duplicate `unique_id`s when using the unioning functionality. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the surrogate key in an end model is a breaking change, so you can highlight that as the top section.
Also the standard "We recommend using dbt run --full-refresh
the next time you run your project."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Updated!
@@ -1,3 +1,18 @@ | |||
# dbt_quickbooks v0.11.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
🚨 Breaking Changes 🚨 (recommend
--full-refresh
)
with the surrogate key line below on Line 2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
packages.yml
Outdated
# - package: fivetran/quickbooks_source | ||
# version: [">=0.9.0", "<0.10.0"] | ||
|
||
- git: https://github.com/fivetran/dbt_quickbooks_source.git |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
standard reminder to revert
- In end model `quickbooks__general_ledger`, added `source_relation` as part of the generated surrogate key `unique_id` to prevent duplicate `unique_id`s when using the unioning functionality. | ||
|
||
## 🚘 Under the Hood | ||
- Updated test from a combination of columns to uniqueness of `unique_id` in `quickbooks__general_ledger`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would add a small note about the ordering in the cash flow statement, just to keep raising awareness for it since it's a relatively new feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. Updated.
coalesce(lag(cash_ending_period) over (partition by account_id, class_id, source_relation order by cash_flow_period),0) as cash_beginning_period, | ||
cash_ending_period - coalesce(lag(cash_ending_period) over (partition by account_id, class_id, source_relation order by cash_flow_period), 0) as cash_net_period | ||
coalesce(lag(cash_ending_period) over (partition by account_id, class_id, source_relation | ||
order by source_relation, cash_flow_period),0) as cash_beginning_period, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch to order it by source relation, missed this when I did it.
PR Overview
This PR will address the following Issue/Feature:
This PR will result in the following new package version:
Please detail what change(s) this PR introduces and any additional information that should be known during the review of this PR:
source_relation
to appropriate joins, window function partitions, and window function order bys.PR Checklist
Basic Validation
Please acknowledge that you have successfully performed the following commands locally:
dbt compileDoes not compile, known issue: [Feature] dbt compile does not work on new schema #83Before marking this PR as "ready for review" the following have been applied:
Detailed Validation
Please acknowledge that the following validation checks have been performed prior to marking this PR as "ready for review":
Standard Updates
Please acknowledge that your PR contains the following standard updates:
dbt Docs
Please acknowledge that after the above were all completed the below were applied to your branch:
If you had to summarize this PR in an emoji, which would it be?
💃