Skip to content

Commit

Permalink
feature/custom-field-mapping update
Browse files Browse the repository at this point in the history
  • Loading branch information
fivetran-joemarkiewicz committed Apr 12, 2022
1 parent 9609c29 commit a1d5865
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# dbt_jira v0.8.0
## 🚨 Breaking Changes 🚨
- Previously the `jira__daily_field_history` and `jira__issue_enhanced` models allowed for users to leverage the `issue_field_history_columns` to bring through custom `field_id`s. However, the `field_id` was not very intuitive to report off. Therefore, the package has been updated to bring through the `field_name` values in the variable and persist through to the final models.
- Please note, if you leveraged this variable in the past then you will want to update the `filed_id` (customfield_000123) to be the `field_name` (Cool Custom Field) now. Further, a `dbt run --full-refresh` will be required as well.
# dbt_jira v0.7.0
🎉 dbt v1.0.0 Compatibility 🎉
## 🚨 Breaking Changes 🚨
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ vars:
```

### Daily Issue Field History Columns
The `jira__daily_issue_field_history` model generates historical data for the columns specified by the `issue_field_history_columns` variable. By default, the only columns tracked are `status` and `sprint`, but all fields found in the `field_id` column within the Jira `FIELD` table can be included in this model. The most recent value of any tracked column is also captured in `jira__issue_enhanced`.
The `jira__daily_issue_field_history` model generates historical data for the columns specified by the `issue_field_history_columns` variable. By default, the only columns tracked are `status` and `sprint`, but all fields found in the `field_name` column within the Jira `FIELD` table can be included in this model. The most recent value of any tracked column is also captured in `jira__issue_enhanced`.

If you would like to change these columns, add the following configuration to your dbt_project.yml file. Then, after adding the columns to your `dbt_project.yml` file, run the `dbt run --full-refresh` command to fully refresh any existing models.

Expand All @@ -59,7 +59,7 @@ config-version: 2
vars:
jira:
issue_field_history_columns: ['the', 'list', 'of', 'field', 'IDs']
issue_field_history_columns: ['the', 'list', 'of', 'field', 'names']
```

> Note: `sprint` and `status` will always be tracked, as they are necessary for creating common agile reports.
Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'jira'
version: '0.7.0'
version: '0.8.0'
config-version: 2
require-dbt-version: [">=1.0.0", "<2.0.0"]

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'jira_integration_tests'
version: '0.6.0'
version: '0.8.0'
config-version: 2
profile: 'integration_tests'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ limit_to_relevant_fields as (

from combined_field_histories

where lower(field_name) = 'sprint' -- As sprint is a custom field, we filter by field name only for sprint. All others are on field_id.
or lower(field_id) in ('status'
where lower(field_id) = 'status' -- As sprint is a custom field, we filter by field name only for sprint. All others are on field_id.
or lower(field_name) in ('status'

This comment has been minimized.

Copy link
@troyschuetrumpf-elation

troyschuetrumpf-elation Jun 22, 2022

Contributor

status should be renamed to sprint

{%- for col in var('issue_field_history_columns', []) -%}
, {{ "'" ~ (col|lower) ~ "'" }}
,'{{ (col|lower) }}'
{%- endfor -%} )

),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pivot_out as (

{% for col in var('issue_field_history_columns', []) -%}
,
max(case when lower(field_id) = '{{ col | lower }}' then field_value end) as {{ col | replace(' ', '_') | lower }}
max(case when lower(field_name) = '{{ col|lower }}' then field_value end) as {{ dbt_utils.slugify(col) | replace(' ', '_') | lower }}
{% endfor -%}

from daily_field_history
Expand Down

0 comments on commit a1d5865

Please sign in to comment.