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 19 forks source link

[Bug] Remove Customer Alias Override #50

Closed fivetran-joemarkiewicz closed 2 years ago

fivetran-joemarkiewicz commented 2 years ago

Is there an existing issue for this?

Describe the issue

Issue

Currently the sfdc_formula_view macros allows for an argument reserved_table_name to be included if you want/need to change the alias of your source table. This is needed if your base table is in itself a reserved word in your warehouse that could cause an error at runtime.

In the past few weeks a change has been implemented to the connector which passes aliases to formula fields within the fivetran_formula table to ensure common fields can't be misconstrued. This then results in an error where a field is generated by the fivetran_formula table to be as the following:

user.id as full_user_id_c

However, the customer passed an argument through to the reserved_table_name within the macro to change the alias to user_source_table. Therefore, there are now two conflicting aliases.

  1. An alias created by the dbt package
  2. An alias added to the translation of the formula within the fivetran_formula table.

If this happens, an alias error occurs due to too many aliases being included in the base compiled query.

Proposed Solution

While coordinating with the engineering team, it was found that a best solution would be to apply a consistent alias to our formulas by default. For example. user would be user__table and opportunity would be opportunity__table by default.

With this change in the connector, we will want to remove the alias override within the package and also take into consideration this new pre/appended identifier. We will confirm this approach with engineering.

Relevant error log or model output

See the error within the additional details section below

Expected behavior

The package does not have the possibility to have this error.

dbt Project configurations

N/A

Package versions

packages:

What database are you using dbt with?

snowflake

dbt Version

1.0.4

Additional Context

Screen Shot 2022-04-13 at 10 48 27 AM

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

fivetran-joemarkiewicz commented 2 years ago

This issue has been resolved in the latest release of the package.