fivetran / fivetran/dbt_netsuite
[Bug] converted amount in transaction details can be NULL in some cases
- Dominant language
- No language data
- Stars
- 57
- Forks
- 42
- Avg merge
- 6d 9h
- Merged PRs (30d)
- 2
Description
### Is there an existing issue for this?
- [X] 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
```shell
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:
```yml
....
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 https://github.com/fivetran/dbt_netsuite/issues/113 I started using the following in my `packages.yml`:
```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](https://github.com/fivetran/dbt_netsuite/files/14886861/netsuite2__transaction_details_202404051706.csv)
### Are you willing to open a PR to help address this issue?
- [ ] Yes.
- [X] Yes, but I will need assistance and will schedule time during our [office hours](https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours) for guidance
- [ ] No.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.