Skip to content

Commit 3bb7f71

Browse files
Merge pull request #60 from fivetran/feature/add-tracking-category
Add Tracking Categories
2 parents a8f3818 + c9604af commit 3bb7f71

27 files changed

+818
-85
lines changed

.buildkite/scripts/run_models.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ 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 '{xero__using_credit_note: false, xero__using_bank_transaction: false}' --target "$db" --full-refresh
22+
dbt run --vars '{xero__using_credit_note: false, xero__using_bank_transaction: false, xero__using_invoice_line_item_tracking_category: false, xero__using_journal_line_tracking_category: false, xero__using_tracking_categories: false}' --target "$db" --full-refresh
2323
dbt test --target "$db"
2424
dbt run --target "$db" --full-refresh
2525
dbt test --target "$db"

.quickstart/quickstart.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ table_variables:
88
- _credit_note
99
xero__using_bank_transaction:
1010
- _bank_transaction
11+
xero__using_invoice_line_item_tracking_category:
12+
- _invoice_line_item_has_tracking_category
13+
xero__using_journal_line_tracking_category:
14+
- _journal_line_has_tracking_category
15+
xero__using_tracking_categories:
16+
- _tracking_category
17+
- _tracking_category_option
18+
- _tracking_category_has_option
1119

1220
destination_configurations:
1321
databricks:

CHANGELOG.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,35 @@
1-
# dbt_xero v0.version.version
2-
This release includes the following updates.
1+
# dbt_xero v0.9.0
2+
This release includes the following updates:
3+
4+
## Breaking Changes
5+
- Added tracking categories by pivoting out fields and grabbing the latest tracking category records from invoice line items and journal line entries. This update will provide more granular reporting capabilities and will result in the following model changes: ([PR #60](https://github.com/fivetran/dbt_xero/pull/60))
6+
- `xero__general_ledger` dynamically pivots out journal line tracking category names and populates each line with the active options for the categories for these journals and accounts.
7+
- `xero__profit_and_loss_report` **will see a change in the grain** with these new dynamic pivoted tracking categories added to each journal line.
8+
- Added these dynamic tracking categories to the `profit_and_loss_id` as they are now unique lines within the profit and loss. **IMPORTANT**: This will change the existing values of the `profit_and_loss_id`, so this is a **breaking change**. ([PR #60](https://github.com/fivetran/dbt_xero/pull/60))
9+
- `xero__invoice_line_items` dynamically pivots out invoice line item tracking category and populates each line with the active options for those line items.
10+
- Created intermediate models `int_xero__invoice_line_item_tracking_categories` and `int_xero__journal_line_tracking_categories` to perform the `dbt_utils` pivot operations. ([PR #60](https://github.com/fivetran/dbt_xero/pull/60))
11+
- Added the following variables to allow the ability to disable your models if you're not planning to utilize the tracking category configuration. [See the README](https://github.com/fivetran/dbt_xero/blob/main/README.md#disabling-and-enabling-models) for detailed instructions. ([PR #60](https://github.com/fivetran/dbt_xero/pull/60))
12+
- `xero__using_invoice_line_item_tracking_category`
13+
- `xero__using_journal_line_tracking_category`
14+
- `xero__using_tracking_categories`
15+
- These variables are utilized in the following end models:
16+
17+
| End Models Impacted | Variables Implemented |
18+
|-------------------------------------------------------| ---------------------------------------------------|
19+
| `xero__general_ledger`, `xero__profit_and_loss_report` | `xero__using_journal_line_tracking_category`, `xero__using_tracking_categories` |
20+
| `xero__invoice_line_items` | `xero__using_invoice_line_item_tracking_category`, `xero__using_tracking_categories` |
21+
22+
## Under the Hood
23+
- Added new table variables in `quickstart.yml` to ensure their respective models are enabled and disabled appropriately.
24+
([PR #60](https://github.com/fivetran/dbt_xero/pull/60))
25+
- Created `get_prefixed_tracking_category_columns` macro to properly bring in and check for pivoted columns within the above `dbt_xero` end models.
26+
- Created integrity tests to ensure tracking category values for journal lines and invoice items match between the above end models and their source tables.
27+
([PR #60](https://github.com/fivetran/dbt_xero/pull/60))
28+
- Added and updated seed files to properly test out advanced cases for the new tracking categories. ([PR #60](https://github.com/fivetran/dbt_xero/pull/60))
329

430
## Documentation
5-
- Updated README to better elaborate on why multi-currency can't be fully supported by our dbt package.
31+
- Added instructions in the README for how to disable tracking category functionality utilizing the new variables. ([PR #60](https://github.com/fivetran/dbt_xero/pull/60))
32+
- Updated README to better elaborate on why multi-currency can't be fully supported by our dbt package. ([PR #61](https://github.com/fivetran/dbt_xero/pull/61))
633

734
# dbt_xero v0.8.0
835
[PR #54](https://github.com/fivetran/dbt_xero/pull/54) includes the following updates:

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The following table provides a detailed list of all tables materialized within t
3333
| [xero__invoice_line_items](https://github.com/fivetran/dbt_xero/blob/main/models/xero__invoice_line_items.sql) | Each record represents an invoice line item enriched with the account, contact, and invoice information. |
3434

3535
### Materialized Models
36-
Each Quickstart transformation job run materializes 22 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`.
36+
Each Quickstart transformation job run materializes 35 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`.
3737
<!--section-end-->
3838

3939
## How do I use the dbt package?
@@ -50,7 +50,7 @@ Include the following xero package version in your `packages.yml` file:
5050
```yaml
5151
packages:
5252
- package: fivetran/xero
53-
version: [">=0.8.0", "<0.9.0"] # we recommend using ranges to capture non-breaking changes automatically
53+
version: [">=0.9.0", "<0.10.0"] # we recommend using ranges to capture non-breaking changes automatically
5454
```
5555
Do NOT include the `xero_source` package in this file. The transformation package itself has a dependency on it and will install the source package as well.
5656
### Step 3: Define database and schema variables
@@ -96,6 +96,9 @@ config-version: 2
9696
vars:
9797
xero__using_credit_note: false # default is true
9898
xero__using_bank_transaction: false # default is true
99+
xero__using_invoice_line_item_tracking_category: false # default is true
100+
xero__using_journal_line_tracking_category: false # default is true
101+
xero__using_tracking_categories: false # default is true
99102
```
100103

101104
For additional configurations for the source models, visit the [Xero source package](https://github.com/fivetran/dbt_xero_source).
@@ -139,8 +142,8 @@ This dbt package is dependent on the following dbt packages. These dependencies
139142

140143
```yml
141144
packages:
142-
- package: fivetran/dbt_xero_source
143-
version: [">=0.6.0", "<0.7.0"]
145+
- package: fivetran/xero_source
146+
version: [">=0.7.0", "<0.8.0"]
144147
145148
- package: fivetran/fivetran_utils
146149
version: [">=0.4.0", "<0.5.0"]

dbt_project.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'xero'
2-
version: '0.8.0'
2+
version: '0.9.0'
33
config-version: 2
44
require-dbt-version: [">=1.3.0", "<2.0.0"]
55
vars:
@@ -13,6 +13,11 @@ vars:
1313
organization: "{{ ref('stg_xero__organization') }}"
1414
credit_note: "{{ ref('stg_xero__credit_note') }}"
1515
bank_transaction: "{{ ref('stg_xero__bank_transaction') }}"
16+
invoice_line_item_has_tracking_category: "{{ ref('stg_xero__invoice_line_item_has_tracking_category') }}"
17+
journal_line_has_tracking_category: "{{ ref('stg_xero__journal_line_has_tracking_category') }}"
18+
tracking_category_has_option: "{{ ref('stg_xero__tracking_category_has_option') }}"
19+
tracking_category_option: "{{ ref('stg_xero__tracking_category_option') }}"
20+
tracking_category: "{{ ref('stg_xero__tracking_category') }}"
1621
xero__using_bank_transaction: true
1722
xero__using_credit_note: true
1823
models:

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/ci/sample.profiles.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ integration_tests:
1616
pass: "{{ env_var('CI_REDSHIFT_DBT_PASS') }}"
1717
dbname: "{{ env_var('CI_REDSHIFT_DBT_DBNAME') }}"
1818
port: 5439
19-
schema: xero_integration_tests_2
19+
schema: xero_integration_tests_7
2020
threads: 8
2121
bigquery:
2222
type: bigquery
2323
method: service-account-json
2424
project: 'dbt-package-testing'
25-
schema: xero_integration_tests_2
25+
schema: xero_integration_tests_7
2626
threads: 8
2727
keyfile_json: "{{ env_var('GCLOUD_SERVICE_KEY') | as_native }}"
2828
snowflake:
@@ -33,7 +33,7 @@ integration_tests:
3333
role: "{{ env_var('CI_SNOWFLAKE_DBT_ROLE') }}"
3434
database: "{{ env_var('CI_SNOWFLAKE_DBT_DATABASE') }}"
3535
warehouse: "{{ env_var('CI_SNOWFLAKE_DBT_WAREHOUSE') }}"
36-
schema: xero_integration_tests_2
36+
schema: xero_integration_tests_7
3737
threads: 8
3838
postgres:
3939
type: postgres
@@ -42,13 +42,13 @@ integration_tests:
4242
pass: "{{ env_var('CI_POSTGRES_DBT_PASS') }}"
4343
dbname: "{{ env_var('CI_POSTGRES_DBT_DBNAME') }}"
4444
port: 5432
45-
schema: xero_integration_tests_2
45+
schema: xero_integration_tests_7
4646
threads: 8
4747
databricks:
4848
catalog: "{{ env_var('CI_DATABRICKS_DBT_CATALOG') }}"
4949
host: "{{ env_var('CI_DATABRICKS_DBT_HOST') }}"
5050
http_path: "{{ env_var('CI_DATABRICKS_DBT_HTTP_PATH') }}"
51-
schema: xero_integration_tests_2
51+
schema: xero_integration_tests_7
5252
threads: 8
5353
token: "{{ env_var('CI_DATABRICKS_DBT_TOKEN') }}"
5454
type: databricks

integration_tests/dbt_project.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'xero_integration_tests'
2-
version: '0.8.0'
2+
version: '0.9.0'
33
profile: 'integration_tests'
44
config-version: 2
55

@@ -14,7 +14,12 @@ vars:
1414
xero_organization_identifier: "xero_organization_data"
1515
xero_bank_transaction_identifier: "xero_bank_transaction_data"
1616
xero_credit_note_identifier: "xero_credit_note_data"
17-
xero_schema: xero_integration_tests_2
17+
xero_invoice_line_item_has_tracking_category_identifier: "xero_invoice_line_item_has_tracking_category_data"
18+
xero_journal_line_has_tracking_category_identifier: "xero_journal_line_has_tracking_category_data"
19+
xero_tracking_category_identifier: "xero_tracking_category_data"
20+
xero_tracking_category_has_option_identifier: "xero_tracking_category_has_option_data"
21+
xero_tracking_category_option_identifier: "xero_tracking_category_option_data"
22+
xero_schema: xero_integration_tests_7
1823

1924
models:
2025
+schema: "xero_{{ var('directed_schema','dev') }}"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
invoice_id,line_item_id,tracking_category_id,option,_fivetran_synced
2+
533adbeb-5ebb-43c1-9078-7db8c48a057c,52ac1d34-e292-41e9-8760-518f166c6f2d,ab27f5a3-e4d6-49a2-b7c4-812f7e931a50,Client Project A,2021-02-04 18:00:17.876 UTC
3+
533adbeb-5ebb-43c1-9078-7db8c48a057c,52ac1d34-e292-41e9-8760-518f166c6f2d,f3129a78-67cf-4d30-a501-20b6d98c837e,Engineering Cost,2021-02-04 18:00:17.876 UTC
4+
533adbeb-5ebb-43c1-9078-7db8c48a057c,52ac1d34-e292-41e9-8760-518f166c6f2d,20fd4c53-9ae2-4229-8d9e-9d7cb6421f14,North America,2021-02-04 18:00:17.876 UTC
5+
b2e2a55c-2f15-472a-8dbc-2012ad19a793,81831b9f-daa9-4808-9b66-a41c3d6a2961,8e91ad4b-6d04-4b77-918a-5127b24f35ec,Engineering,2022-02-04 18:00:17.876 UTC
6+
b2e2a55c-2f15-472a-8dbc-2012ad19a793,81831b9f-daa9-4808-9b66-a41c3d6a2961,5c8e34b2-ff1a-4e7b-9023-654db41ce9d2,New York,2022-02-04 18:00:17.876 UTC
7+
b2e2a55c-2f15-472a-8dbc-2012ad19a793,81831b9f-daa9-4808-9b66-a41c3d6a2961,20fd4c53-9ae2-4229-8d9e-9d7cb6421f14,Europe,2022-02-04 18:00:17.876 UTC
8+
231940bd-bcdd-460f-83aa-05da8383e967,eb9d72ea-00e3-4b65-8e30-8e98a7177053,ab27f5a3-e4d6-49a2-b7c4-812f7e931a50,Internal Project B,2023-02-04 18:00:17.876 UTC
9+
231940bd-bcdd-460f-83aa-05da8383e967,eb9d72ea-00e3-4b65-8e30-8e98a7177053,8e91ad4b-6d04-4b77-918a-5127b24f35ec,Sales,2023-02-04 18:00:17.876 UTC

0 commit comments

Comments
 (0)