Skip to content

Commit

Permalink
Merge pull request #7 from fivetran/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
fivetran-jamie authored Oct 29, 2020
2 parents 2080a46 + ff79a98 commit 674afb4
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 16 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions dbt_project.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
6 changes: 3 additions & 3 deletions models/asana_project.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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)'
Expand All @@ -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)

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion models/asana_team.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
6 changes: 3 additions & 3 deletions models/asana_user.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion models/intermediate/asana_task_comments.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion models/intermediate/asana_task_followers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion models/intermediate/asana_task_projects.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion models/intermediate/asana_task_tags.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions packages.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 674afb4

Please sign in to comment.