Closed Sunnyinho closed 2 months ago
Hi @Sunnyinho ! Thanks for reaching out.
A few followups that can help us hone in on the source of these duplicate records:
balance_sheet_id
? transaction_details_id
, are there any specific fields that are different between the two? That could help us understand the cause as to why the same record is being brought in more than once. Thanks for all of the additional context!
Hi @Sunnyinho ! Thanks for reaching out.
A few followups that can help us hone in on the source of these duplicate records:
- What is the test error you're seeing in the balance sheet? Is it the
balance_sheet_id
?- When you look at the actual records of the data that are duplicating
transaction_details_id
, are there any specific fields that are different between the two? That could help us understand the cause as to why the same record is being brought in more than once.- For the test error on balance sheet, what are the fields that are differing on the duplicate records?
Thanks for all of the additional context!
Hi @fivetran-avinash ! Thansk for the concern.
balance_sheet_id
.transaction_details_id
same nothing different.Hi @Sunnyinho, @fivetran-avinash is OOO today so I wanted to jump in and help move this forward for the time being. A few additional questions and actions I would like to take to understand this further:
Have you been using this data model for a while and this just unexpectedly failed recently? Or is this the first time you are running the model and are immediately seeing this error? If this is the first time, then we may need to adjust the variables you have defined in your dbt_project.yml
to reflect the state of your Netsuite environment.
Can you confirm that these transactions are not duplicates at the source? When querying transaction_id = 588718
and transaction_line_id = 1
from the raw netsuite.transaction_lines
table, do you only see one record? This will verify if this is a duplicate at the source as opposed to the transformation creating the duplicate.
If you are able to confirm that no duplicates are at the source and you already provided that there are no different fields in the end model then I would want to confirm that these duplicates are not introduced as a result of the incremental logic. Would you be able to run a dbt run -s +netsuite2__transaction_details --full-refresh && dbt test
. This will rebuild the transaction_details table completely without an incremental strategy and will show if this is caused by the incremental logic. If the test passes and there are no longer duplicates, then it is the incremental logic which we will need to update. If not, we will need to dive further.
Do you possible have subsidiaries in your Netsuite environment? This could potentially cause duplicates with your variable setup. I see you have netsuite2__multi_book_accounting_enabled
set to true
. Would you be able to also define netsuite2__using_to_subsidiary
in your dbt_project.yml
to true
as well and run another --full-refresh
. If you are not using subsidiaries then this run will likely fail. If you are using subsidiaries then it might update the end model to account for records that look to be duplicates, but need to be mapped to different subsidiairies.
Let me know if any of the above prove successful. This will help us get to the bottom of where this duplicate record is coming from. Thanks!
Hi @Sunnyinho, @fivetran-avinash is OOO today so I wanted to jump in and help move this forward for the time being. A few additional questions and actions I would like to take to understand this further:
- Have you been using this data model for a while and this just unexpectedly failed recently? Or is this the first time you are running the model and are immediately seeing this error? If this is the first time, then we may need to adjust the variables you have defined in your
dbt_project.yml
to reflect the state of your Netsuite environment.- Can you confirm that these transactions are not duplicates at the source? When querying transaction_id =
588718
and transaction_line_id =1
from the rawnetsuite.transaction_lines
table, do you only see one record? This will verify if this is a duplicate at the source as opposed to the transformation creating the duplicate.- If you are able to confirm that no duplicates are at the source and you already provided that there are no different fields in the end model then I would want to confirm that these duplicates are not introduced as a result of the incremental logic. Would you be able to run a
dbt run -s +netsuite2__transaction_details --full-refresh && dbt test
. This will rebuild the transaction_details table completely without an incremental strategy and will show if this is caused by the incremental logic. If the test passes and there are no longer duplicates, then it is the incremental logic which we will need to update. If not, we will need to dive further.- Do you possible have subsidiaries in your Netsuite environment? This could potentially cause duplicates with your variable setup. I see you have
netsuite2__multi_book_accounting_enabled
set totrue
. Would you be able to also definenetsuite2__using_to_subsidiary
in yourdbt_project.yml
totrue
as well and run another--full-refresh
. If you are not using subsidiaries then this run will likely fail. If you are using subsidiaries then it might update the end model to account for records that look to be duplicates, but need to be mapped to different subsidiairies.Let me know if any of the above prove successful. This will help us get to the bottom of where this duplicate record is coming from. Thanks!
netsuite.transactionlines
do not have duplicate values.--full-refresh
and the errors were resolved.Thank you @fivetran-joemarkiewicz and @fivetran-avinash for assisting me here.
Sounds great, thanks for letting us know! Please don't hesitate to reach back out if duplicates arise again. A full refresh in this scenario will fix any future duplicates, but it would be worthwhile for us to investigate if this is just a one off, or if it is something we need to investigate further within the incremental logic.
Thanks again!
Is there an existing issue for this?
Describe the issue
I am getting test failure in column
transaction_details_id
. There seems to have duplicate rows existing in the model as shown in figure below. The below example is for transaction details modelRelevant error log or model output
Expected behavior
I expect the models to run without any unique errors.
dbt Project configurations
Package versions
What database are you using dbt with?
snowflake
dbt Version
Additional Context
No response
Are you willing to open a PR to help address this issue?