diff --git a/CHANGELOG.md b/CHANGELOG.md index 31399ed..88af10a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ ## Features - Updated the README for easier use and navigation of the package ([PR #78](https://github.com/fivetran/dbt_salesforce_formula_utils/pull/78)). +## Bug Fixes +([PR #77](https://github.com/fivetran/dbt_salesforce_formula_utils/pull/77)) includes the following changes: +- In v0.8.0, the `using_quoted_identifiers` argument in the `sfdc_formula_view()` macro was erroneously removed, making its default value of `False` immutable. It has been reintroduced. +- `using_quoted_identifiers` now uses warehouse-specific quoting syntax. + # dbt_salesforce_formula_utils v0.8.0 ## 🚨 Breaking Changes 🚨: diff --git a/macros/sfdc_formula_view.sql b/macros/sfdc_formula_view.sql index 8645ff0..0f847fa 100644 --- a/macros/sfdc_formula_view.sql +++ b/macros/sfdc_formula_view.sql @@ -1,4 +1,4 @@ -{%- macro sfdc_formula_view(source_table, source_name='salesforce', reserved_table_name=source_table, fields_to_include=none, full_statement_version=true, materialization='view') -%} +{%- macro sfdc_formula_view(source_table, source_name='salesforce', reserved_table_name=source_table, fields_to_include=none, full_statement_version=true, materialization='view', using_quoted_identifiers=False) -%} -- Best practice for this model is to be materialized as view. That is why we have set that here. {{ @@ -15,7 +15,9 @@ {% if full_statement_version %} {% if using_quoted_identifiers %} -{%- set table_results = dbt_utils.get_column_values(table=source(source_name, 'fivetran_formula_model'), column='"model"', where="\"object\" = '" ~ source_table ~ "'") -%} +{%- set table_results = dbt_utils.get_column_values(table=source(source_name, 'fivetran_formula_model'), + column='"MODEL"' if target.type in ('snowflake') else '"model"' if target.type in ('postgres', 'redshift', 'snowflake') else '`model`', + where=("\"OBJECT\" = '" if target.type in ('snowflake') else "\"object\" = '" if target.type in ('postgres', 'redshift') else "`object` = '") ~ source_table ~ "'") -%} {% else %} {%- set table_results = dbt_utils.get_column_values(table=source(source_name, 'fivetran_formula_model'), column='model', where="object = '" ~ source_table ~ "'") -%}