From ffe4ad8815c26384133894c3c0fd98b25b72d8ec Mon Sep 17 00:00:00 2001 From: Jamie Rodriguez Date: Thu, 29 Oct 2020 10:27:48 -0700 Subject: [PATCH 1/5] use fivetran_utils.string_agg --- models/asana_project.sql | 4 ++-- models/asana_team.sql | 2 +- models/asana_user.sql | 2 +- models/intermediate/asana_task_comments.sql | 2 +- models/intermediate/asana_task_followers.sql | 2 +- models/intermediate/asana_task_projects.sql | 2 +- models/intermediate/asana_task_tags.sql | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/models/asana_project.sql b/models/asana_project.sql index 4ad0ab8..b02e9e9 100644 --- a/models/asana_project.sql +++ b/models/asana_project.sql @@ -30,7 +30,7 @@ agg_sections as ( select project_id, - {{ string_agg( 'section_name', "', '") }} as sections + {{ fivetran_utils.string_agg( 'section_name', "', '") }} as sections from {{ var('section') }} where section_name != '(no section)' @@ -41,7 +41,7 @@ agg_project_users as ( select project_user.project_id, - {{ string_agg( "asana_user.user_name || ' as ' || project_user.role" , "', '" ) }} as users + {{ fivetran_utils.string_agg( "asana_user.user_name || ' as ' || project_user.role" , "', '" ) }} as users from project_user join asana_user using(user_id) diff --git a/models/asana_team.sql b/models/asana_team.sql index a9c1740..13b67f7 100644 --- a/models/asana_team.sql +++ b/models/asana_team.sql @@ -22,7 +22,7 @@ team_join as ( round(avg(project.avg_close_time_assigned_days), 0) as avg_close_time_assigned_days, coalesce( sum(case when not project.is_archived then 1 else 0 end), 0) as number_of_active_projects, - {{ string_agg('case when not project.is_archived then project.project_name else null end', "', '") }} as active_projects, + {{ fivetran_utils.string_agg('case when not project.is_archived then project.project_name else null end', "', '") }} as active_projects, coalesce( sum(case when project.is_archived then 1 else 0 end), 0) as number_of_archived_projects diff --git a/models/asana_user.sql b/models/asana_user.sql index 8d09e34..f916188 100644 --- a/models/asana_user.sql +++ b/models/asana_user.sql @@ -47,7 +47,7 @@ agg_user_projects as ( select user_id, - {{ string_agg( 'project_name', "', '" )}} as projects_working_on + {{ fivetran_utils.string_agg( 'project_name', "', '" )}} as projects_working_on from unique_user_projects group by 1 diff --git a/models/intermediate/asana_task_comments.sql b/models/intermediate/asana_task_comments.sql index 2c274c4..5a04ef1 100644 --- a/models/intermediate/asana_task_comments.sql +++ b/models/intermediate/asana_task_comments.sql @@ -12,7 +12,7 @@ task_conversation as ( select target_task_id as task_id, -- creates a chronologically ordered conversation about the task - {{ string_agg( "created_at || ' - ' || created_by_name || ': ' || comment_content", "'\\n'" ) }} as conversation, + {{ fivetran_utils.string_agg( "created_at || ' - ' || created_by_name || ': ' || comment_content", "'\\n'" ) }} as conversation, count(*) as number_of_comments from comments diff --git a/models/intermediate/asana_task_followers.sql b/models/intermediate/asana_task_followers.sql index b6d2f4d..c6d65d9 100644 --- a/models/intermediate/asana_task_followers.sql +++ b/models/intermediate/asana_task_followers.sql @@ -16,7 +16,7 @@ agg_followers as ( select task_follower.task_id, - {{ string_agg( 'asana_user.user_name', "', '" )}} as followers, + {{ fivetran_utils.string_agg( 'asana_user.user_name', "', '" )}} as followers, count(*) as number_of_followers from task_follower join asana_user diff --git a/models/intermediate/asana_task_projects.sql b/models/intermediate/asana_task_projects.sql index e310012..f9be393 100644 --- a/models/intermediate/asana_task_projects.sql +++ b/models/intermediate/asana_task_projects.sql @@ -46,7 +46,7 @@ task_project_section as ( agg_project_sections as ( select task_id, - {{ string_agg( 'task_project_section.project_section', "', '" )}} as projects_sections, + {{ fivetran_utils.string_agg( 'task_project_section.project_section', "', '" )}} as projects_sections, count(project_id) as number_of_projects from task_project_section diff --git a/models/intermediate/asana_task_tags.sql b/models/intermediate/asana_task_tags.sql index fbd3b64..4bb4678 100644 --- a/models/intermediate/asana_task_tags.sql +++ b/models/intermediate/asana_task_tags.sql @@ -16,7 +16,7 @@ agg_tags as ( select task_tag.task_id, - {{ string_agg( 'asana_tag.tag_name', "', '" )}} as tags, + {{ fivetran_utils.string_agg( 'asana_tag.tag_name', "', '" )}} as tags, count(*) as number_of_tags from task_tag join asana_tag From 7722904bc77d0d229ea3fe01238468c5eba5aae4 Mon Sep 17 00:00:00 2001 From: Jamie Rodriguez Date: Thu, 29 Oct 2020 10:36:10 -0700 Subject: [PATCH 2/5] added coalesces --- models/asana_project.sql | 2 +- models/asana_user.sql | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/models/asana_project.sql b/models/asana_project.sql index b02e9e9..a2bfaea 100644 --- a/models/asana_project.sql +++ b/models/asana_project.sql @@ -84,7 +84,7 @@ project_join as ( modified_at as last_modified_at, owner_user_id, agg_project_users.users as users_involved, - count_project_users.number_of_users_involved, + coalesce(count_project_users.number_of_users_involved, 0) as number_of_users_involved, agg_sections.sections, project.notes, project.is_public diff --git a/models/asana_user.sql b/models/asana_user.sql index f916188..edfde52 100644 --- a/models/asana_user.sql +++ b/models/asana_user.sql @@ -62,8 +62,8 @@ user_join as ( coalesce(user_task_metrics.number_of_tasks_completed, 0) as number_of_tasks_completed, round(user_task_metrics.avg_close_time_days, 0) as avg_close_time_days, - count_user_projects.number_of_projects_owned, - count_user_projects.number_of_projects_currently_assigned_to, + coalesce(count_user_projects.number_of_projects_owned, 0) as number_of_projects_owned, + coalesce(count_user_projects.number_of_projects_currently_assigned_to, 0) as number_of_projects_currently_assigned_to, agg_user_projects.projects_working_on from asana_user From 200e7ef714ba3269ce4225a5fa72d20990322f22 Mon Sep 17 00:00:00 2001 From: Jamie Rodriguez Date: Thu, 29 Oct 2020 11:46:15 -0700 Subject: [PATCH 3/5] update dbt version --- dbt_project.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbt_project.yml b/dbt_project.yml index 7e426a9..e8552e8 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -1,9 +1,9 @@ config-version: 2 name: 'asana' -version: '0.0.1' +version: '0.2.0' -require-dbt-version: '>=0.17.0' +require-dbt-version: [">=0.18.0", "<0.19.0"] models: asana: From 759bf91bae23b414a3edcab4b48c3e8ea5645448 Mon Sep 17 00:00:00 2001 From: Jamie Rodriguez Date: Thu, 29 Oct 2020 11:56:23 -0700 Subject: [PATCH 4/5] add netlify dosc site --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b098ef6..cdda11a 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ This package models Asana data from [Fivetran's connector](https://fivetran.com/ This package enables you to better understand tasks and how they're being worked on in Asana. Its primary focus is to enhance the task table and other core objects that relate to tasks: users, projects, teams, and tags. Each of these objects is enriched with metrics that reflect the volume and breadth of work being done now and the velocity of work that has been completed. Moreover, the daily metrics table lays out a timeline of task creations and completions for understanding the overall pace of deliverables at the organization. +**See the package docs site [here](https://fivetran-dbt-asana.netlify.app/#!/overview).** + ## Models This package contains transformation models, designed to work simultaneously with our [Asana source package](https://github.com/fivetran/dbt_asana_source). A dependency on the source package is declared in this package's `packages.yml` file, so it will automatically download when you run `dbt deps`. The primary outputs of this package are described below. Intermediate models are used to create these output models. From ff79a9892ec354bf3e3898f1a8de56d4f51f699e Mon Sep 17 00:00:00 2001 From: Jamie Rodriguez Date: Thu, 29 Oct 2020 11:57:11 -0700 Subject: [PATCH 5/5] use new hub version of src package --- packages.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages.yml b/packages.yml index 93a2237..b79243e 100644 --- a/packages.yml +++ b/packages.yml @@ -1,7 +1,10 @@ packages: + - package: fivetran/asana_source + version: 0.2.0 + - package: fishtown-analytics/dbt_utils - version: 0.4.0 + version: [">=0.6.0", "<0.7.0"] - - package: fivetran/asana_source - version: 0.1.0 + - git: "https://github.com/fivetran/dbt_fivetran_utils.git" + warn-unpinned: false \ No newline at end of file