Skip to content

Commit df50650

Browse files
Merge pull request #34 from fivetran/feature/extend-history
Feature/extend history
2 parents e86f414 + e85a0ac commit df50650

File tree

9 files changed

+36
-28
lines changed

9 files changed

+36
-28
lines changed

.circleci/config.yml

-11
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,6 @@ jobs:
2525
pip install -r integration_tests/requirements.txt
2626
mkdir -p ~/.dbt
2727
cp integration_tests/ci/sample.profiles.yml ~/.dbt/profiles.yml
28-
- run:
29-
name: "Run Tests - Spark"
30-
command: |
31-
. venv/bin/activate
32-
echo `pwd`
33-
cd integration_tests
34-
dbt deps
35-
dbt seed --target spark --full-refresh
36-
dbt run --target spark --full-refresh
37-
dbt run --target spark
38-
dbt test --target spark
3928
- run:
4029
name: "Run Tests - Postgres"
4130
command: |

README.md

+21-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[![Apache License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![dbt logo and version](https://img.shields.io/static/v1?logo=dbt&label=dbt-version&message=0.20.x&color=orange)
12
# Jira ([docs](https://fivetran-dbt-jira.netlify.app/#!/overview))
23

34
This package models Jira data from [Fivetran's connector](https://fivetran.com/docs/applications/jira). It uses data in the format described by [this ERD](https://fivetran.com/docs/applications/jira/#schemainformation).
@@ -28,7 +29,7 @@ Check [dbt Hub](https://hub.getdbt.com/) for the latest installation instruction
2829
# packages.yml
2930
packages:
3031
- package: fivetran/jira
31-
version: [">=0.3.0", "<0.4.0"]
32+
version: [">=0.4.0", "<0.5.0"]
3233
```
3334
3435
## Configuration
@@ -61,10 +62,26 @@ vars:
6162
issue_field_history_columns: ['the', 'list', 'of', 'field', 'IDs']
6263
```
6364

64-
> Note: `sprint` and `status` will always be tracked, as they are necessary for creating common agile reports.
65+
> Note: `sprint` and `status` will always be tracked, as they are necessary for creating common agile reports.
6566

66-
### Disabling models
67+
### Extending an Issue's History Period
68+
This package will create a row in `jira__daily_issue_field_history` for each day that an issue is open or being updated. For currently open issues, the latest date will be the current date. For closed issues, the latest date will be when the issue was last resolved or updated in any way, plus a _buffer period_ that is by default equal to 1 month. This buffer exists for two reasons:
69+
1. The daily issue field history model is materialized incrementally, and if your closed issues are being opened or updated often, this will avoid requiring a full refresh to catch these changes.
70+
2. You may want to create a longer timeline of issues, regardless of their status, for easier reporting.
6771

72+
If you would like to extend this buffer period to longer than 1 month, add the following configuration to your `dbt_project.yml` file:
73+
74+
```yml
75+
# dbt_project.yml
76+
77+
...
78+
config-version: 2
79+
80+
vars:
81+
jira_issue_history_buffer: integer_number_of_months # default is an interval of 1 month
82+
```
83+
84+
### Disabling Models
6885
It's possible that your Jira connector does not sync every table that this package expects. If your syncs exclude certain tables, it is because you either don't use that functionality in Jira or actively excluded some tables from your syncs. To disable the corresponding functionality in the package, you must add the relevant variables. By default, all variables are assumed to be `true`. Add variables for only the tables you would like to disable:
6986

7087
```yml
@@ -99,7 +116,7 @@ and running the package? If so, we highly encourage and welcome contributions to
99116
Please create issues or open PRs against `master`. Check out [this post](https://discourse.getdbt.com/t/contributing-to-a-dbt-package/657) on the best workflow for contributing to a package.
100117

101118
## Database Support
102-
This package has been tested on BigQuery, Snowflake and Redshift.
119+
This package has been tested on BigQuery, Snowflake, Redshift, and Postgres.
103120

104121
## Resources:
105122
- Provide [feedback](https://www.surveymonkey.com/r/DQ7K7WW) on our existing dbt packages or what you'd like to see next

dbt_project.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: 'jira'
2-
version: '0.3.1'
2+
version: '0.4.0'
33
config-version: 2
4-
require-dbt-version: [">=0.18.0", "<0.20.0"]
4+
require-dbt-version: ">=0.20.0"
55

66

77
vars:
@@ -23,11 +23,11 @@ vars:
2323
field: "{{ ref('stg_jira__field') }}"
2424
sprint: "{{ ref('stg_jira__sprint') }}"
2525
version: "{{ ref('stg_jira__version') }}"
26+
2627
jira_include_comments: true # this package aggregates issue comments so that you have a single view of all your comments in the jira__issue_enhanced table. This can cause limit errors if you have a large dataset. Disable to remove this functionality.
2728
jira_using_sprints: true # disable if you are not using sprints in Jira
29+
jira_issue_history_buffer: 1 # in months
2830

29-
dbt_utils_dispatch_list: [spark_utils, fivetran_utils]
30-
fivetran_utils_dispatch_list: [spark_utils]
3131

3232
models:
3333
jira:

integration_tests/dbt_project.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'jira_integration_tests'
2-
version: '0.3.1'
2+
version: '0.4.0'
33
config-version: 2
44
profile: 'integration_tests'
55

integration_tests/requirements.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
dbt==0.19.1
2-
dbt-spark==0.19.1
3-
dbt-spark[PyHive]==0.19.1
1+
dbt~=0.20.0
2+
dbt-spark~=0.20.0
3+
dbt-spark[PyHive]~=0.20.0

models/intermediate/field_history/int_jira__issue_calendar_spine.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ issue_spine as (
6565
from spine
6666
join issue_dates on
6767
issue_dates.created_on <= spine.date_day
68-
and {{ dbt_utils.dateadd('month', 1, 'issue_dates.open_until') }} >= spine.date_day
68+
and {{ dbt_utils.dateadd('month', var('jira_issue_history_buffer', 1), 'issue_dates.open_until') }} >= spine.date_day
6969
-- if we cut off issues, we're going to have to do a full refresh to catch issues that have been un-resolved
7070

7171
group by 1,2

models/jira.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ models:
55
description: >
66
Each record represents a snapshot of an issue's selected fields (as specified in
77
the `issue_history_columns` variable + sprint and status by default) on a given day.
8-
Each issue will have a record for every day in which it was open (plus a month afterward,
9-
in case issues are reopened -- if they are reopened even later, you'll need to perform a full refresh).
8+
Each issue will have a record for every day in which it was open and/or being updated.
9+
For currently open issues, the latest date will be the current date, and for closed issues,
10+
this will be the last time the issue was resolved OR updated in any way (plus a configurable buffer afterward,
11+
set to a month by default).
1012
Note: this is an incremental model.
1113
columns:
1214
- name: date_day

models/jira__issue_enhanced.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ with issue as (
1010
{%- set issue_data_columns_clean = [] -%}
1111

1212
{%- for k in issue_data_columns -%}
13-
{{ issue_data_columns_clean.append(k.name)|default("", True) }}
13+
{{ issue_data_columns_clean.append(k.name|lower)|default("", True) }}
1414
{%- endfor -%}
1515

1616
daily_issue_field_history as (

packages.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
packages:
22
- package: fivetran/jira_source
3-
version: [">=0.2.0","<0.3.0"]
3+
version: [">=0.3.0","<0.4.0"]

0 commit comments

Comments
 (0)