Skip to content

Commit

Permalink
PR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fivetran-avinash committed Nov 13, 2024
1 parent 7ad0e91 commit 87a7d63
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 28 deletions.
25 changes: 19 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ For Netsuite2, [PR #144](https://github.com/fivetran/dbt_netsuite/pull/144) incl

## Breaking Changes (Full refresh required after upgrading)
- Corrected `account_number` field logic for the `netsuite2__balance_sheet` model to match the native Balance Sheet report within Netsuite:
- Income statement accounts should use the account number of the system-generated retained earnings account.
- Cumulative Translation Adjustment (CTA) accounts should use the account number of the system-generated CTA account.
- Income statement accounts should use the account number of the system-generated retained earnings account.
- Cumulative Translation Adjustment (CTA) accounts should use the account number of the system-generated CTA account.
- We modified the logic to ensure the account number is the retained earnings number for income statement accounts in the balance sheet, and CTA rather than null.
- Since this will change the `account_number`, a `--full-refresh` after upgrading will be required.

## New Fields
Expand All @@ -13,23 +14,35 @@ For Netsuite2, [PR #144](https://github.com/fivetran/dbt_netsuite/pull/144) incl

| **Models** | **New Fields** |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| [netsuite2__transaction_details](https://fivetran.github.io/dbt_netsuite/#!/model/model.netsuite.netsuite2__transaction_details) | New fields: `is_reversal`, `reversal_transaction_id`, `reversal_date`, `is_reversal_defer`, `is_eliminate`, `exchange_rate`, `department_full_name`, `subsidiary_full_name`, `subsidiary_currency_symbol`, `transaction_line_amount` <br> New keys: `customer_id`, `vendor_id`, `class_id`, `location_id`, `department_id`, `currency_id`, `parent_account_id`, `vendor_category_id` (if `netsuite2__using_vendor_categories` is enabled) |
| [netsuite2__transaction_details](https://fivetran.github.io/dbt_netsuite/#!/model/model.netsuite.netsuite2__transaction_details) | New fields: `is_reversal`, `reversal_transaction_id`, `reversal_date`, `is_reversal_defer`, `is_eliminate`, `exchange_rate`, `department_full_name`, `subsidiary_full_name`, `subsidiary_currency_symbol`, `transaction_line_amount`, `account_display_name` <br> <br> New keys: `customer_id`, `vendor_id`, `class_id`, `location_id`, `department_id`, `currency_id`, `parent_account_id`, `vendor_category_id` (if `netsuite2__using_vendor_categories` is enabled) |
| [netsuite2__balance_sheet](https://fivetran.github.io/dbt_netsuite/#!/model/model.netsuite.netsuite2__balance_sheet) | New fields: `account_display_name`, `subsidiary_full_name`, `is_account_intercompany`, `is_account_leftside` |
| [netsuite2__income_statement](https://fivetran.github.io/dbt_netsuite/#!/model/model.netsuite.netsuite2__income_statement) | New fields: `account_display_name` <br> New keys: `class_id`, `location_id`, `department_id` |
| [netsuite2__income_statement](https://fivetran.github.io/dbt_netsuite/#!/model/model.netsuite.netsuite2__income_statement) | New fields: `account_display_name` <br> <br> New keys: `class_id`, `location_id`, `department_id` |


> **IMPORTANT**: All of the affected models have pass-through functionality. If you have already been using passthrough column variables to include the newly added fields (without aliases), you **MUST** remove the fields from your passthrough variable configuration in order to avoid duplicate column errors.
## Feature Updates
- You can now leverage passthrough columns in `netsuite2__transaction_details` to bring in additional fields from the `locations` and `subsidiaries` source tables.
- To add additional columns to this model, do so by adding our pass-through column variables `locations_pass_through_columns` and `subsidiaries_pass_through_columns` to your `dbt_project.yml` file:

```yml
vars:
locations_pass_through_columns:
- name: "location_custom_field"
subsidiaries_pass_through_columns:
- name: "sub_field"
alias: "subsidiary_field"
```
- For more details on how to passthrough columns, [please consult our README section](https://github.com/fivetran/dbt_netsuite/blob/main/README.md#passing-through-additional-fields).
## Under the Hood
- Additional consistency tests added for each Netsuite2 end model in order to be used during integration test validations.
- Updated yml documentation with new fields.
## Contributors
- [@jmongerlyra](https://github.com/jmongerlyra) ([PR #136](https://github.com/fivetran/dbt_netsuite/pull/136))
- [@tom-rb](https://github.com/tom-rb) ([PR #124](https://github.com/fivetran/dbt_netsuite/pull/124))
- [@fastbarreto](https://github.com/fastbarreto) ([PR #124](https://github.com/fivetran/dbt_netsuite/pull/124))
# dbt_netsuite v0.14.0
Expand Down Expand Up @@ -105,7 +118,7 @@ For Netsuite2, [PR #114](https://github.com/fivetran/dbt_netsuite/pull/114) incl
- transaction_number
- ❗Note: If you have already added any of these fields as passthrough columns to the `transactions_pass_through_columns`, `transaction_lines_pass_through_columns`, `accounts_pass_through_columns`, or `departments_pass_through_columns` vars, you will need to remove or alias these fields from the var to avoid duplicate column errors.

- Removed the unnecessary reference to `entities` in the `netsuit2__transaction_details` model.
- Removed the unnecessary reference to `entities` in the `netsuite2__transaction_details` model.

## 📝 Documentation Update 📝
- [Updated DECISIONLOG](https://github.com/fivetran/dbt_netsuite/blob/main/DECISIONLOG.md#why-converted-transaction-amounts-are-null-if-they-are-non-posting) with our reasoning for why we don't bring in future-facing transactions and leave the `converted_amount` in transaction details empty. ([#115](https://github.com/fivetran/dbt_netsuite/issues/115))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@
with prod as (
select
1 as join_key,
count(*) as total_prod_pr_count
count(*) as total_balance_sheet_prod_rows
from {{ target.schema }}_netsuite_prod.netsuite2__balance_sheet
group by 1
),

dev as (
select
1 as join_key,
count(*) as total_dev_pr_count
count(*) as total_balance_sheet_dev_rows
from {{ target.schema }}_netsuite_dev.netsuite2__balance_sheet
group by 1
),

final as (
select
total_prod_pr_count,
total_dev_pr_count
total_balance_sheet_prod_rows,
total_balance_sheet_dev_rows
from prod
full outer join dev
on dev.join_key = prod.join_key
)

select *
from final
where total_dev_pr_count != total_prod_pr_count
where total_balance_sheet_prod_rows != total_balance_sheet_dev_rows
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ with prod as (

dev as (
select *
except(account_display_name, class_id, location_id, department_id)
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.
from {{ target.schema }}_netsuite_dev.netsuite2__income_statement
),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@
with prod as (
select
1 as join_key,
count(*) as total_prod_pr_count
count(*) as total_income_statement_prod_rows
from {{ target.schema }}_netsuite_prod.netsuite2__income_statement
group by 1
),

dev as (
select
1 as join_key,
count(*) as total_dev_pr_count
count(*) as total_income_statement_dev_rows
from {{ target.schema }}_netsuite_dev.netsuite2__income_statement
group by 1
),

final as (
select
total_prod_pr_count,
total_dev_pr_count
total_income_statement_prod_rows,
total_income_statement_dev_rows
from prod
full outer join dev
on dev.join_key = prod.join_key
)

select *
from final
where total_dev_pr_count != total_prod_pr_count
where total_income_statement_prod_rows != total_income_statement_dev_rows
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +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)
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.
from {{ target.schema }}_netsuite_dev.netsuite2__transaction_details
),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@
with prod as (
select
1 as join_key,
count(*) as total_prod_pr_count
count(*) as total_transaction_detail_prod_rows
from {{ target.schema }}_netsuite_prod.netsuite2__transaction_details
group by 1
),

dev as (
select
1 as join_key,
count(*) as total_dev_pr_count
count(*) as total_transaction_detail_dev_rows
from {{ target.schema }}_netsuite_dev.netsuite2__transaction_details
group by 1
),

final as (
select
total_prod_pr_count,
total_dev_pr_count
total_transaction_detail_prod_rows,
total_transaction_detail_dev_rows
from prod
full outer join dev
on dev.join_key = prod.join_key
)

select *
from final
where total_dev_pr_count != total_prod_pr_count
where total_transaction_detail_prod_rows != total_transaction_detail_dev_rows
6 changes: 3 additions & 3 deletions models/netsuite2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ models:
- name: account_number
description: Account number associated with the account.
- name: is_account_intercompany
description: Boolean indicating if a general ledger account recording transactions between subsidiaries of the same organization.
description: Boolean indicating if a general ledger account is recording transactions between subsidiaries of the same organization.
- name: is_account_leftside
description: Boolean indicating if account has a native debit balance.
- name: converted_amount
Expand Down Expand Up @@ -227,7 +227,7 @@ models:
- name: is_transaction_intercompany_adjustment
description: Boolean field, indicating whether or not the transaction is an intercompany transaction or an advanced intercompany transaction.
- name: is_reversal
description: Boolean indicating line is reversal.
description: Boolean indicating if line is reversal.
- name: reversal_transaction_id
description: Transaction id of the counterparty in a reversing pair.
- name: reversal_date
Expand Down Expand Up @@ -265,7 +265,7 @@ models:
- name: is_account_intercompany
description: Boolean field indicating whether or not the account type name includes 'intercompany'.
- name: is_eliminate
description: Boolean indicating line will auto-eliminate.
description: Boolean indicating if line will auto-eliminate.
- name: parent_account_id
description: Unique identifier of the parent account, if parent account relationship exists. Otherwise, the identifier of the account.
- name: parent_account_name
Expand Down

0 comments on commit 87a7d63

Please sign in to comment.