Closed icemtel closed 1 year ago
On the other hand, running with full_statement_version=false
produces the expected behavior (it does not include the formula that caused the issue and there's no join in the compiled code).
Hi @icemtel thanks for raising this issue and I can see how this would cause an issue by not including additional conditions within the join to account for the history modes.
Unfortunately, this package only materializes the sql provided within the fivetran_formula
and fivetran_formula_model
tables synced by your Salesforce connector. The actual sql generation and translation is performed within the connector and by our connector team. Therefore, I will not be able to help resolve the error directly within this package.
However, you may open a support ticket and work directly with our customer support and product teams to have our engineers explore the issue you are seeing and work through a solution.
@fivetran-joemarkiewicz done ✅
Great! I will close this issue as the support ticket was the way to go!
In case anyone stumbles into this - Fivetran support has fixed this - only _fivetran_active
rows are be joined.
Is there an existing issue for this?
Describe the issue
I am using Fivetran in History mode (which enables SCD2 on source tables).
On Task object in salesforce, I have a formula, that basically looks up a field on the task owner:
Owner:User.SomeFieldName__c
.In this case,
salesforce_formula_utils.sfdc_formula_view
compiles into a join ofsalesforce.task
andsalesforce.user
. Because both of the tables are in history mode,user.id
is not unique and join produces a huge table, much larger than the originalsalesforce.task
.Here's the dbt model code I'm using:
Which gets compiled into:
Note: I removed irrelevant columns and formatted for readability.
Relevant error log or model output
No response
Expected behavior
When we join to get extra information, it should never change number of rows.
If the package does not support history mode, this should be clearly labelled. If you want to support history mode as well, then you may need to decide whether to join rows from the past with rows from the past, or with the active ones.
dbt Project configurations
I believe the problem does not depend on my configurations.
Package versions
What database are you using dbt with?
bigquery
dbt Version
1.5.0
Additional Context
No response
Are you willing to open a PR to help address this issue?