Skip to content

Commit

Permalink
Merge pull request #88 from fivetran/rollback/v0.12.1-v0.11.0
Browse files Browse the repository at this point in the history
rollback/v0.12.1-v0.11.0
  • Loading branch information
fivetran-joemarkiewicz authored Feb 14, 2023
2 parents 8f662ae + 7f0c7e6 commit a962897
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 61 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# dbt_jira v0.12.2
## Bug Fixes
- Reverting the changes introduced between v0.12.1 except Databricks compatibility. Please stay tuned for a future release that will integrate the v0.12.1 changes in a bug free release. ([#88](https://github.com/fivetran/dbt_jira/pull/88))
# dbt_jira v0.12.1
## 🚨 Breaking Changes 🚨:
- Fixed `jira__daily_issue_field_history` model to make sure component values are correctly joined into our issue models ([#81](https://github.com/fivetran/dbt_jira/pull/81)).
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ dispatch:
```
## Step 2: Install the package
Include the following jira_source package version in your `packages.yml` file:
Include the following jira package version in your `packages.yml` file:
> TIP: Check [dbt Hub](https://hub.getdbt.com/) for the latest installation instructions or [read the dbt docs](https://docs.getdbt.com/docs/package-management) for more information on installing packages.
```yaml
packages:
- package: fivetran/jira
version: [">=0.11.0", "<0.12.0"]
version: [">=0.12.0", "<0.13.0"]
```
## Step 3: Define database and schema variables
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.12.1'
version: '0.12.2'
config-version: 2
require-dbt-version: [">=1.3.0", "<2.0.0"]
vars:
Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/manifest.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/run_results.json

Large diffs are not rendered by default.

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.12.1'
version: '0.12.2'
config-version: 2
profile: 'integration_tests'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ joined as (
fields.field_name

from issue_multiselect_history
join fields on issue_multiselect_history.field_id = fields.field_id
join fields using (field_id)

)

Expand Down
77 changes: 25 additions & 52 deletions models/jira__daily_issue_field_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,6 @@ statuses as (
from {{ var('status') }}
),


{% if var('jira_using_components', True) %}

component_data as (

select *
from {{ var('component') }}
),

{% endif %}


-- in intermediate/field_history/
calendar as (

Expand All @@ -76,21 +64,16 @@ joined as (
calendar.date_day,
calendar.issue_id

{% if is_incremental() %}
{% for col in pivot_data_columns if col.name|lower == 'components' and var('jira_using_components', True) %}
, coalesce(pivoted_daily_history.components, most_recent_data.component) as components
{% endfor %}
{% for col in pivot_data_columns if col.name|lower not in ['issue_day_id', 'issue_id', 'valid_starting_on', 'components'] %}
, coalesce(pivoted_daily_history.{{ col.name }}, most_recent_data.{{ col.name }}) as {{ col.name }}
{% endfor %}
{% else %}
{% for col in pivot_data_columns if col.name|lower == 'components' and var('jira_using_components', True) %}
, pivoted_daily_history.components
{% endfor %}
{% for col in pivot_data_columns if col.name|lower not in ['issue_day_id','issue_id','valid_starting_on','components'] %}
, {{ col.name }}
{% endfor %}
{% endif %}
{% if is_incremental() %}
{% for col in pivot_data_columns if col.name|lower not in ['issue_day_id','issue_id','valid_starting_on'] %}
, coalesce(pivoted_daily_history.{{ col.name }}, most_recent_data.{{ col.name }}) as {{ col.name }}
{% endfor %}

{% else %}
{% for col in pivot_data_columns if col.name|lower not in ['issue_day_id','issue_id','valid_starting_on'] %}
, {{ col.name }}
{% endfor %}
{% endif %}

from calendar
left join pivoted_daily_history
Expand All @@ -110,31 +93,23 @@ set_values as (
date_day,
issue_id,
statuses.status_name as status,
sum(case when statuses.status_name is null then 0 else 1 end) over ( partition by issue_id order by date_day rows unbounded preceding) as status_field_partition

{% for col in pivot_data_columns if col.name|lower == 'components' and var('jira_using_components', True) %}
, component_data.component_name as component
, sum(case when component_data.component_name is null then 0 else 1 end) over (partition by issue_id order by date_day rows unbounded preceding) as component_field_partition
{% endfor %}
sum( case when statuses.status_name is null then 0 else 1 end) over ( partition by issue_id
order by date_day rows unbounded preceding) as status_field_partition

{% for col in pivot_data_columns if col.name|lower not in ['issue_id', 'issue_day_id', 'valid_starting_on', 'status', 'components'] %}
{% for col in pivot_data_columns if col.name|lower not in ['issue_id', 'issue_day_id', 'valid_starting_on', 'status'] %}
, coalesce(field_option_{{ col.name }}.field_option_name, {{ col.name }}) as {{ col.name }}
-- create a batch/partition once a new value is provided
, sum( case when {{ col.name }} is null then 0 else 1 end) over ( partition by issue_id
order by date_day rows unbounded preceding) as {{ col.name }}_field_partition
order by date_day rows unbounded preceding) as {{ col.name }}_field_partition

{% endfor %}

from joined

left join statuses
on cast(statuses.status_id as {{ dbt.type_string() }}) = joined.status

{% if var('jira_using_components', True) %}
left join component_data
on cast(component_data.component_id as {{ dbt.type_string() }}) = joined.components
{% endif %}

{% for col in pivot_data_columns if col.name|lower not in ['issue_id', 'issue_day_id', 'valid_starting_on', 'status', 'components'] %}
{% for col in pivot_data_columns if col.name|lower not in ['issue_id', 'issue_day_id', 'valid_starting_on', 'status'] %}
left join field_option as field_option_{{ col.name }}
on cast(field_option_{{ col.name }}.field_id as {{ dbt.type_string() }}) = {{ col.name }}
{% endfor %}
Expand All @@ -145,15 +120,15 @@ fill_values as (
select
date_day,
issue_id,
first_value(status) over (partition by issue_id, status_field_partition order by date_day asc rows between unbounded preceding and current row) as status
first_value( status ) over (
partition by issue_id, status_field_partition
order by date_day asc rows between unbounded preceding and current row) as status

{% if var('jira_using_components', True) %}
, first_value(component) over (partition by issue_id, component_field_partition order by date_day asc rows between unbounded preceding and current row) as component
{% endif %}

{% for col in pivot_data_columns if col.name|lower not in ['issue_id', 'issue_day_id', 'valid_starting_on', 'status', 'components'] %}
{% for col in pivot_data_columns if col.name|lower not in ['issue_id', 'issue_day_id', 'valid_starting_on', 'status'] %}
-- grab the value that started this batch/partition
, first_value( {{ col.name }} ) over ( partition by issue_id, {{ col.name }}_field_partition order by date_day asc rows between unbounded preceding and current row) as {{ col.name }}
, first_value( {{ col.name }} ) over (
partition by issue_id, {{ col.name }}_field_partition
order by date_day asc rows between unbounded preceding and current row) as {{ col.name }}
{% endfor %}

from set_values
Expand All @@ -165,11 +140,8 @@ fix_null_values as (
date_day,
issue_id,
case when status = 'is_null' then null else status end as status
{% for col in pivot_data_columns if col.name|lower not in ['issue_id','issue_day_id','valid_starting_on', 'status'] %}

{% if var('jira_using_components', True) %}
, case when component = 'is_null' then null else component end as component
{% endif %}
{% for col in pivot_data_columns if col.name|lower not in ['issue_id','issue_day_id','valid_starting_on', 'status', 'components'] %}
-- we de-nulled the true null values earlier in order to differentiate them from nulls that just needed to be backfilled
, case when {{ col.name }} = 'is_null' then null else {{ col.name }} end as {{ col.name }}
{% endfor %}
Expand All @@ -183,6 +155,7 @@ surrogate_key as (
select
*,
{{ dbt_utils.generate_surrogate_key(['date_day','issue_id']) }} as issue_day_id

from fix_null_values
)

Expand Down

0 comments on commit a962897

Please sign in to comment.