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

Bugfix/v0.12.5 #124

Merged
merged 20 commits into from
May 15, 2024
Merged

Bugfix/v0.12.5 #124

merged 20 commits into from
May 15, 2024

Conversation

fivetran-reneeli
Copy link
Contributor

@fivetran-reneeli fivetran-reneeli commented May 3, 2024

PR Overview

This PR will address the following Issue/Feature:
#122
#80
Zendesk ticket 200711

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 🚨:

PR #124 includes the following updates:

Bug Fixes

  • Updates the int_quickbooks__invoice_join and downstream quickbooks__ap_ar_enhanced models to include the using_payments config. Previously, this model would fail if the payment or the payment_line source tables did not exist.
  • Requires quickbooks__ap_ar_enhanced to have using_payments enabled in order to run, otherwise the model is limited in its use.
  • Updates the quickbooks__profit_and_loss model to include both period_first_day and period_last_day. This allows users to have greater optionality in choosing which date to aggregate records upon.
  • Updates the logic for amount in int_quickbooks__invoice_double_entry to use invoice.total_amount only on the condition there exists bundle_id and total_amount = 0, otherwise use invoice_lines.amount. This avoids double counting when aggregating invoice_line items and accounts for the edge cases where a bundle_id is involved.

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

Detailed Validation

Please share any and all of your validation steps:

  using_payment: true
  using_bill: true
  using_invoice: true

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

💃

@fivetran-reneeli fivetran-reneeli self-assigned this May 3, 2024
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 great job working through these changes and confirming the updates work for the customer. I do have a few comments and suggestions before approving. Let me know if you have any questions. Thanks!

dbt_project.yml Show resolved Hide resolved
models/quickbooks__profit_and_loss.sql Outdated Show resolved Hide resolved
models/quickbooks__ap_ar_enhanced.sql Show resolved Hide resolved
@@ -21,6 +21,7 @@ estimates as (
),
{% endif %}

{% if var('using_payment', True) %}
Copy link
Contributor

Choose a reason for hiding this comment

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

The int_quickbooks__invoice_join model is only used as an upstream model in the quickbooks__ap_ar_enhanced model.

image

Additionally, this model is not materialized and is ephemeral in our config.

Because of this, would it make more sense to take the same approach you took for the quickbooks__ap_ar_enhanced model and just entirely disable this model if payments are disabled? This would allow us to reduce the code changes and not run code in the customers warehouse if it is not entirely necessary.

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 I think this is a good point-- There's no point in running int_quickbooks__invoice_join if the downstream quickbooks__ap_ar_enhanced is disabled. I added the same configs (invoice and payments enabled) to this model.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks great! Technically, you can revert your changes from before where the specific {% if var('using_payment', True) %} conditionals are included. Now that this model won't be run there is no need for these added conditionals.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can safely use the previous code from this model, but only make the following change and that should return the desired results

{{ config(enabled=var('using_invoice') and var('using_payment', True)) }}

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 good point-- updated to revert and remove those original changes

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
fivetran-reneeli and others added 2 commits May 14, 2024 13:41
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 great work on this PR! I have two final suggestions, but they don't need to hold back the approval. Once you make those final changes and regen the docs, you can open this for release review!

Let me know if you have any questions. Thanks!

CHANGELOG.md Outdated Show resolved Hide resolved
@@ -21,6 +21,7 @@ estimates as (
),
{% endif %}

{% if var('using_payment', True) %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks great! Technically, you can revert your changes from before where the specific {% if var('using_payment', True) %} conditionals are included. Now that this model won't be run there is no need for these added conditionals.

@@ -21,6 +21,7 @@ estimates as (
),
{% endif %}

{% if var('using_payment', True) %}
Copy link
Contributor

Choose a reason for hiding this comment

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

You can safely use the previous code from this model, but only make the following change and that should return the desired results

{{ config(enabled=var('using_invoice') and var('using_payment', True)) }}

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.

See the above comment for approval notes

fivetran-reneeli and others added 3 commits May 14, 2024 17:36
Co-authored-by: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com>
Copy link
Contributor

@fivetran-jamie fivetran-jamie left a comment

Choose a reason for hiding this comment

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

looks great! just some doc-related comments around deprecating calendar_date

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated
- Corrects the misspelled `customer_vendor_webiste` to `customer_vendor_website` in `quickbooks__ap_ar_enhanced`.

## Bug Fixes
- Updates the [quickbooks__profit_and_loss](https://github.com/fivetran/dbt_quickbooks/blob/main/models/quickbooks__profit_and_loss.sql) and [quickbooks__balance_sheet](https://github.com/fivetran/dbt_quickbooks/blob/main/models/quickbooks__balance_sheet.sql) models to include both `period_first_day` and `period_last_day`. This allows users to have greater flexibility in choosing which date to aggregate records upon.
Copy link
Contributor

Choose a reason for hiding this comment

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

is this a bug fix or feature update?

Copy link
Contributor

Choose a reason for hiding this comment

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

also are we intending on deprecating calendar_date? if so, maybe we should mention it here (and maybe in calendar_date's yml description) and recommend using one of the new fields instead

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-jamie , moved that to its own feature update section and added the deprecation notice for calendar_date:

"This is slated to be deprecated, and the fields period_first_day and period_last_day are both offered as replacements, depending on how your company performs their financial reporting."

Copy link
Contributor

Choose a reason for hiding this comment

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

that sounds great! do you have the feature_update section added locally?

@@ -8,6 +8,8 @@ with general_ledger_by_period as (
final as (
select
period_first_day as calendar_date,
period_first_day,
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we should note here as well in a comment that calendar_date will be deprecated

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

@@ -8,6 +8,8 @@ with general_ledger_by_period as (
final as (
select
period_first_day as calendar_date,
period_first_day,
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

fivetran-reneeli and others added 2 commits May 15, 2024 10:58
Co-authored-by: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com>
@fivetran-reneeli fivetran-reneeli merged commit a10932c into main May 15, 2024
8 checks passed
@fivetran-reneeli fivetran-reneeli deleted the bugfix/v0.12.5 branch May 15, 2024 18:56
@fivetran-reneeli fivetran-reneeli linked an issue May 15, 2024 that may be closed by this pull request
4 tasks
@@ -7,7 +7,7 @@ with general_ledger_by_period as (

final as (
select
period_first_day as calendar_date,
period_first_day as calendar_date, -- Slated to be deprecated; we recommend using `period_first_day` or `period_last_day`
Copy link

Choose a reason for hiding this comment

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

I just noticed that period_first_day and period_last_day aren't included in the quickbooks__profit_and_loss SQL even though the yml definition says the columns exist.

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 @sbrudz you're right, this was mistakenly removed during the PR. We will have this fix ready first thing next week!

Copy link

Choose a reason for hiding this comment

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

Thank you!

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 @sbrudz for catching this, the package has been updated!

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