Skip to content

Commit 6411a75

Browse files
Feature/redshift model large (#129)
* feature/redshift-model-large * add seed * revise * formatting * fix * update logic with new reqs * fix test schema * try different seed method * try different seed method * chagenlog * chagenlog * Generate dbt docs via GitHub Actions * adjust * changelog * Apply suggestion from @fivetran-catfritz * Generate dbt docs via GitHub Actions --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent c7d9b73 commit 6411a75

File tree

11 files changed

+77
-15
lines changed

11 files changed

+77
-15
lines changed

.buildkite/scripts/run_models.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ dbt deps
1919
dbt seed --target "$db" --full-refresh
2020
dbt run --target "$db" --full-refresh
2121
dbt test --target "$db"
22+
dbt run --vars '{using_quoted_identifiers: true}' --target "$db" --full-refresh
23+
dbt test --vars '{using_quoted_identifiers: true}' --target "$db"
2224
dbt run-operation fivetran_utils.drop_schemas_automation --target "$db"

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# dbt_salesforce_formula_utils v0.11.1
2+
[PR #129](https://github.com/fivetran/dbt_salesforce_formula_utils/pull/129) includes the following updates:
3+
4+
## Feature Update
5+
- Applies **only** to Redshift: adds support for Redshift's `SUPER` data type in the `sfdc_formula_view` macro, enabling proper handling of large model configurations stored as JSON in the `fivetran_formula_model.model_large` column.
6+
7+
## Under the Hood
8+
- Refactors the handling of the `using_quoted_identifiers` argument of the `sfdc_formula_view` macro for readability and maintainability.
9+
- Adds integration tests for when `using_quoted_identifiers` is true.
10+
111
# dbt_salesforce_formula_utils v0.11.0
212

313
[PR #126](https://github.com/fivetran/dbt_salesforce_formula_utils/pull/126) includes the following updates:

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.11.0'
2+
version: '0.11.1'
33
config-version: 2
44
require-dbt-version: [">=1.3.0", "<3.0.0"]

docs/catalog.json

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

docs/manifest.json

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

integration_tests/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ target/
33
dbt_modules/
44
logs/
55
env/
6-
package-lock.yml
6+
package-lock.yml
7+
dbt_internal_packages/

integration_tests/dbt_project.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'salesforce_formula_integration_tests'
2-
version: '0.11.0'
2+
version: '0.11.1'
33
profile: 'integration_tests'
44
config-version: 2
55
vars:
@@ -15,12 +15,24 @@ seeds:
1515
salesforce_formula_integration_tests:
1616
+quote_columns: "{{ true if target.type == 'redshift' else false }}"
1717
opportunity:
18-
+columns_types:
18+
+column_types:
1919
amount: float
2020
probability: float
2121
fivetran_formula:
2222
+column_types:
2323
view_sql: "{{ 'varchar(256)' if target.type in ('redshift','postgres') else 'string'}}"
24+
fivetran_formula_model:
25+
+enabled: "{{ false if target.type == 'redshift' else true }}"
26+
fivetran_formula_model_redshift:
27+
+enabled: "{{ true if target.type == 'redshift' else false }}"
28+
+alias: fivetran_formula_model
29+
+column_types:
30+
model_string: varchar(65535)
31+
# Load as VARCHAR first, then convert to SUPER using JSON_PARSE() in a post-hook.
32+
# This is necessary for testing the SUPER datatype with seed data.
33+
+post-hook:
34+
- "alter table {{ this }} add column model_large super default null"
35+
- "update {{ this }} set model_large = json_parse(model_string)"
2436

2537
dispatch:
2638
- macro_namespace: dbt_utils
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{{ salesforce_formula_utils.sfdc_formula_view(
22
source_table = 'account',
3+
using_quoted_identifiers = var('using_quoted_identifiers', false),
34
full_statement_version=true) }} --leaving full_statement_version=true in this model to make sure it doesn't error
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
{{ salesforce_formula_utils.sfdc_formula_view(
2-
source_table = 'opportunity') }}
2+
source_table = 'opportunity',
3+
using_quoted_identifiers = var('using_quoted_identifiers', false)) }}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
object,model_string
2+
opportunity,"""select \nopportunity__table.*,\n(amount * probability) as opportunity_test_formula \n from salesforce_formula_integrations_tests.opportunity as opportunity__table"""
3+
account,"""select \naccount__table.*,\n(number_of_employees * 2) as account_test_formula \n from salesforce_formula_integrations_tests.account as account__table"""
4+
user,"""select \nuser__table.*,\ncase when is_active = true then 'active' else 'not active' end as is_active_user \n from salesforce_formula_integrations_tests.user as user__table"""
5+
user_role,"""select \nuser_role__table.*,\nconcat(developer_name,id) as developer_and_id \n from salesforce_formula_integrations_tests.user_role as user_role__table"""

0 commit comments

Comments
 (0)