Skip to content

Commit 36ab649

Browse files
Bug/date not recognized (#54)
* MagicBot/add-model-counts updates * bug/date-not-recognized * revisions * update ymls & add tests * regen docs * update for next vs last year * regen docs * delete .gitkeep * Update readme and changelog
1 parent ef704cd commit 36ab649

14 files changed

+252
-58
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
# dbt_xero v0.7.0
2+
[PR #54](https://github.com/fivetran/dbt_xero/pull/54) includes the following updates:
3+
4+
## Breaking Changes
5+
- Corrected the calculation of `current_year_end_date` in the `xero__balance_sheet_report` model. Previously, `current_year_end_date` was miscalculated in certain scenarios, impacting the classification of records with the `account_name` value "Retained Earnings."
6+
- This is labeled as a breaking change since it may affect prior labels assigned. We recommend reviewing your records to ensure they align with this corrected logic.
7+
8+
## Bug Fixes
9+
- Updated the `xero__balance_sheet` model to resolve a run error when an organization's financial year end date is February 29.
10+
11+
## Documentation
12+
- Updated README formatting for consistency with other packages.
13+
- Added Quickstart model counts to README. ([#52](https://github.com/fivetran/dbt_xero/pull/52))
14+
- Corrected references to connectors and connections in the README. ([#52](https://github.com/fivetran/dbt_xero/pull/52))
15+
16+
## Under the Hood (maintainers only)
17+
- Added consistency tests for the end models.
18+
119
# dbt_xero v0.6.2
220
[PR #46](https://github.com/fivetran/dbt_xero/pull/46) includes the following updates:
321

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<p align="center">
1+
# Xero Transformation dbt Package ([Docs](https://fivetran.github.io/dbt_xero/))
2+
3+
<p align="left">
24
<a alt="License"
35
href="https://github.com/fivetran/dbt_xero/blob/main/LICENSE">
46
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" /></a>
@@ -8,9 +10,11 @@
810
<img src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" /></a>
911
<a alt="PRs">
1012
<img src="https://img.shields.io/badge/Contributions-welcome-blueviolet" /></a>
13+
<a alt="Fivetran Quickstart Compatible"
14+
href="https://fivetran.com/docs/transformations/dbt/quickstart">
15+
<img src="https://img.shields.io/badge/Fivetran_Quickstart_Compatible%3F-yes-green.svg" /></a>
1116
</p>
1217

13-
# Xero Transformation dbt Package ([Docs](https://fivetran.github.io/dbt_xero/))
1418
## What does this dbt package do?
1519
- Produces modeled tables that leverage Xero data from [Fivetran's connector](https://fivetran.com/docs/applications/xero) in the format described by [this ERD](https://fivetran.com/docs/applications/xero#schemainformation) and builds off the output of our [Xero source package](https://github.com/fivetran/dbt_xero_source).
1620

@@ -28,14 +32,16 @@ The following table provides a detailed list of all tables materialized within t
2832
| [xero__balance_sheet_report](https://github.com/fivetran/dbt_xero/blob/main/models/xero__balance_sheet_report.sql) | Each record represents the state of the balance sheet for a given account on a given month. |
2933
| [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. |
3034

35+
### 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`.
3137
<!--section-end-->
3238

3339
## How do I use the dbt package?
3440

3541
### Step 1: Prerequisites
3642
To use this dbt package, you must have the following:
3743

38-
- At least one Fivetran Xero connector syncing data into your destination.
44+
- At least one Fivetran Xero connection syncing data into your destination.
3945
- A **BigQuery**, **Snowflake**, **Redshift**, **PostgreSQL**, or **Databricks** destination.
4046

4147
### Step 2: Install the package
@@ -44,7 +50,7 @@ Include the following xero package version in your `packages.yml` file:
4450
```yaml
4551
packages:
4652
- package: fivetran/xero
47-
version: [">=0.6.0", "<0.7.0"] # we recommend using ranges to capture non-breaking changes automatically
53+
version: [">=0.7.0", "<0.8.0"] # we recommend using ranges to capture non-breaking changes automatically
4854
```
4955
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.
5056
### Step 3: Define database and schema variables
@@ -63,8 +69,8 @@ vars:
6369

6470
If you are using multi-currency accounting in Xero, you are likely to have unrealized currency gains as part of your profit and loss statement. These gains/losses do not exist within the actual journals in Xero. As a result, you will find that those lines are missing from the outputs of this package. All realised currency gains will be present and your balance sheet will still balance.
6571

66-
#### Unioning Multiple Xero Connectors
67-
If you have multiple Xero connectors in Fivetran and would like to use this package on all of them simultaneously, we have provided functionality to do so. The package will union all of the data together and pass the unioned table into the transformations. You will be able to see which source it came from in the `source_relation` column of each model. To use this functionality, you will need to set **either** (**note that you cannot use both**) the `union_schemas` or `union_databases` variables:
72+
#### Unioning Multiple Xero Connections
73+
If you have multiple Xero connections in Fivetran and would like to use this package on all of them simultaneously, we have provided functionality to do so. The package will union all of the data together and pass the unioned table into the transformations. You will be able to see which source it came from in the `source_relation` column of each model. To use this functionality, you will need to set **either** (**note that you cannot use both**) the `union_schemas` or `union_databases` variables:
6874

6975
```yml
7076
# dbt_project.yml

dbt_project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'xero'
2-
version: '0.6.2'
2+
version: '0.7.0'
33
config-version: 2
44
require-dbt-version: [">=1.3.0", "<2.0.0"]
55
vars:

docs/catalog.json

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

docs/index.html

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

docs/manifest.json

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

docs/run_results.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

integration_tests/dbt_project.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: 'xero_integration_tests'
2-
version: '0.6.2'
2+
version: '0.7.0'
33
profile: 'integration_tests'
44
config-version: 2
5+
56
vars:
67
xero_source:
78
xero_account_identifier: "xero_account_data"
@@ -15,6 +16,9 @@ vars:
1516
xero_credit_note_identifier: "xero_credit_note_data"
1617
xero_schema: xero_integration_tests_2
1718

19+
models:
20+
+schema: "xero_{{ var('directed_schema','dev') }}"
21+
1822
dispatch:
1923
- macro_namespace: dbt_utils
2024
search_order: ['spark_utils', 'dbt_utils']
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{{ config(
2+
tags="fivetran_validations",
3+
enabled=var('fivetran_validation_tests_enabled', false)
4+
) }}
5+
6+
with prod as (
7+
select *
8+
from {{ target.schema }}_xero_prod.xero__balance_sheet_report
9+
),
10+
11+
dev as (
12+
select *
13+
from {{ target.schema }}_xero_dev.xero__balance_sheet_report
14+
),
15+
16+
prod_not_in_dev as (
17+
-- rows from prod not found in dev
18+
select * from prod
19+
except distinct
20+
select * from dev
21+
),
22+
23+
dev_not_in_prod as (
24+
-- rows from dev not found in prod
25+
select * from dev
26+
except distinct
27+
select * from prod
28+
),
29+
30+
final as (
31+
select
32+
*,
33+
'from prod' as source
34+
from prod_not_in_dev
35+
36+
union all -- union since we only care if rows are produced
37+
38+
select
39+
*,
40+
'from dev' as source
41+
from dev_not_in_prod
42+
)
43+
44+
select *
45+
from final
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{{ config(
2+
tags="fivetran_validations",
3+
enabled=var('fivetran_validation_tests_enabled', false)
4+
) }}
5+
6+
with prod as (
7+
select *
8+
from {{ target.schema }}_xero_prod.xero__general_ledger
9+
),
10+
11+
dev as (
12+
select *
13+
from {{ target.schema }}_xero_dev.xero__general_ledger
14+
),
15+
16+
prod_not_in_dev as (
17+
-- rows from prod not found in dev
18+
select * from prod
19+
except distinct
20+
select * from dev
21+
),
22+
23+
dev_not_in_prod as (
24+
-- rows from dev not found in prod
25+
select * from dev
26+
except distinct
27+
select * from prod
28+
),
29+
30+
final as (
31+
select
32+
*,
33+
'from prod' as source
34+
from prod_not_in_dev
35+
36+
union all -- union since we only care if rows are produced
37+
38+
select
39+
*,
40+
'from dev' as source
41+
from dev_not_in_prod
42+
)
43+
44+
select *
45+
from final

0 commit comments

Comments
 (0)