You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff 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
+
1
10
# dbt_salesforce_formula_utils v0.9.2
2
11
[PR #96](https://github.com/fivetran/dbt_salesforce_formula_utils/pull/96) includes the following updates:
Copy file name to clipboardExpand all lines: README.md
+10-82Lines changed: 10 additions & 82 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,74 +44,23 @@ sources:
44
44
# 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.
45
45
tables:
46
46
- 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
50
48
51
49
## 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
52
50
```
53
51
54
52
## 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
56
54
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:
58
56
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`).
**Output**: All formulas for the chosen source table will be included in the resulting `select` statement.
68
63
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. `[]`)
**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/>
115
64
116
65
### Automate model creation
117
66
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_
**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') }}`.
124
73
125
74
> Note: In order for this command to work, you must currently be within the root directory of your dbt project.
126
75
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:
> **Note**: Do not add this variable to your `dbt_project.yml` file if you do not need to exclude any fields.
145
76
146
-
## Step 6: Execute models
77
+
## Step 5: Execute models
147
78
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.
148
79
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™
150
81
<details><summary>Expand to view details</summary>
151
82
<br>
152
83
@@ -164,16 +95,13 @@ This macro generates the final sql needed to join the Salesforce formula fields
164
95
```
165
96
**Args:**
166
97
* `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.
170
99
* `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.
171
100
* `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.
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.
0 commit comments