Skip to content
2 changes: 2 additions & 0 deletions .quickstart/quickstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ table_variables:
- version
jira_using_priorities:
- priority
jira_using_teams:
- team

destination_configurations:
databricks:
Expand Down
26 changes: 19 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
# dbt_jira v1.1.0

## Schema Updates

**6 total changes • 4 possible breaking changes**

| Data Model | Change Type | Old | New | Notes |
|---------------------------------------------------|-------------|----------|-------------------------------------------|-------------------------------------------------------------------|
## Schema/Data Change
**9 total changes • 7 possible breaking changes**
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated

| Data Model(s) | Change type | Old | New | Notes |
| ---------- | ----------- | -------- | -------- | ----- |
| `stg_jira__team` | New model | N/A | New staging model | Added staging model for Jira teams functionality. |
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated
| `jira__daily_issue_field_history` | Column addition | N/A | `team` | Added team column to track team assignments for issues over time. |
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated
| `jira__issue_enhanced` | Column addition | N/A | `team` | Added team column to provide current team assignment for each issue. |
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated
| [jira__timestamp_issue_field_history](https://fivetran.github.io/dbt_jira/#!/model/model.jira.jira__timestamp_issue_field_history) | New Model | | | SCD Type 2 table tracking field changes at timestamp level with validity periods. Each record shows complete field state during a time period with `valid_from`/`valid_until` timestamps. |
| [int_jira__pivot_timestamp_field_history](https://fivetran.github.io/dbt_jira/#!/model/model.jira.int_jira__pivot_timestamp_field_history) | New Model | | | Pivots field history into columns at timestamp level, capturing ALL field changes rather than daily snapshots. |
| [int_jira__timestamp_field_history_scd](https://fivetran.github.io/dbt_jira/#!/model/model.jira.int_jira__timestamp_field_history_scd) | New Model | | | SCD logic that backfills field values at timestamp level, showing complete field state at each update timestamp. |
| [stg_jira__issue_field_history](https://fivetran.github.io/dbt_jira_source/#!/model/model.jira_source.stg_jira__issue_field_history) | New Column | | `author_id` | Tracks which user made each field change for audit trail and change attribution. |
| [stg_jira__issue_multiselect_history](https://fivetran.github.io/dbt_jira_source/#!/model/model.jira_source.stg_jira__issue_multiselect_history) | New Column | | `author_id` | Tracks which user made each multiselect field change for audit trail and change attribution. |
| [jira__timestamp_issue_field_history](https://fivetran.github.io/dbt_jira/#!/model/model.jira.jira__timestamp_issue_field_history) | New Columns | | `author_id`, `status_id`, `is_current_record` | Adds user attribution, raw status ID alongside resolved status name, and current record indicator for SCD Type 2 functionality. |


## Feature Update
- Added support for Jira teams functionality by introducing staging models `stg_jira__team` and `stg_jira__team_tmp`.
Comment thread
fivetran-savage marked this conversation as resolved.
- Enhanced issue field history models to include team information by joining with team data when the field type is 'team'.
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated
- Added team column to the `jira__daily_issue_field_history` model to track team assignments over time.
- Added team column to the `jira__issue_enhanced` model to provide current team assignment for each issue.
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated

## Under the Hood
- Added new seed file `team.csv` for integration testing.
- Added team-related test data to `issue.csv`, `issue_field_history.csv`, and `field.csv` seed files.
- Created `get_team_columns` macro for consistent team column definitions.
- Updated package variables to include team source reference and team identifier configuration.

# dbt_jira v1.0.0

Expand Down
1 change: 1 addition & 0 deletions dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ vars:
field: "{{ source('jira', 'field') }}"
field_option: "{{ source('jira', 'field_option') }}"
sprint: "{{ source('jira', 'sprint') }}"
team: "{{ source('jira', 'team') }}"
version: "{{ source('jira', 'version') }}"
jira_issue_history_buffer: 1

Expand Down
1 change: 1 addition & 0 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ vars:
jira_user_group_identifier: "user_group"
jira_user_identifier: "user"
jira_version_identifier: "version"
jira_team_identifier: "team"

models:
jira:
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/seeds/field.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ issuerestriction,2020-11-23 22:20:39.643,false,false,Restrict to
components,2020-11-23 22:20:40.643,false,false,Components
summary,2020-11-23 22:20:41.553,false,false,Summary
epiclink,2020-11-23 22:20:41.553,false,false,Epic-Link
epic,2020-11-23 22:20:41.553,false,false,Epic
epic,2020-11-23 22:20:41.553,false,false,Epic
customfield_10001,2020-11-23 22:20:41.553,false,true,Team
1 change: 1 addition & 0 deletions integration_tests/seeds/issue.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ id,_fivetran_deleted,_fivetran_synced,_original_estimate,_remaining_estimate,_ti
10011,FALSE,2020-11-06 22:23:38,,,,,2020-04-01 08:33:58,5c3326c24b248c315badf3ee,"Yes, this is an issue to test permissions",,,10103,TP-8,,,,3,10001,,5c3326c24b248c315badf3ee,,2020-05-29 11:33:53,3,2020-04-01 08:34:02,We want to test permissions,,2020-05-29 11:33:53,-1,10103
10015,FALSE,2020-11-06 22:23:41,,,,,2020-06-11 07:38:03,5ed0edbe2999b60c23255b4f,,,,,TP-12,,,,5,10001,,5ed0edbe2999b60c23255b4f,,2020-06-11 07:38:03,10003,2020-06-11 07:38:03,Part of test epic,,2020-06-11 07:38:03,-1,10103
10018,FALSE,2020-11-12 12:20:50,,,,,2020-11-10 19:11:45,557058:a9572f6a-3041-435a-96ed-5286e3811b33,,,,10103,TCP-1,2020-11-10 19:11:46,,,3,10005,,557058:a9572f6a-3041-435a-96ed-5286e3811b33,,2020-11-28 19:11:45,10003,2020-11-28 19:11:46,this is a story,,2020-11-28 19:11:45,-1,
10027,FALSE,2020-11-12 12:20:50,,,,,2020-11-15 19:11:45,5ed0edbe2999b60c23255b4f,Test issue to see if teams data populates,,,10103,TP-10,,,,1,10005,,5ed0edbe2999b60c23255b4f,,,3,,just a regular issue,,,,
19 changes: 11 additions & 8 deletions integration_tests/seeds/issue_field_history.csv
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
field_id,issue_id,time,_fivetran_synced,value,author_id,is_active
created,10027,2020-11-10 19:19:41.472,2020-11-12 12:20:53.478,2020-11-10T19:19:41.472Z,5e61c1c5c8bee8005f04c88b,true
customfield_10104,10027,2020-11-10 19:19:41.472,2020-11-12 12:20:53.472,3.0,5e61c1c5c8bee8005f04c88b,true
summary,10027,2020-11-10 19:19:41.472,2020-11-12 12:20:53.500,"As a developer, I'd like to update story status during the sprint >> Click the Active sprints link at the top right of the screen to go to the Active sprints where the current Sprint's items can be updated",5e61c1c5c8bee8005f04c88b,true
components,10018,2020-11-10 19:19:41.472,2020-11-19 12:20:53.500,10019,5e61c1c5c8bee8005f04c88c,true
summary,10018,2020-11-10 19:19:41.472,2020-11-19 12:20:53.500,10026,5e61c1c5c8bee8005f04c88c,true
epic,10015,2020-11-10 19:19:41.472,2020-11-19 12:20:53.500,1111111,5e61c1c5c8bee8005f04c88d,true
epiclink,10018,2020-11-10 19:19:41.472,2020-11-12 12:20:53.500,https://ulr-here/epic-key,5e61c1c5c8bee8005f04c88c,true
field_id,issue_id,time,_fivetran_synced,value,is_active,author_id
created,10027,2020-11-10 19:19:41.472,2020-11-12 12:20:53.478,2020-11-10T19:19:41.472Z,true,5e61c1c5c8bee8005f04c88b
customfield_10104,10027,2020-11-10 19:19:41.473,2020-11-12 12:20:53.472,3.0,true,5e61c1c5c8bee8005f04c88b
summary,10027,2020-11-10 19:19:41.474,2020-11-12 12:20:53.500,"As a developer, I'd like to update story status during the sprint >> Click the Active sprints link at the top right of the screen to go to the Active sprints where the current Sprint's items can be updated",true,5e61c1c5c8bee8005f04c88b
components,10018,2020-11-10 19:19:41.475,2020-11-19 12:20:53.501,10019,true,5e61c1c5c8bee8005f04c88c
summary,10018,2020-11-10 19:19:41.476,2020-11-19 12:20:53.502,10026,true,5e61c1c5c8bee8005f04c88c
epic,10015,2020-11-10 19:19:41.477,2020-11-19 12:20:53.503,1111111,true,5e61c1c5c8bee8005f04c88d
epiclink,10018,2020-11-10 19:19:41.478,2020-11-12 12:20:53.504,https://ulr-here/epic-key,true,5e61c1c5c8bee8005f04c88c
customfield_10001,10027,2020-11-10 19:19:41.479,2020-11-12 12:20:53.505,01e9ac93-bccf-4ad2-af92-3317a37ec67b,true,5e61c1c5c8bee8005f04c88c
customfield_10001,10018,2020-11-10 19:19:41.480,2020-11-12 12:20:53.506,1bc241c7-6926-4b46-94b7-82d25069f067,true,5e61c1c5c8bee8005f04c88c
customfield_10001,10015,2020-11-10 19:19:41.481,2020-11-12 12:20:53.507,e74a1782-f463-4542-8440-66de07d4b083,true,5e61c1c5c8bee8005f04c88c
6 changes: 3 additions & 3 deletions integration_tests/seeds/issue_multiselect_history.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_fivetran_id,time,_fivetran_synced,field_id,issue_id,value,author_id,is_active
w4UiT+hPMxJp3RhL/YFJm3uWL5U=,2020-11-10 19:19:41.472,2020-11-12 12:20:53.506,subtasks,10027,0,5e61c1c5c8bee8005f04c88b,true
4pVgGn0qSqR2hCmMdo4wWHXmgew=,2020-11-10 19:19:41.472,2020-11-12 12:20:53.479,customfield_10021,10027,0,5e61c1c5c8bee8005f04c88b,true
/zrY8m6q0VMW6ia1jGIerXqLIgQ=,2020-11-10 19:19:41.472,2020-11-12 12:20:53.479,customfield_10020,10027,0,5e61c1c5c8bee8005f04c88b,true
3p3gGn0qSqR2hCmMdo4wWHXa32m=,2020-11-10 19:19:41.472,2020-11-12 12:20:53.479,components,10027,0,5e61c1c5c8bee8005f04c88b,true
4pVgGn0qSqR2hCmMdo4wWHXmgew=,2020-11-10 19:19:42.472,2020-11-12 12:20:53.479,customfield_10021,10027,0,5e61c1c5c8bee8005f04c88b,true
/zrY8m6q0VMW6ia1jGIerXqLIgQ=,2020-11-10 19:19:43.472,2020-11-12 12:20:53.479,customfield_10020,10027,0,5e61c1c5c8bee8005f04c88b,true
3p3gGn0qSqR2hCmMdo4wWHXa32m=,2020-11-10 19:19:44.472,2020-11-12 12:20:53.479,components,10027,0,5e61c1c5c8bee8005f04c88b,true
6 changes: 6 additions & 0 deletions integration_tests/seeds/team.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
id,is_shared,is_visible,name,title,_fivetran_synced
01e9ac93-bccf-4ad2-af92-3317a37ec67b,true,true,HR,HR,2020-11-23 22:20:39.685
891da445-73e5-49b9-9d0d-89f6a587822a,true,true,Cloud Security,Cloud Security,2020-11-23 22:20:39.711
1bc241c7-6926-4b46-94b7-82d25069f067,true,true,People Ops,People Ops,2020-11-23 22:20:39.643
e74a1782-f463-4542-8440-66de07d4b083,true,true,Detection & Response,Detection & Response,2020-11-23 22:20:40.643
d8a8402f-bc1b-4990-9b11-06a52d2de68a,true,true,Platform Security,Platform Security,2020-11-23 22:20:41.553
14 changes: 14 additions & 0 deletions macros/staging/get_team_columns.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% macro get_team_columns() %}

{% set columns = [
{"name": "_fivetran_synced", "datatype": dbt.type_timestamp()},
{"name": "id", "datatype": dbt.type_string()},
{"name": "is_shared", "datatype": "boolean"},
{"name": "is_visible", "datatype": "boolean"},
{"name": "name", "datatype": dbt.type_string()},
{"name": "title", "datatype": dbt.type_string()},
] %}

{{ return(columns) }}

{% endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,42 @@ fields as (

),

{% if var('jira_using_teams', True) %}
teams as (

select *
from {{ ref('stg_jira__team') }}
),
{% endif %}

joined as (

select
field_history.*,
lower(fields.field_name) as field_name
field_history.field_id,
field_history.issue_id,
field_history.updated_at,
{% if var('jira_using_teams', True) %}
-- if the field is 'team', we want to replace the value with the team name
-- otherwise, just use the value as is
case when lower(fields.field_name) = 'team' then teams.team_name
else field_history.field_value end as field_value,
{% else %}
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated
field_history.field_value,
{% endif %}
lower(fields.field_name) as field_name,
field_history.is_active,
field_history.author_id,
field_history._fivetran_synced

from field_history
join fields
on fields.field_id = field_history.field_id
{% if var('jira_using_teams', True) %}
left join teams on lower(fields.field_name) = 'team'
and cast(field_history.field_value as {{ dbt.type_string() }}) = cast(teams.team_id as {{ dbt.type_string() }})
{% endif %}

)

select *
from joined
from joined
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ limit_to_relevant_fields as (
from get_valid_dates

where lower(field_id) = 'status'
or lower(field_name) in ('sprint', 'story points', 'story point estimate'
or lower(field_name) in ('sprint', 'story points', 'story point estimate', 'team'
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated
{%- for col in var('issue_field_history_columns', []) -%}
,'{{ (col|lower) }}'
{%- endfor -%} )
Expand Down Expand Up @@ -157,7 +157,8 @@ pivot_out as (
max(case when lower(field_id) = 'status' then field_value end) as status,
max(case when lower(field_name) = 'sprint' then field_value end) as sprint,
max(case when lower(field_name) = 'story points' then field_value end) as story_points,
max(case when lower(field_name) = 'story point estimate' then field_value end) as story_point_estimate
max(case when lower(field_name) = 'story point estimate' then field_value end) as story_point_estimate,
max(case when lower(field_name) = 'team' then field_value end) as team
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated

{% for col in var('issue_field_history_columns', []) -%}
{% if col|lower not in ['story points', 'story point estimate'] %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ limit_to_relevant_fields as (
combine_field_history.*
from combine_field_history
where lower(field_id) = 'status'
or lower(field_name) in ('sprint', 'story points', 'story point estimate'
or lower(field_name) in ('sprint', 'story points', 'story point estimate', 'team'
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated
{%- for col in var('issue_field_history_columns', []) -%}
,'{{ (col|lower) }}'
{%- endfor -%} )
Expand Down Expand Up @@ -82,7 +82,8 @@ final as (
max(case when lower(field_id) = 'status' then field_value end) as status,
max(case when lower(field_name) = 'sprint' then field_value end) as sprint,
max(case when lower(field_name) = 'story points' then field_value end) as story_points,
max(case when lower(field_name) = 'story point estimate' then field_value end) as story_point_estimate
max(case when lower(field_name) = 'story point estimate' then field_value end) as story_point_estimate,
max(case when lower(field_name) = 'team' then field_value end) as team
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated

{% for col in var('issue_field_history_columns', []) -%}
{% if col|lower not in ['story points', 'story point estimate'] %}
Expand Down
Loading