Skip to content

Commit f2968db

Browse files
Merge pull request #19 from fivetran/bufix/redshift-timestamps
Bufix/redshift timestamps
2 parents 3a0db9c + 6d70e87 commit f2968db

13 files changed

+49
-34
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# dbt_asana_source v0.5.1
2+
## Under the Hood
3+
- Leveraged the `{{ dbt_utils.type_timestamp() }}` macro within the staging models for all timestamp fields.
4+
- 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.
5+
6+
## Contributors
7+
- @shreveasaurus ([#18](https://github.com/fivetran/dbt_asana_source/pull/18)).
8+
19
# dbt_asana_source v0.5.0
210
🎉 dbt v1.0.0 Compatibility 🎉
311
## 🚨 Breaking Changes 🚨

dbt_project.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
config-version: 2
22

33
name: 'asana_source'
4-
version: '0.5.0'
4+
version: '0.5.1'
55

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

docs/catalog.json

+1-1
Large diffs are not rendered by default.

docs/index.html

+16-16
Large diffs are not rendered by default.

docs/manifest.json

+1-1
Large diffs are not rendered by default.

docs/run_results.json

+1-1
Large diffs are not rendered by default.

integration_tests/dbt_project.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
config-version: 2
22

33
name: 'asana_source_integration_tests'
4-
version: '0.4.0'
4+
version: '0.5.1'
55

66
profile: 'integration_tests'
77

@@ -41,6 +41,13 @@ seeds:
4141
completed_by_id: "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"
4242
parent_id: "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"
4343
workspace_id: "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"
44+
completed_at: "timestamp"
45+
created_at: "timestamp"
46+
due_on: "timestamp"
47+
due_at: "timestamp"
48+
modified_at: "timestamp"
49+
start_on: "timestamp"
50+
_fivetran_synced: "timestamp"
4451
story_data:
4552
+column_types:
4653
id: "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"

integration_tests/seeds/task_data.csv

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
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
2-
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
1+
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
2+
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

models/stg_asana__project.sql

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ final as (
2424
select
2525
id as project_id,
2626
archived as is_archived,
27-
created_at,
27+
cast(created_at as {{ dbt_utils.type_timestamp() }}) as created_at,
2828
current_status,
29-
due_date,
30-
modified_at,
29+
cast(due_date as {{ dbt_utils.type_timestamp() }}) as due_date,
30+
cast(modified_at as {{ dbt_utils.type_timestamp() }}) as modified_at,
3131
name as project_name,
3232
owner_id as owner_user_id,
3333
public as is_public,

models/stg_asana__section.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final as (
2323

2424
select
2525
id as section_id,
26-
created_at,
26+
cast(created_at as {{ dbt_utils.type_timestamp() }}) as created_at,
2727
name as section_name,
2828
project_id
2929
from fields

models/stg_asana__story.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final as (
2323

2424
select
2525
id as story_id,
26-
created_at,
26+
cast(created_at as {{ dbt_utils.type_timestamp() }}) as created_at,
2727
created_by_id as created_by_user_id,
2828
target_id as target_task_id,
2929
text as story_content,

models/stg_asana__tag.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final as (
2424
select
2525
id as tag_id,
2626
name as tag_name,
27-
created_at
27+
cast(created_at as {{ dbt_utils.type_timestamp() }}) as created_at
2828
from fields
2929
where not _fivetran_deleted
3030
)

models/stg_asana__task.sql

+5-5
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ final as (
3333
assignee_id as assignee_user_id,
3434
assignee_status,
3535
completed as is_completed,
36-
completed_at,
36+
cast(completed_at as {{ dbt_utils.type_timestamp() }}) as completed_at,
3737
completed_by_id as completed_by_user_id,
38-
created_at,
39-
coalesce(due_on, due_at) as due_date,
40-
modified_at,
38+
cast(created_at as {{ dbt_utils.type_timestamp() }}) as created_at,
39+
cast(coalesce(due_on, due_at) as {{ dbt_utils.type_timestamp() }}) as due_date,
40+
cast(modified_at as {{ dbt_utils.type_timestamp() }}) as modified_at,
4141
name as task_name,
4242
parent_id as parent_task_id,
43-
start_on as start_date,
43+
cast(start_on as {{ dbt_utils.type_timestamp() }}) as start_date,
4444
notes as task_description,
4545
workspace_id
4646

0 commit comments

Comments
 (0)