Skip to content

Commit

Permalink
Merge pull request #24 from fivetran/hotfix/timestamp-casting
Browse files Browse the repository at this point in the history
Hotfix/timestamp casting
  • Loading branch information
fivetran-joemarkiewicz authored Dec 9, 2021
2 parents 98b86bf + 801aaaa commit 4f0489d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# dbt_jira_source (next release)
# dbt_jira_source v0.3.2
## Fixes
- Adjusted the `stg_jira__issue` and `stg_jira__issue_field_history` timestamp fields for `redshift` warehouses to explicitly cast the data type as `timestamp without time zone`. This ensures downstream `datediff` and `dateadd` functions to not result in an error if the timestamps are synced as `timestamp_tz`. ([#24](https://github.com/fivetran/dbt_jira_source/pull/24))

# dbt_jira_source v0.1.0 -> v0.3.1
Refer to the relevant release notes on the Github repository for specific details for the previous releases. Thank you!
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_source'
version: '0.3.1'
version: '0.3.2'
config-version: 2
require-dbt-version: ">=0.20.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_source_integration_tests'
version: '0.3.1'
version: '0.3.2'
config-version: 2
profile: 'integration_tests'

Expand Down
9 changes: 7 additions & 2 deletions models/stg_jira__issue.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ final as (
coalesce(remaining_estimate, _remaining_estimate) as remaining_estimate_seconds,
coalesce(time_spent, _time_spent) as time_spent_seconds,
assignee as assignee_user_id,
created as created_at,
{% if target.type == 'redshift' -%}
cast(created as timestamp without time zone) as created_at,
cast(resolved as timestamp without time zone) as resolved_at,
{% else -%}
created as created_at,
resolved as resolved_at,
{% endif %}
creator as creator_user_id,
description as issue_description,
due_date,
Expand All @@ -40,7 +46,6 @@ final as (
project as project_id,
reporter as reporter_user_id,
resolution as resolution_id,
resolved as resolved_at,
status as status_id,
status_category_changed as status_changed_at,
summary as issue_name,
Expand Down
8 changes: 4 additions & 4 deletions models/stg_jira__issue_field_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ final as (
select
cast(field_id as {{ dbt_utils.type_string() }}) as field_id,
issue_id,
{% if target.type == 'snowflake' %}
{% if target.type == 'snowflake' -%}
"TIME"
{% elif target.type == 'redshift' %}
"time"
{% else %}
{% elif target.type == 'redshift' -%}
cast("time" as timestamp without time zone)
{% else -%}
time
{% endif %} as updated_at,
value as field_value,
Expand Down

0 comments on commit 4f0489d

Please sign in to comment.