Skip to content

Commit 93604a9

Browse files
Factor in story/story points no longer being default
1 parent e598091 commit 93604a9

4 files changed

Lines changed: 43 additions & 31 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
# dbt_jira v1.7.0
22

3-
[PR #](https://github.com/fivetran/dbt_jira/pull/) includes the following updates:
3+
[PR #175](https://github.com/fivetran/dbt_jira/pull/175) includes the following updates:
44

55
## Schema/Data Change (--full-refresh required after upgrading)
66
**3 total changes • 3 possible breaking changes**
77

88
| Data Model(s) | Change type | Old | New | Notes |
99
| ---------- | ----------- | -------- | -------- | ----- |
10-
| `jira__daily_issue_field_history`, `jira__issue_enhanced` | Removed default columns (**Breaking Change**) | `story_points` and `story_point_estimate` included by default | Columns only included when added to `var('issue_field_history_columns')` | These fields are Scrum-specific custom fields not universally used. Add the relevant fields to the `issue_field_history_columns` variable to retain them. |
11-
| `jira__sprint_enhanced` | Removed default columns (**Breaking Change**) | `story_points_committed`, `story_points_end`, `story_points_completed`, `story_point_estimate_committed`, `story_point_estimate_end`, and `story_point_estimate_completed` included by default | Columns only included when `'story points'` and/or `'story point estimate'` are added to `var('issue_field_history_columns')` | These metrics depend on `story_points`/`story_point_estimate` being tracked in field history. Add the relevant fields to the `issue_field_history_columns` variable to retain them. |
10+
| `jira__daily_issue_field_history` <br> `jira__daily_sprint_issue_history` <br> `jira__issue_enhanced` | Removed default columns (**Breaking Change**) | `story_points` and `story_point_estimate` included by default | Columns only included when added to `var('issue_field_history_columns')` | These fields are Scrum-specific custom fields not universally used. Add the relevant fields to the `issue_field_history_columns` variable to retain them. |
11+
| `jira__sprint_enhanced` | Removed default columns (**Breaking Change**) | `story_points_committed`, `story_points_end`, `story_points_completed`, `story_point_estimate_committed`, `story_point_estimate_end`, and `story_point_estimate_completed` included by default | Columns only included when `story points` and/or `story point estimate` are added to `var('issue_field_history_columns')` | These metrics depend on `story_points`/`story_point_estimate` being tracked in field history. Add the relevant fields to the `issue_field_history_columns` variable to retain them. |
12+
| `jira__daily_sprint_issue_history` <br> `jira__sprint_enhanced` | Column type change | `story_points` and `story_point_estimate` cast as `float` | Cast as `numeric` | Improves precision for fractional story point values. |
1213

1314
## Documentation
14-
- Updated model descriptions for `jira__daily_issue_field_history`, `jira__timestamp_issue_field_history`, `jira__daily_sprint_issue_history`, and `jira__issue_enhanced` to remove static documentation for `story_points`, `story_point_estimate`, and `team` columns. Removed story point column documentation from `jira__sprint_enhanced` as these columns are dynamic and only present when added to `var('issue_field_history_columns')`.
15+
- Updates model descriptions to remove static documentation for `story_points`, `story_point_estimate`, and `team` columns. Removes story point-related column documentation from `jira__sprint_enhanced` as these columns are dynamic and only present when added to `var('issue_field_history_columns')`.
16+
- To retain story point data, add `story points` and/or `story point estimate` to the `issue_field_history_columns` variable in your `dbt_project.yml` ([See the README for details](https://github.com/fivetran/dbt_jira?tab=readme-ov-file#define-daily-issue-field-history-columns)). Quickstart users can add these fields in the Issue Field History Columns setting.
1517

1618
# dbt_jira v1.6.0
1719

macros/split_sprint_ids.sql

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
daily_issue_field_history.status,
1818
{{ "daily_issue_field_history.team," if using_teams }}
1919
{% if include_story_points %}
20-
cast(daily_issue_field_history.story_points as {{ dbt.type_float() }}) as story_points,
20+
cast(daily_issue_field_history.story_points as {{ dbt.type_numeric() }}) as story_points,
2121
{% endif %}
2222
{% if include_story_point_estimate %}
23-
cast(daily_issue_field_history.story_point_estimate as {{ dbt.type_float() }}) as story_point_estimate,
23+
cast(daily_issue_field_history.story_point_estimate as {{ dbt.type_numeric() }}) as story_point_estimate,
2424
{% endif %}
2525
sprints as sprint_id
2626

@@ -42,10 +42,10 @@
4242
daily_issue_field_history.status,
4343
{{ "daily_issue_field_history.team," if using_teams }}
4444
{% if include_story_points %}
45-
cast(daily_issue_field_history.story_points as {{ dbt.type_float() }}) as story_points,
45+
cast(daily_issue_field_history.story_points as {{ dbt.type_numeric() }}) as story_points,
4646
{% endif %}
4747
{% if include_story_point_estimate %}
48-
cast(daily_issue_field_history.story_point_estimate as {{ dbt.type_float() }}) as story_point_estimate,
48+
cast(daily_issue_field_history.story_point_estimate as {{ dbt.type_numeric() }}) as story_point_estimate,
4949
{% endif %}
5050
sprints.value as sprint_id
5151

@@ -67,10 +67,10 @@
6767
unnest_sprint_id_array.status,
6868
{{ "unnest_sprint_id_array.team," if using_teams }}
6969
{% if include_story_points %}
70-
unnest_sprint_id_array.story_points,
70+
cast(unnest_sprint_id_array.story_points as {{ dbt.type_numeric() }}) as story_points,
7171
{% endif %}
7272
{% if include_story_point_estimate %}
73-
unnest_sprint_id_array.story_point_estimate,
73+
cast(unnest_sprint_id_array.story_point_estimate as {{ dbt.type_numeric() }}) as story_point_estimate,
7474
{% endif %}
7575
cast(sprint_id as {{ dbt.type_string() }}) as sprint_id
7676
from (
@@ -82,10 +82,10 @@
8282
daily_issue_field_history.status,
8383
{{ "daily_issue_field_history.team," if using_teams }}
8484
{% if include_story_points %}
85-
cast(daily_issue_field_history.story_points as {{ dbt.type_float() }}) as story_points,
85+
cast(daily_issue_field_history.story_points as {{ dbt.type_numeric() }}) as story_points,
8686
{% endif %}
8787
{% if include_story_point_estimate %}
88-
cast(daily_issue_field_history.story_point_estimate as {{ dbt.type_float() }}) as story_point_estimate,
88+
cast(daily_issue_field_history.story_point_estimate as {{ dbt.type_numeric() }}) as story_point_estimate,
8989
{% endif %}
9090
split_to_array(sprint, ', ') as super_sprint_ids
9191

@@ -106,10 +106,10 @@
106106
daily_issue_field_history.status,
107107
{{ "daily_issue_field_history.team," if using_teams }}
108108
{% if include_story_points %}
109-
cast(daily_issue_field_history.story_points as {{ dbt.type_float() }}) as story_points,
109+
cast(daily_issue_field_history.story_points as {{ dbt.type_numeric() }}) as story_points,
110110
{% endif %}
111111
{% if include_story_point_estimate %}
112-
cast(daily_issue_field_history.story_point_estimate as {{ dbt.type_float() }}) as story_point_estimate,
112+
cast(daily_issue_field_history.story_point_estimate as {{ dbt.type_numeric() }}) as story_point_estimate,
113113
{% endif %}
114114
sprints as sprint_id
115115

@@ -132,10 +132,10 @@
132132
daily_issue_field_history.status,
133133
{{ "daily_issue_field_history.team," if using_teams }}
134134
{% if include_story_points %}
135-
cast(daily_issue_field_history.story_points as {{ dbt.type_float() }}) as story_points,
135+
cast(daily_issue_field_history.story_points as {{ dbt.type_numeric() }}) as story_points,
136136
{% endif %}
137137
{% if include_story_point_estimate %}
138-
cast(daily_issue_field_history.story_point_estimate as {{ dbt.type_float() }}) as story_point_estimate,
138+
cast(daily_issue_field_history.story_point_estimate as {{ dbt.type_numeric() }}) as story_point_estimate,
139139
{% endif %}
140140
sprints as sprint_id
141141
from daily_issue_field_history

models/jira.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ version: 2
33
models:
44
- name: jira__daily_issue_field_history
55
description: >
6+
Each record represents a daily snapshot of an issue's field values (status and sprint by default,
7+
plus any fields added to the `issue_field_history_columns` variable).
68
Each issue will have a record for every day in which it was open and/or being updated.
79
For currently open issues, the latest date will be the current date, and for closed issues,
810
this will be the last time the issue was resolved OR updated in any way (plus a configurable buffer afterward,
@@ -113,7 +115,7 @@ models:
113115
- name: time_spent_seconds
114116
description: The time that was spent working on this issue, in seconds.
115117
- name: status
116-
description: The name of the status that an issue has on a given day.
118+
description: The name of the status that an issue has on a given day.
117119
- name: is_sprint_active
118120
description: Boolean indicating if the sprint is currently active (started but not completed).
119121
- name: is_sprint_completed

models/jira__sprint_enhanced.sql

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ sprint_start_metrics as (
5858
source_relation,
5959
sprint_id,
6060
{{ "team," if using_teams }}
61-
{{ "sum(case when story_points is null then 0 else story_points end) as story_points_committed," if include_story_points }}
62-
{{ "sum(case when story_point_estimate is null then 0 else story_point_estimate end) as story_point_estimate_committed," if include_story_point_estimate }}
61+
{% if include_story_points %}
62+
sum(case when story_points is null then 0 else story_points end) as story_points_committed,
63+
{% endif %}
64+
{% if include_story_point_estimate %}
65+
sum(case when story_point_estimate is null then 0 else story_point_estimate end) as story_point_estimate_committed,
66+
{% endif %}
6367
count(distinct issue_id) as issues_committed
6468
from daily_sprint_issue_history
6569
-- to capture both sprints that have started or will start in the future
@@ -73,15 +77,15 @@ sprint_end_metrics as (
7377

7478
select
7579
source_relation,
76-
sprint_id,
77-
{{ "team," if using_teams }}
80+
sprint_id
81+
{{ ", team" if using_teams }}
7882
{% if include_story_points %}
79-
sum(case when story_points is null then 0 else story_points end) as story_points_end,
80-
sum(case when is_issue_resolved_in_sprint then story_points else 0 end) as story_points_completed{{ "," if include_story_point_estimate }}
83+
, sum(case when story_points is null then 0 else story_points end) as story_points_end
84+
, sum(case when is_issue_resolved_in_sprint then story_points else 0 end) as story_points_completed
8185
{% endif %}
8286
{% if include_story_point_estimate %}
83-
sum(case when story_point_estimate is null then 0 else story_point_estimate end) as story_point_estimate_end,
84-
sum(case when is_issue_resolved_in_sprint then story_point_estimate else 0 end) as story_point_estimate_completed
87+
, sum(case when story_point_estimate is null then 0 else story_point_estimate end) as story_point_estimate_end
88+
, sum(case when is_issue_resolved_in_sprint then story_point_estimate else 0 end) as story_point_estimate_completed
8589
{% endif %}
8690
from daily_sprint_issue_history
8791
where date_day = cast(sprint_ended_at as date)
@@ -99,12 +103,16 @@ final as (
99103
sprint_metrics_grouped.sprint_ended_at,
100104
sprint_metrics_grouped.sprint_completed_at,
101105
sprint_metrics_grouped.board_id,
102-
{{ "sprint_start_metrics.story_points_committed," if include_story_points }}
103-
{{ "sprint_start_metrics.story_point_estimate_committed," if include_story_point_estimate }}
104-
{{ "sprint_end_metrics.story_points_end," if include_story_points }}
105-
{{ "sprint_end_metrics.story_point_estimate_end," if include_story_point_estimate }}
106-
{{ "sprint_end_metrics.story_points_completed," if include_story_points }}
107-
{{ "sprint_end_metrics.story_point_estimate_completed," if include_story_point_estimate }}
106+
{% if include_story_points %}
107+
sprint_start_metrics.story_points_committed,
108+
sprint_end_metrics.story_points_end,
109+
sprint_end_metrics.story_points_completed,
110+
{% endif %}
111+
{% if include_story_point_estimate %}
112+
sprint_start_metrics.story_point_estimate_committed,
113+
sprint_end_metrics.story_point_estimate_end,
114+
sprint_end_metrics.story_point_estimate_completed,
115+
{% endif %}
108116
sprint_issue_metrics.sprint_assignees,
109117
sprint_issue_metrics.sprint_issues,
110118
sprint_start_metrics.issues_committed,

0 commit comments

Comments
 (0)