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.
An alias created by the dbt package
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.
Is there an existing issue for this?
Describe the issue
Issue
Currently the
sfdc_formula_view
macros allows for an argumentreserved_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 thefivetran_formula
table to be as the following:However, the customer passed an argument through to the
reserved_table_name
within the macro to change the alias touser_source_table
. Therefore, there are now two conflicting aliases.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 beuser__table
andopportunity
would beopportunity__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
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
Are you willing to open a PR to help address this issue?