Skip to content

Commit b55c1c2

Browse files
fivetran-savagefivetran-data-model-botfivetran-catfritzgithub-actions[bot]fivetran-joemarkiewicz
authored
feature/update-materialization-for-sap-models (#34)
* feature/update-materialization-for-sap-models * Remove combo tests and move `loaded_at_field` (#32) * Remove YAML tests and bump patch to v0.3.0 * Update README.md * Update dbt_project.yml * Apply suggestions from code review --------- Co-authored-by: fivetran-catfritz <[email protected]> Co-authored-by: Savage Fivetran <[email protected]> * move_loaded_at_to_config * Generate dbt docs via GitHub Actions * Apply suggestions from code review Co-authored-by: Joe Markiewicz <[email protected]> * Update README.md * Update CHANGELOG.md * Generate dbt docs via GitHub Actions --------- Co-authored-by: Fivetran Maintainer Bot <[email protected]> Co-authored-by: fivetran-catfritz <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Joe Markiewicz <[email protected]>
1 parent a217277 commit b55c1c2

File tree

10 files changed

+42
-325
lines changed

10 files changed

+42
-325
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# dbt_sap v0.3.0
2+
3+
[PR #34](https://github.com/fivetran/dbt_sap/pull/34) includes the following updates:
4+
5+
## Schema and Data Changes **(--full-refresh required after upgrading)**
6+
**97 total changes • 94 of which are breaking in the form of materialization updates**
7+
| **Data Model** | **Change type** | **Old** | **New** | **Notes** |
8+
| -------------- | --------------- | ------------ | ------------ | --------- |
9+
|[stg_* ](https://github.com/fivetran/dbt_sap/tree/main/models/staging)(all staging models: 72)| Materialization | Table | View | These staging models are now views. Upon full refresh, the package should automatically drop the tables and recreate them as views. However, we recommend reviewing your schema and manually dropping any remaining staging models materialized as tables as they will no longer be updated in favor of the materialized views.|
10+
| [int_*](https://github.com/fivetran/dbt_sap/tree/main/models/sales_and_procurement/star_schema/intermediate) (all sales and procurement intermediate models: 22) | Materialization | Table | Ephemeral | These intermediate models are now views. We therefore recommend manually dropping all sap data model sales and procurement intermediate tables as they will no longer be updated in favor of the materialized views.|
11+
12+
## dbt Fusion Compatibility Updates
13+
- Updated package to maintain compatibility with dbt-core versions both before and after v1.10.6, which introduced a breaking change to multi-argument test syntax (e.g., `unique_combination_of_columns`).
14+
- Temporarily removed unsupported tests to avoid errors and ensure smoother upgrades across different dbt-core versions. These tests will be reintroduced once a safe migration path is available.
15+
- Removed all `dbt_utils.unique_combination_of_columns` tests.
16+
- Moved `loaded_at_field: _fivetran_synced` under the `config:` block in `src_sap.yml`
17+
118
# dbt_sap v0.2.1
219
[PR #28](https://github.com/fivetran/dbt_sap/pull/28) includes the following updates:
320

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
- Brings in general ledger models like General Ledger: Balances, Leading Ledger (`sap__0fi_gl_10`) and Line Items Leading Ledger (`sap__0fi_gl_14`).
2222
- Brings in master text models like Company Code (`sap__0comp_code_text`), Company (`sap__0company_text`), and Vendor (`sap__0vendor_text`).
2323
- Provides sales and procurement models including facts and dimensions for purchase and sales orders.
24-
- Produces modeled tables that leverage SAP data from [Fivetran's SAP connectors, like LDP SAP Netweaver](https://fivetran.com/docs/local-data-processing/requirements/source-and-target-requirements/sap-netweaver-requirements), [HVA SAP](https://fivetran.com/docs/databases/sap-erp/high-volume-agent) or [SAP ERP on HANA](https://fivetran.com/docs/databases/sap-erp/sap-erp-hana) and build off the output of our [SAP source package](https://github.com/fivetran/dbt_sap_source).
24+
- Produces modeled tables that leverage SAP data from [Fivetran's SAP connectors, like LDP SAP Netweaver](https://fivetran.com/docs/local-data-processing/requirements/source-and-target-requirements/sap-netweaver-requirements), [HVA SAP](https://fivetran.com/docs/databases/sap-erp/high-volume-agent) or [SAP ERP on HANA](https://fivetran.com/docs/databases/sap-erp/sap-erp-hana).
2525
- Generates a comprehensive data dictionary of your source and modeled sap data through the [dbt docs site](https://fivetran.github.io/dbt_sap/).
2626

2727
<!--section=“sap_transformation_model"-->
@@ -42,7 +42,6 @@ The following table provides a detailed list of all tables materialized within t
4242
| [sap__0material_attr](https://fivetran.github.io/dbt_sap/#!/model/model.sap.sap__0material_attr) | This model is used to display material attribute information, originating from the `mara` source. |
4343
| [sap__0vendor_attr](https://fivetran.github.io/dbt_sap/#!/model/model.sap.sap__0vendor_attr) | This model is used to display vendor attributes, originating from the `lfa1` source. |
4444
| [sap__0vendor_text](https://fivetran.github.io/dbt_sap/#!/model/model.sap.sap__0vendor_text) | This model is used to display vendor text, originating from the `lfa1` source. |
45-
4645
| [sap__dim_customer](https://fivetran.github.io/dbt_sap/#!/model/model.sap.sap__dim_customer) | Represents customer dimension data from the `kna1` source to support dimensional reporting. SAP field names are mapped to English readable column names. |
4746
| [sap__dim_material](https://fivetran.github.io/dbt_sap/#!/model/model.sap.sap__dim_material) | Provides enriched material and material type data by combining attributes from the `mara`, `makt`, `t134`, and `t134t` sources to support dimensional reporting. SAP field names are mapped to English readable column names. |
4847
| [sap__dim_plant](https://fivetran.github.io/dbt_sap/#!/model/model.sap.sap__dim_plant) | Delivers plant-level dimension data from the `t001w` source to support dimensional reporting. SAP field names are mapped to English readable column names. |
@@ -54,7 +53,7 @@ The following table provides a detailed list of all tables materialized within t
5453
| [sap__fact_sales_order](https://fivetran.github.io/dbt_sap/#!/model/model.sap.sap__fact_sales_order) | Contains fact-level sales order data, integrating records from `vbak`, `vbap`, `vbuk`, and `vbup` sources to provide visibility into sales transaction performance. SAP field names are mapped to English readable column names. |
5554

5655
### Materialized Models
57-
Each Quickstart transformation job run materializes 46 models if all components of this data model are enabled. This count includes all staging, intermediate, and final models materialized as `view`, `table`, or `incremental`.
56+
Each Quickstart transformation job run materializes 95 models if all components of this data model are enabled. This count includes all staging, intermediate, and final models materialized as `view`, `table`, or `incremental`.
5857
<!--section-end-->
5958

6059
## How do I use the dbt package?
@@ -129,12 +128,14 @@ vars:
129128
```
130129
131130
#### Change the build schema
132-
By default, this package builds the SAP staging models within a schema titled (`<target_schema>` + `stg_sap`) and the SAP final models within a schema titled (<target_schema> + `_sap`) in your target database. If this is not where you would like your modeled sap data to be written to, add the following configuration to your root `dbt_project.yml` file:
131+
By default, this package builds the SAP staging models within a schema titled (`<target_schema>` + `sap_source`) and the SAP final models within a schema titled (<target_schema> + `sap`) in your target database. If this is not where you would like your modeled sap data to be written to, add the following configuration to your root `dbt_project.yml` file:
133132

134133
```yml
135134
models:
136135
sap:
137136
+schema: my_new_schema_name # leave blank for just the target_schema
137+
staging:
138+
+schema: my_new_schema_name # leave blank for just the target_schema
138139
```
139140

140141
#### Change the source table references
@@ -143,7 +144,7 @@ If an individual source table has a different name than the package expects, add
143144

144145
```yml
145146
vars:
146-
sap_<default_source_table_name>_identifier: your_table_name
147+
sap_<default_source_table_name>_identifier: your_table_name
147148
```
148149

149150
</details>

dbt_project.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
config-version: 2
22
name: 'sap'
3-
version: '0.2.1'
3+
version: '0.3.0'
44
require-dbt-version: [">=1.3.0", "<2.0.0"]
55

66
models:
7-
sap:
8-
+materialized: table
9-
+schema: sap
7+
sap:
8+
+materialized: table
9+
+schema: sap
10+
staging:
11+
+materialized: view
12+
extractor_reports:
13+
intermediate:
14+
+materialized: table
15+
sales_and_procurement:
16+
star_schema:
17+
intermediate:
18+
+materialized: ephemeral
1019

1120
vars:
1221
sap:

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/dbt_project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'sap_integration_tests'
2-
version: '0.2.1'
2+
version: '0.3.0'
33
profile: 'integration_tests'
44
config-version: 2
55

integration_tests/packages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
packages:
2-
- local: ../
2+
- local: ../

models/extractor_reports/extractor_reports.yml

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ version: 2
33
models:
44
- name: sap__0comp_code_attr
55
description: This model is used for loading company code attributes, extracting from the t001 data source.
6-
tests:
7-
- dbt_utils.unique_combination_of_columns:
8-
combination_of_columns:
9-
- mandt
10-
- bukrs
116
columns:
127
- name: mandt
138
description: Client
@@ -30,11 +25,6 @@ models:
3025

3126
- name: sap__0comp_code_text
3227
description: This model is used for loading company code text information, extracting from the t001 data source.
33-
tests:
34-
- dbt_utils.unique_combination_of_columns:
35-
combination_of_columns:
36-
- mandt
37-
- bukrs
3828
columns:
3929
- name: mandt
4030
description: Client
@@ -47,11 +37,6 @@ models:
4737

4838
- name: sap__0company_text
4939
description: This model is used for loading customer text data, extracting from the t880 data source.
50-
tests:
51-
- dbt_utils.unique_combination_of_columns:
52-
combination_of_columns:
53-
- mandt
54-
- rcomp
5540
columns:
5641
- name: mandt
5742
description: Client
@@ -62,11 +47,6 @@ models:
6247

6348
- name: sap__0customer_attr
6449
description: This model is used for loading customer master data, originating from the kna1 source.
65-
tests:
66-
- dbt_utils.unique_combination_of_columns:
67-
combination_of_columns:
68-
- mandt
69-
- kunnr
7050
columns:
7151
- name: mandt
7252
description: Client
@@ -131,12 +111,6 @@ models:
131111

132112
- name: sap__0employee_attr
133113
description: This model contains information that concerns the employee's work relationship, extracting master data from the personnel administration tables.
134-
tests:
135-
- dbt_utils.unique_combination_of_columns:
136-
combination_of_columns:
137-
- pernr
138-
- begda
139-
- endda
140114
columns:
141115
- name: begda
142116
description: Vaild from date
@@ -611,12 +585,6 @@ models:
611585

612586
- name: sap__0gl_account_attr
613587
description: This model is used for loading G/L Account Number master data, originating from the ska1 source.
614-
tests:
615-
- dbt_utils.unique_combination_of_columns:
616-
combination_of_columns:
617-
- mandt
618-
- ktopl
619-
- saknr
620588
columns:
621589
- name: mandt
622590
description: Client
@@ -655,11 +623,6 @@ models:
655623

656624
- name: sap__0material_attr
657625
description: This model is used to display material attribute information, originating from the mara source.
658-
tests:
659-
- dbt_utils.unique_combination_of_columns:
660-
combination_of_columns:
661-
- mandt
662-
- matnr
663626
columns:
664627
- name: mandt
665628
description: Client
@@ -916,11 +879,6 @@ models:
916879

917880
- name: sap__0vendor_attr
918881
description: This model is used to display vendor attributes, originating from the lfa1 source.
919-
tests:
920-
- dbt_utils.unique_combination_of_columns:
921-
combination_of_columns:
922-
- mandt
923-
- lifnr
924882
columns:
925883
- name: mandt
926884
description: Client
@@ -981,11 +939,6 @@ models:
981939

982940
- name: sap__0vendor_text
983941
description: This model is used to display vendor text, originating from the lfa1 source.
984-
tests:
985-
- dbt_utils.unique_combination_of_columns:
986-
combination_of_columns:
987-
- mandt
988-
- lifnr
989942
columns:
990943
- name: mandt
991944
description: Client

models/staging/src_sap.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ sources:
66
database: "{% if target.type != 'spark' %}{{ var('sap_database', target.database) }}{% endif %}"
77

88
loader: fivetran
9-
loaded_at_field: _fivetran_synced
9+
config:
10+
loaded_at_field: _fivetran_synced
1011

1112
tables:
1213
- name: bkpf

0 commit comments

Comments
 (0)