fivetran / dbt_salesforce_formula_utils

Package containing dbt macros to help generate salesforce formula fields synced from Fivetran.
https://fivetran.github.io/dbt_salesforce_formula_utils/
Apache License 2.0
16 stars 18 forks source link

[Bug] DBT Run- Duplicate Column Name Error - Salesforce to Snowflake #73

Closed BJsupport closed 1 year ago

BJsupport commented 1 year ago

Is there an existing issue for this?

Describe the issue

Using the Salesforce to Snowflake connector, we do dbt run and get a duplicate column name sql error. Going into snowflake and renaming one of the columns fixes this issue, but when the model runs every sync it fails and the query must be redone.

Relevant error log or model output

dbt run --select models/

Running with dbt=1.3.0
Found 3 models, 0 tests, 0 snapshots, 0 analyses, 626 macros, 0 operations, 0 seed files, 1 source, 0 exposures, 0 metrics

Concurrency: 1 threads (target='prod')

1 of 3 START sql view model SALESFORCE.account_formulas ........................ [RUN]
1 of 3 ERROR creating sql view model SALESFORCE.account_formulas ............... [ERROR in 1.18s]
2 of 3 START sql view model SALESFORCE.opportunity_formulas .................... [RUN]
2 of 3 ERROR creating sql view model SALESFORCE.opportunity_formulas ........... [ERROR in 0.88s]
3 of 3 START sql view model SALESFORCE.user_formulas ........................... [RUN]
3 of 3 OK created sql view model SALESFORCE.user_formulas ...................... [SUCCESS 1 in 1.30s]

Finished running 3 view models in 0 hours 0 minutes and 4.97 seconds (4.97s).

Completed with 2 errors and 0 warnings:

Database Error in model account_formulas (models/account_formulas.sql)
  002025 (42S21): SQL compilation error:
  duplicate column name 'BILLING_GROUP_C'
  compiled Code at target/run/final_try/models/account_formulas.sql

Database Error in model opportunity_formulas (models/opportunity_formulas.sql)
  002025 (42S21): SQL compilation error:
  duplicate column name 'LEAD_ADVISOR_C'
  compiled Code at target/run/final_try/models/opportunity_formulas.sql

Done. PASS=1 WARN=0 ERROR=2 SKIP=0 TOTAL=3

Expected behavior

The queries should not contain duplicate column names. The output contains a field that has "as [fieldName]" twice.

dbt Project configurations

Default configuration

Package versions

packages:

What database are you using dbt with?

snowflake

dbt Version

Core:

Plugins:

Additional Context

These errors were resolved by manually taking out the auto created ",mt.lead_advisor_c" and ",mt.BILLING_GROUP_C" - these shared a namespace with the formula in the query, like with "AS LEAD_ADVISOR_C".

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

fivetran-joemarkiewicz commented 1 year ago

Hi @BJsupport thanks for opening this issue! Unfortunately the issue you are experiencing is one that ties back to a translation error within the model field in the fivetran_formula_model table that the package is referring to.

As such, this is not an issue we will be able to address within the package. Instead, I would recommend opening a Support Ticket for our support and engineering team to be able to identify the translation error and possibly apply a fix.

As we will not be able to address the issue within this package, I will close this ticket and mark as "won't fix". Please feel free to reach back out if you believe this truly is an error caused by the package.