Skip to content

Commit 701b2d7

Browse files
Merge pull request #101 from fivetran/fix/remove-unsupported-option
Fix/remove unsupported option
2 parents 4f0e2e7 + 9aa0603 commit 701b2d7

File tree

10 files changed

+40
-101
lines changed

10 files changed

+40
-101
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# dbt_salesforce_formula_utils v0.9.3
2+
[PR #101](https://github.com/fivetran/dbt_salesforce_formula_utils/pull/101) includes the following updates:
3+
4+
## 🗒️ Documentation Update 🗒️
5+
- Fivetran has deprecated support for the `full_statement_version=false`. We've removed mention of this obsolete method [in the README](https://github.com/fivetran/dbt_salesforce_formula_utils/blob/main/README.md).
6+
7+
## 🚇 Under the Hood 🚇
8+
- Users will not see functional differences from v0.9.2. However, due to changes in the Fivetran Salesforce connector, users still utilizing the `full_statement_version=false` should expect formula field values to be null.
9+
110
# dbt_salesforce_formula_utils v0.9.2
211
[PR #96](https://github.com/fivetran/dbt_salesforce_formula_utils/pull/96) includes the following updates:
312

README.md

Lines changed: 10 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -44,74 +44,23 @@ sources:
4444
# Add the database where your Salesforce data resides if different from the target database. Eg. 'my_salesforce_database'. By default the target.database is used.
4545
tables:
4646
- name: fivetran_formula_model
47-
description: Used for the recommended Option 1 version of the formula solution.
48-
- name: fivetran_formula
49-
description: Used for options 2 and 3 of the original individual formula solution.
47+
description: Contains SQL models produced by Fivetran Salesforce connector
5048
5149
## Any other source tables you are creating models for should be defined here as well. They aren't required, but it is best organizational practice and allows Fivetran to compile data lineage graphs
5250
```
5351

5452
## Step 4: Create models
55-
### (Recommended and default) Option 1: Generate all relevant formula fields using connector-made query
53+
### Generate models using connector-made query
5654

57-
If you would like your model to generate all the formula fields at once related to your source table then you will need to:
55+
To create a model that includes all formula fields:
5856
1. Create a new file in your models folder and name it `your_table_name_here.sql` (e.g. `customer.sql`; this is not necessary but recommended as best practice).
59-
2. Add the below snippet calling the [`sfdc_formula_view`](https://github.com/fivetran/dbt_salesforce_formula_utils#sfdc_formula_view-source) macro into the file. Update the `source_table` argument to be the source table name for which you are generating the model (e.g. `customer`). Though `full_statement_version` is explicitly included here, it is `true` by default.
57+
2. Add the below snippet calling the [`sfdc_formula_view`](https://github.com/fivetran/dbt_salesforce_formula_utils#sfdc_formula_view-source) macro into the file. Update the `source_table` argument to be the source table name for which you are generating the model (e.g. `customer`).
6058
```sql
61-
{{ salesforce_formula_utils.sfdc_formula_view(
62-
source_table='your_source_table_name_here',
63-
full_statement_version=true)
64-
}}
59+
{{ salesforce_formula_utils.sfdc_formula_view(source_table='your_source_table_name_here') }}
6560
```
6661

6762
**Output**: All formulas for the chosen source table will be included in the resulting `select` statement.
6863

69-
> This option makes use of the `fivetran_formula_model` lookup table, which stores connector-generated SQL queries for each source table. Compared to `fivetran_formula`, which is used in Options 2 & 3, it is typically more complete and supports most double-nested formulas.
70-
71-
72-
### (Deprecated) Options 2 and 3
73-
74-
**IMPORTANT**: Options 2 and 3 (which leverage the `full_statement_version=false` config) will no longer be supported after October 1. Click 'Expand to view details' if you'd like to still use these options for the time being.
75-
76-
<details>
77-
<summary>Expand to view details</summary>
78-
79-
### Option 2: Generate all relevant formula fields using package-made query
80-
81-
If you would like your model to generate all the formula fields related to your source table then you will need to:
82-
1. Create a new file in your models folder and name it `your_table_name_here.sql` (e.g. `customer.sql`; this is not necessary but recommended as best practice).
83-
2. Add the below snippet calling the [`sfdc_formula_view`](https://github.com/fivetran/dbt_salesforce_formula_utils#sfdc_formula_view-source) macro into the file. Update the `source_table` argument to be the source table name for which you are generating the model (e.g. `customer`).
84-
```sql
85-
{{ salesforce_formula_utils.sfdc_formula_view(
86-
source_table='your_source_table_name_here',
87-
full_statement_version=false)
88-
}}
89-
```
90-
91-
**Output**: All formulas for the chosen source table will be included in the resulting `select` statement.
92-
93-
> This option makes use of the `fivetran_formula` lookup table, which requires the package to combine fields' formulas into a SQL query for each source table. This option does not support double-nested formulas and therefore may be incomplete compared to Option #1.
94-
95-
### Option 3: Generate only specified formula fields using package-made query
96-
97-
If you would like your model to generate only a specified subset of your formula fields related to your source table then you will need to:
98-
1. Create a new file in your models folder and name it `your_table_name_here.sql` (e.g. `customer.sql`; this is not necessary but recommended as best practice).
99-
2. Add the below snippet calling the [`sfdc_formula_view`](https://github.com/fivetran/dbt_salesforce_formula_utils#sfdc_formula_view-source) macro into the file and:
100-
- Update the `source_table` argument to be the source table name for which you are generating the model (e.g. `customer`).
101-
- Update the `fields_to_include` argument to contain all the fields from your source that you would like to be included in the final output. Be sure that the field(s) you would like to include are enclosed within brackets as an array (ie. `[]`)
102-
```sql
103-
{{ salesforce_formula_utils.sfdc_formula_view(
104-
source_table='your_source_table_name_here',
105-
fields_to_include=['i_want_this_field','also_this_one','maybe_a_third_as_well','lets_add_more'],
106-
full_statement_version=false)
107-
}}
108-
```
109-
110-
**Output**: Only formulas provided in the `fields_to_include` variable will be included in the resulting `select` statement for the chosen source table.
111-
112-
> This option makes use of the `fivetran_formula` lookup table, which requires the package to combine fields' formulas into a SQL query for each source table. This option does not support double-nested formulas and therefore may be incomplete compared to Option #1.
113-
</details>
114-
<br/>
11564

11665
### Automate model creation
11766
If you have multiple models you need to create, you can also leverage the [sfdc_formula_model_automation](https://github.com/fivetran/dbt_salesforce_formula_utils#sfdc_formula_model_automationsh-source) script within this project to automatically create models locally via the command line. Below is an example command to copy and edit.
@@ -120,33 +69,15 @@ If you have multiple models you need to create, you can also leverage the [sfdc_
12069
source dbt_modules/salesforce_formula_utils/sfdc_formula_model_automation.sh "../path/to/directory" "desired_table_1,desired_table_2,desired_table_infinity"
12170
```
12271

123-
**Output**: Model files for each table, populated with `{{ salesforce_formula_utils.sfdc_formula_view(source_table='table_name') }}`. By default, these models will run Option #1. To use Options #2 or #3, you will need to manually add `full_statement_version=false` to each model file. For Option #3, you will need to add the `fields_to_include` argument(s) as well.
72+
**Output**: Model files for each table, populated with `{{ salesforce_formula_utils.sfdc_formula_view(source_table='table_name') }}`.
12473

12574
> Note: In order for this command to work, you must currently be within the root directory of your dbt project.
12675

127-
## Step 5: Exclude problematic formula fields (for Option #2 or #3)
128-
The `sfdc_formula_view` macro supports double-nested formula field references for most cases using Option #1, however, it does not support Options #2 or #3.
129-
130-
For example:
131-
- : A formula field references standard fields from the base Salesforce table.
132-
- : A formula field references another formula field that does **not** reference other formula fields.
133-
134-
The `sfdc_formula_view` macro may support some cases of n-nested formula field references using Option #1, however, it does not support Options #2 or #3.
135-
136-
For example:
137-
- 🚧 : A formula field references another formula field that references another formula field (and so on...).
138-
139-
When using Options #2 or #3 with a formula field that is double-nested or is otherwise not compiling, exclude it from all your models by setting the `sfdc_exclude_formulas` variable within your root `dbt_project.yml` file. Configure this variable as a set of all the fields you would like to exclude from all models. This is for Options #2 or #3 only and will *not* work with Option 1. See below for an example:
140-
```yml
141-
vars:
142-
sfdc_exclude_formulas: ('field_that_references_other_formula','other_triple_ref_field','field_i_just_dont_want')
143-
```
144-
> **Note**: Do not add this variable to your `dbt_project.yml` file if you do not need to exclude any fields.
14576

146-
## Step 6: Execute models
77+
## Step 5: Execute models
14778
Once you have created all your desired models and copied/modified the sql snippet into each model you will execute `dbt deps` to install the macro package, then execute `dbt run` to generate the models. Additionally, you can reference the [integration_tests](https://github.com/fivetran/dbt_salesforce_formula_utils/tree/main/integration_tests/models) folder for examples on how to use the macro within your models.
14879

149-
## (Optional) Step 7: Orchestrate your models with Fivetran Transformations for dbt Core™
80+
## (Optional) Step 6: Orchestrate your models with Fivetran Transformations for dbt Core™
15081
<details><summary>Expand to view details</summary>
15182
<br>
15283

@@ -164,16 +95,13 @@ This macro generates the final sql needed to join the Salesforce formula fields
16495
```
16596
**Args:**
16697
* `source_table` (required): The table with which you are joining the formula fields.
167-
* `source_name` (optional, default = `'salesforce'`): The dbt source containing the table you want to join with formula fields (as defined [here](https://github.com/fivetran/dbt_salesforce_formula_utils/tree/main#step-3-define-required-source-tables)). Must contain the `fivetran_formula` and `fivetran_formula_model` tables.
168-
* `fields_to_include` (optional, default = `none`): If a users wishes to only run the formula fields macro for designated fields then they may be applied within this variable. This variable will ensure the model only generates the sql for the designated fields. `full_statement_version` **must** be `false` for this variable to work.
169-
* `full_statement_version` (optional, default = `true`): Allows a user to leverage the `fivetran_formula_model` version of the macro which will generate the formula fields via the complete sql statement, rather than individual formulas being generated within the macro.
98+
* `source_name` (optional, default = `'salesforce'`): The dbt source containing the table you want to join with formula fields (as defined [here](https://github.com/fivetran/dbt_salesforce_formula_utils/tree/main#step-3-define-required-source-tables)). Must contain the `fivetran_formula_model` table.
17099
* `using_quoted_identifiers` (optional, default = `false`): For warehouses with case sensitivity enabled this argument **must** be set to `true` in order for the underlying macros within this project to properly compile and execute successfully.
171100
* `materialization` (optional, default = `view`): By default the model will be materialized as a view. If you would like to materialize as a table, you can adjust using this argument.
172-
> Note: If you populate the `fields_to_include` argument then the package will exclusively look for those fields. If you have designated a field to be excluded within the `sfdc_exclude_formulas` variable, then this will be ignored and the field will be included in the final model.
173101
----
174102

175103
## sfdc_formula_model_automation.sh ([source](sfdc_formula_model_automation.sh))
176-
This bash script is intended to be used in order to automatically create the desired salesforce models via the command line within your dbt project. This bash script will generate a model file within your dbt project that contains the [sfdc_formula_view](https://github.com/fivetran/dbt_salesforce_formula_utils/blob/main/macros/sfdc_formula_view.sql) macro for the appropriately defined table(s). In order for this command to work you must be within the root directory of your dbt project. By default, the resultant models will run Option #1, but can be configured to run Options #2 and #3 by adding `full_statement_version=false` for both and the `fields_to_include` arguments for Option #3.
104+
This bash script is intended to be used in order to automatically create the desired salesforce models via the command line within your dbt project. This bash script will generate a model file within your dbt project that contains the [sfdc_formula_view](https://github.com/fivetran/dbt_salesforce_formula_utils/blob/main/macros/sfdc_formula_view.sql) macro for the appropriately defined table(s). In order for this command to work you must be within the root directory of your dbt project.
177105

178106
**Usage:**
179107
```bash

dbt_project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name: 'salesforce_formula_utils'
2-
version: '0.9.2'
2+
version: '0.9.3'
33
config-version: 2
44
require-dbt-version: [">=1.3.0", "<2.0.0"]

docs/catalog.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/index.html

Lines changed: 12 additions & 12 deletions
Large diffs are not rendered by default.

docs/manifest.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)