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/add department #82

Merged
merged 12 commits into from
Apr 19, 2023

Conversation

fivetran-joemarkiewicz
Copy link
Contributor

@fivetran-joemarkiewicz fivetran-joemarkiewicz commented Apr 10, 2023

PR Overview

This PR will address the following Issue/Feature: PR #63 slight modifications to account for merge conlicts

This PR will result in the following new package version: v0.9.0

While this won't particularly be a breaking change, this will be integrated with other breaking changes.

Please detail what change(s) this PR introduces and any additional information that should be known during the review of this PR:

This PR includes the department_id into the double entry models and also the downstream General Ledger Model. The department_id was added at the header (not line item) level for all double entry models with the exception of transfer, payment, credit_card_payment (no department_id included in the header or line item for the previous three models), and the journal entry (department_id only existed in the line item).

Since the initial customer PR did not include the department_id in the quickbooks__general_ledger_by_period and other downstream models, I intentionally did not include this field in the other downstream models. Reason being is because during the introduction of the class_id in a previous PR we found that the partitioning would cause duplicate records following the aggregation since the line item level is sometimes used to produce the foreign key. In this case, since journal_entry uses the line item level, this will result in duplicate records for a single account with the department_id in the aggregated downstream models. As such, I would prefer to leave this field out of the downstream models for the time being.

However, if customers show desire to include this field in the aggregated end models then we can move forward with that approach and look to PR #77 for the updates needed to ensure the duplicates are accounted for.

PR Checklist

Basic Validation

Please acknowledge that you have successfully performed the following commands locally:

  • dbt compile
    • dbt compile is currently not passing on a new schema. This is due to the need for the quickbooks__general_ledger model needing to be generated prior to the date spine. There is no easy way around this since we cannot look up this information at the source level. It is out of scope to address in this PR, but a feature request (Issue [Feature] dbt compile does not work on new schema #83) to explore this further has been opened to investigate on its own time.
  • dbt run –full-refresh
  • dbt run
  • dbt test
  • dbt run –vars (if applicable)

Before marking this PR as “ready for review” the following have been applied:

  • The appropriate issue has been linked and tagged
  • You are assigned to the corresponding issue and this PR
  • BuildKite integration tests are passing

Detailed Validation

Please acknowledge that the following validation checks have been performed prior to marking this PR as “ready for review”:

  • You have validated these changes and assure this PR will address the respective Issue/Feature.
  • You are reasonably confident these changes will not impact any other components of this package or any dependent packages.
  • You have provided details below around the validation steps performed to gain confidence in these changes.

This was validated to ensure there were no fan out cases similar to what we experienced with the addition of the class_id. I was able to test the current live version (v0.8.1) and the changes from this update branch locally with data and found that no results returned (expected). This is evidence that the department_id does not need to be included in the partitions and will aggregate without risk of fan out or miscalculation. This mainly did not cause duplicates as we do not account for the department_id in the aggregated end models. See the query used to validate this below.

with changes as (
  select 
    'changes' as source,
    period_first_day,
    account_id,
    class_id,
    period_net_change,
    period_beginning_balance,
    period_ending_balance
  from zz_dbt_joe_quickbooks_department.quickbooks__general_ledger_by_period
),

current_version as (
  select 
    'current' as source,
    period_first_day,
    account_id,
    class_id,
    period_net_change,
    period_beginning_balance,
    period_ending_balance
  from zz_dbt_joe_quickbooks.quickbooks__general_ledger_by_period
)

select 
  coalesce(current_version.period_first_day, changes.period_first_day) as period_first_version,
  coalesce(current_version.account_id, changes.account_id) as account_id,
  coalesce(current_version.class_id, changes.class_id) as class_id,
  round(current_version.period_net_change,2) as current_net_change,
  round(changes.period_net_change,2) as updates_net_change,
  round(current_version.period_beginning_balance,2) as current_period_beginning_balance,
  round(changes.period_beginning_balance,2) as updates_period_beginning_balance,
  round(current_version.period_ending_balance,2) as current_period_ending_balance,
  round(changes.period_ending_balance,2) as updates_period_ending_balance
from current_version
full outer join changes
  on current_version.account_id = changes.account_id
    and coalesce(current_version.class_id,'0') = coalesce(changes.class_id,'0')
    and current_version.period_first_day = changes.period_first_day
where round(current_version.period_net_change,2) != round(changes.period_net_change,2)
  and round(current_version.period_beginning_balance,2) != round(changes.period_beginning_balance,2)
  and round(current_version.period_ending_balance,2) != round(changes.period_ending_balance,2)

image

Standard Updates

Please acknowledge that your PR contains the following standard updates:

  • Package versioning has been appropriately indexed in the following locations:
    • indexed within dbt_project.yml
    • indexed within integration_tests/dbt_project.yml
  • CHANGELOG has individual entries for each respective change in this PR
  • README updates have been applied (if applicable)
  • DECISIONLOG updates have been updated (if applicable)
  • Appropriate yml documentation has been added (if applicable)

dbt Docs

Please acknowledge that after the above were all completed the below were applied to your branch:

  • docs were regenerated (unless this PR does not include any code or yml updates)

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

🏬

@fivetran-joemarkiewicz fivetran-joemarkiewicz marked this pull request as ready for review April 12, 2023 21:45
@fivetran-joemarkiewicz fivetran-joemarkiewicz mentioned this pull request Apr 12, 2023
8 tasks
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.

Just need to make some minor updates but should be good to go after the updates!

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@@ -1,11 +1,11 @@
id,_fivetran_deleted,_fivetran_synced,balance,created_at,currency_id,department_id,doc_number,due_date,exchange_rate,global_tax_calculation,home_balance,payable_account_id,private_note,sales_term_id,sync_token,total_amount,transaction_date,updated_at,vendor_id
Copy link
Contributor

Choose a reason for hiding this comment

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

Already taken care of, but just for reference, commented that source seed files should also be updated but taken care of!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Source updated! Thanks for calling out.

@@ -1,3 +1,6 @@
packages:
- package: fivetran/quickbooks_source
version: [">=0.7.0", "<0.8.0"]
Copy link
Contributor

Choose a reason for hiding this comment

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

going to be some merge conflicts here regardless, but I imagine they'll be resolved on the merged branch =P

CHANGELOG.md Outdated Show resolved Hide resolved
@fivetran-joemarkiewicz fivetran-joemarkiewicz merged commit ebc3f58 into release/v0.9.0 Apr 19, 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.

3 participants