-
Notifications
You must be signed in to change notification settings - Fork 35
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
Release v0.15.0: Bug fixes for account numbers, addition of commonly used fields and foreign keys #144
Conversation
…columns (#136) * Fix account_number Fix account_number for system generated accounts. * Add subsidiaries pass through columns * Add additional fields * Fix is_account_intercompany on balance_sheet * Fix account_number --------- Co-authored-by: Avinash Kunnath <108772760+fivetran-avinash@users.noreply.github.com>
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.
@fivetran-avinash A few change requests and questions but this is looking good! Additionally, would you be able to inspect the results of the validation tests (particularly the amount and count tests). When viewing the results and removing the final where
clause I find that some of the results are null
and still passing the condition. Could you double check and see if anything needs to be adjusted on the test side or if some code changes are required. Thanks!
integration_tests/tests/consistency/consistency_balance_sheet_count.sql
Outdated
Show resolved
Hide resolved
integration_tests/tests/consistency/consistency_income_statement.sql
Outdated
Show resolved
Hide resolved
integration_tests/tests/consistency/consistency_income_statement_count.sql
Outdated
Show resolved
Hide resolved
integration_tests/tests/consistency/consistency_transaction_details.sql
Outdated
Show resolved
Hide resolved
integration_tests/tests/consistency/consistency_transaction_details_count.sql
Outdated
Show resolved
Hide resolved
@@ -106,10 +114,17 @@ balance_sheet as ( | |||
else accounts.account_id | |||
end as account_id, | |||
case | |||
when not accounts.is_balancesheet then null | |||
when not accounts.is_balancesheet then (select accounts.account_number from accounts where lower(accounts.special_account_type_id) = 'retearnings' limit 1) |
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.
Can you provide a brief explanation of this subquery. I see it's used in a few other places as well.
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.
Via @jmongerlyra in the issue:
"The account number for income statement and CTA accounts in the balance sheet model is currently set to NULL. This is not how it is presented on the native Balance Sheet report in NetSuite.
Income statement accounts should use the account number of the system-generated retained earnings account. CTA should use the account number of the system-generated CTA account."
This logic ensures that the account number pulls the retained earnings or CTA account number rather than generating null values. I added some details in the CHANGELOG to call this out.
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.
This makes sense to me. Thanks for sharing this and calling it out in the CHANGELOG.
case | ||
when lower(accounts.account_type_id) in ('income', 'othincome') then -transaction_lines.netamount | ||
else transaction_lines.netamount | ||
end as transaction_line_amount |
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.
Can you explain this addition a bit more? Will there ever be a scenario where this does not match the transaction_amount
?
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.
This is a new field from the transaction_lines
source table, netamount
. transaction_amount
is being derived from amount
in transaction_lines
.
According to @jmongerlyra , netamount
is the net amount of the transaction line, which is the actual amount entered when it's in a currency other than the functional currency of the subsidiary. Whereas amount
is the total amount. I believe these values can be different.
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.
@fivetran-joemarkiewicz Pending Buildkite, this is ready for re-review.
Regarding your concern around null test results, I did see this issue in consistency_balance_sheet_amounts
because the base of this test is account ids. However, account_ids
can be null if accounts have a false is_balancesheet value
. So we have a null base that is throwing off the full outer join logic.
For the time being, I created a dummy value for these null cases, and this seemed to prevent the null fanout. But happy to workshop more elegant solutions here if we feel this is a bit hacky.
I didn't see any issues with the other amount test, as it uses a date_day
as a base and there are no null transaction dates in our production data. The counts are just comparing row counts, and nothing threw a red flag in terms of these tests.
@@ -5,11 +5,13 @@ | |||
|
|||
with prod as ( | |||
select * | |||
except(account_type_name, account_number) --this test has been modified for the purposes of validating this PR. Remove this line before merging. |
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.
except(account_type_name, account_number) --this test has been modified for the purposes of validating this PR. Remove this line before merging. |
from {{ target.schema }}_netsuite_prod.netsuite2__balance_sheet | ||
), | ||
|
||
dev as ( | ||
select * | ||
except(subsidiary_full_name, account_display_name, is_account_intercompany, is_account_leftside, account_type_name, account_number) --this test has been modified for the purposes of validating this PR.Remove this line before merging. |
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.
except(subsidiary_full_name, account_display_name, is_account_intercompany, is_account_leftside, account_type_name, account_number) --this test has been modified for the purposes of validating this PR.Remove this line before merging. |
@@ -10,6 +10,7 @@ with prod as ( | |||
|
|||
dev as ( | |||
select * | |||
except(account_display_name, class_id, location_id, department_id)--this test has been modified for the purposes of validating this PR. Remove this line before merging. |
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.
except(account_display_name, class_id, location_id, department_id)--this test has been modified for the purposes of validating this PR. Remove this line before merging. |
@@ -10,6 +10,7 @@ with prod as ( | |||
|
|||
dev as ( | |||
select * | |||
except(is_reversal, reversal_transaction_id, reversal_date, is_reversal_defer, account_display_name, is_eliminate, parent_account_id, customer_id, class_id, location_id, vendor_id, vendor_category_id, currency_id, exchange_rate, department_full_name, subsidiary_full_name, subsidiary_currency_symbol, transaction_line_amount) --this test has been modified for the purposes of validating this PR. Remove this line before merging. |
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.
except(is_reversal, reversal_transaction_id, reversal_date, is_reversal_defer, account_display_name, is_eliminate, parent_account_id, customer_id, class_id, location_id, vendor_id, vendor_category_id, currency_id, exchange_rate, department_full_name, subsidiary_full_name, subsidiary_currency_symbol, transaction_line_amount) --this test has been modified for the purposes of validating this PR. Remove this line before merging. |
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.
reminder to remove these from the tests
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.
@fivetran-avinash thanks for addressing all of my comments. My only remaining comment is that it would be great to add a validation test for the income statement amounts to be used in future reviews.
That is no reason to block this approval and move to release review though. This looks good to me!
@fivetran-joemarkiewicz Good callout! Actually didn't take too long to create a robust income statement amount consistency test and get it to pass! Moving to release review now. |
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.
Approved with just a minor update suggestion!
@@ -10,6 +10,7 @@ with prod as ( | |||
|
|||
dev as ( | |||
select * | |||
except(is_reversal, reversal_transaction_id, reversal_date, is_reversal_defer, account_display_name, is_eliminate, parent_account_id, customer_id, class_id, location_id, vendor_id, vendor_category_id, currency_id, exchange_rate, department_full_name, subsidiary_full_name, subsidiary_currency_symbol, transaction_line_amount) --this test has been modified for the purposes of validating this PR. Remove this line before merging. |
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.
reminder to remove these from the tests
PR Overview
This PR will address the following Issue/Feature: [#67], [#135], [#141]
This PR will result in the following new package version: v0.15.0
Please provide the finalized CHANGELOG entry which details the relevant changes included in this PR:
Breaking Changes (Full refresh required after upgrading)
account_number
field logic for thenetsuite2__balance_sheet
model to match the native Balance Sheet report within Netsuite:account_number
, a--full-refresh
after upgrading will be required.More Breaking Changes: New Fields
netsuite2__balance_sheet
subsidiary_full_name
: Full hierarchical name of the subsidiary.is_account_intercompany
: Boolean indicating if a general ledger account recording transactions between subsidiaries of the same organization.is_account_leftside
: Boolean indicating if account has a native debit balance.netsuite2__balance_sheet
,netsuite2__income_statement
,netsuite2__transaction_details
account_display_name
: Account name without number or hierarchy.netsuite2__transaction_details
is_reversal
: Boolean indicating line is reversal.reversal_transaction_id
: Transaction id of the counterparty in a reversing pair.reversal_date
: Transaction date of the counterparty in a reversing pair.is_reversal_defer
: Boolean indicating reversal deferral.is_eliminate
: Boolean indicating line will auto-eliminate.exchange_rate
: Exchange rate used on the transaction.department_full_name
: Full hierarchical name of the department.subsidiary_full_name
: Full hierarchical name of the subsidiary.subsidiary_currency_symbol
: Currency of the subsidiary.transaction_line_amount
: Net amount of the transaction line. This is the actual amount entered when it's in a currency other than the functional currency of the subsidiary.netsuite2__income_statement
:class_id
,location_id
,department_id
netsuite2__transaction_details
:customer_id
,vendor_id
,class_id
,location_id
,department_id
,currency_id
,parent_account_id
,vendor_category_id
(ifnetsuite2__using_vendor_categories
is enabled)Feature Updates
netsuite2__transaction_details
to bring in additional fields from thelocations
andsubsidiaries
source tables. Make sure you aren't bringing inUnder the Hood
PR Checklist
Basic Validation
Please acknowledge that you have successfully performed the following commands locally:
Before marking this PR as "ready for review" the following have been applied:
Detailed Validation
Please share any and all of your validation steps:
Able to test and validate there were no major changes on amounts by transaction ids.
Able to run successfully that passthrough columns bring through new columns.
Validation through internal data.
If you had to summarize this PR in an emoji, which would it be?
💸