Skip to content

[Bug] converted amount in transaction details can be NULL in some cases #115

@FrankTub

Description

@FrankTub

Is there an existing issue for this?

  • I have searched the existing issues

Describe the issue

In netsuite2__transaction_details the column converted_amount can be NULL, while the transaction_amount column is not empty. I guess this has to do with the way an exchange rate is determined in your code.

Our default currency is EUR. I have taken a look at the code that was used to determine the correct exchange rate but did not fully comprehend the logic behind it. The expected output for converted_amount when the currency is our default currency would be that the exchange rate would be 1.

Relevant error log or model output

Ran query:


select transaction_id , transaction_line_id , transaction_number, transaction_status, account_id , account_number , currency_symbol , converted_amount , transaction_amount , is_main_line , is_tax_line 
from transformations.netsuite2__transaction_details
where converted_amount is null
;


And this results in 719 rows, where the other 2000 rows all have a converted_amount as expected.

Expected behavior

The column netsuite2__transaction_details.converted_amount should never be NULL.

dbt Project configurations

Don't think it is relevant here, but this is what we have configured:

....

vars:
  netsuite_data_model: netsuite2
  netsuite_schema: netsuite_suiteanalytics
  netsuite2__using_vendor_categories: false
  netsuite2__using_jobs: false

  balance_sheet_transaction_detail_columns: ['bq_contract_id', 'amount_excl_vat', 'transaction_type']
  income_statement_transaction_detail_columns: ['bq_contract_id', 'amount_excl_vat', 'transaction_type']

  transactions_pass_through_columns:
      - name: "transaction_due_on"
        transform_sql: "cast(duedate at time zone 'UTC' as date)"
      - name: "transaction_on"
        transform_sql: "cast(trandate at time zone 'UTC' as date)"
      - name: "transaction_closed_on"
        transform_sql: "cast(closedate at time zone 'UTC' as date)"
  transaction_lines_pass_through_columns:
      - name: "custcol_bq_contract"
        alias: "bq_contract_id"
      - name: "foreignamount"
        alias: "amount_excl_vat"
...
models:
  netsuite_source:
    +schema: base
  netsuite:
    +schema: transformations

Package versions

Basicly I'm using 0.12.0, but due to #113 I started using the following in my packages.yml:

packages:
  - git: "https://github.com/FrankTub/dbt_netsuite"
    revision: feature/transaction-line-fields

What database are you using dbt with?

postgres

dbt Version

1.7.11

Additional Context

Example output of my query:
netsuite2__transaction_details_202404051706.csv

Are you willing to open a PR to help address this issue?

  • Yes.
  • Yes, but I will need assistance and will schedule time during our office hours for guidance
  • No.

Metadata

Metadata

Labels

priority:p4Affects few users; pick up when availablestatus:in_progressCurrently being worked ontype:enhancementNew functionality or enhancementupdate_type:documentationPrimary focus requires documentation updates

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions