Skip to content

Commit

Permalink
Merge pull request #19 from fivetran/bufix/redshift-timestamps
Browse files Browse the repository at this point in the history
Bufix/redshift timestamps
  • Loading branch information
fivetran-sheringuyen authored Jul 12, 2022
2 parents 3a0db9c + 6d70e87 commit f2968db
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 34 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# dbt_asana_source v0.5.1
## Under the Hood
- Leveraged the `{{ dbt_utils.type_timestamp() }}` macro within the staging models for all timestamp fields.
- This is needed as certain Redshift warehouses sync these fields as `timestamptz` by default which causes compilation errors in downstream models. This macro safely removes timezone values from the UTC timestamps and ensures success in downstream transformations.

## Contributors
- @shreveasaurus ([#18](https://github.com/fivetran/dbt_asana_source/pull/18)).

# dbt_asana_source v0.5.0
🎉 dbt v1.0.0 Compatibility 🎉
## 🚨 Breaking Changes 🚨
Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
config-version: 2

name: 'asana_source'
version: '0.5.0'
version: '0.5.1'

require-dbt-version: [">=1.0.0", "<2.0.0"]

Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions 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.

9 changes: 8 additions & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
config-version: 2

name: 'asana_source_integration_tests'
version: '0.4.0'
version: '0.5.1'

profile: 'integration_tests'

Expand Down Expand Up @@ -41,6 +41,13 @@ seeds:
completed_by_id: "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"
parent_id: "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"
workspace_id: "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"
completed_at: "timestamp"
created_at: "timestamp"
due_on: "timestamp"
due_at: "timestamp"
modified_at: "timestamp"
start_on: "timestamp"
_fivetran_synced: "timestamp"
story_data:
+column_types:
id: "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/seeds/task_data.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
id,_fivetran_synced,assignee_id,assignee_status,completed,completed_at,completed_by_id,created_at,due_at,due_on,hearted,modified_at,name,notes,num_hearts,parent_id,start_on,workspace_id
1199893417793941,2021-02-04 02:24:35,1137799670337705,inbox,FALSE,,,2021-02-04 00:11:27,,,FALSE,2021-02-04 00:22:16,dab5f67e57087576d51dc40d79c517bc,,0,,,2104505001950
id,assignee_id,completed,completed_at,completed_by_id,created_at,due_on,due_at,modified_at,name,parent_id,start_on,notes,workspace_id
1138074657603006,1126539287026862,true,2019-09-18T16:48:31.176Z,,2019-09-02T14:53:02.685Z,2019-09-25T00:00:00Z,,2021-12-18T14:01:40.058Z,cool name,,,many notes,2104505001950
6 changes: 3 additions & 3 deletions models/stg_asana__project.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ final as (
select
id as project_id,
archived as is_archived,
created_at,
cast(created_at as {{ dbt_utils.type_timestamp() }}) as created_at,
current_status,
due_date,
modified_at,
cast(due_date as {{ dbt_utils.type_timestamp() }}) as due_date,
cast(modified_at as {{ dbt_utils.type_timestamp() }}) as modified_at,
name as project_name,
owner_id as owner_user_id,
public as is_public,
Expand Down
2 changes: 1 addition & 1 deletion models/stg_asana__section.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final as (

select
id as section_id,
created_at,
cast(created_at as {{ dbt_utils.type_timestamp() }}) as created_at,
name as section_name,
project_id
from fields
Expand Down
2 changes: 1 addition & 1 deletion models/stg_asana__story.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final as (

select
id as story_id,
created_at,
cast(created_at as {{ dbt_utils.type_timestamp() }}) as created_at,
created_by_id as created_by_user_id,
target_id as target_task_id,
text as story_content,
Expand Down
2 changes: 1 addition & 1 deletion models/stg_asana__tag.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final as (
select
id as tag_id,
name as tag_name,
created_at
cast(created_at as {{ dbt_utils.type_timestamp() }}) as created_at
from fields
where not _fivetran_deleted
)
Expand Down
10 changes: 5 additions & 5 deletions models/stg_asana__task.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ final as (
assignee_id as assignee_user_id,
assignee_status,
completed as is_completed,
completed_at,
cast(completed_at as {{ dbt_utils.type_timestamp() }}) as completed_at,
completed_by_id as completed_by_user_id,
created_at,
coalesce(due_on, due_at) as due_date,
modified_at,
cast(created_at as {{ dbt_utils.type_timestamp() }}) as created_at,
cast(coalesce(due_on, due_at) as {{ dbt_utils.type_timestamp() }}) as due_date,
cast(modified_at as {{ dbt_utils.type_timestamp() }}) as modified_at,
name as task_name,
parent_id as parent_task_id,
start_on as start_date,
cast(start_on as {{ dbt_utils.type_timestamp() }}) as start_date,
notes as task_description,
workspace_id

Expand Down

0 comments on commit f2968db

Please sign in to comment.