Skip to content

Commit

Permalink
Merge pull request #29 from fivetran/customer/add-project-id
Browse files Browse the repository at this point in the history
Customer/add project
  • Loading branch information
fivetran-catfritz authored Jul 25, 2023
2 parents eb9d5e0 + 64157b4 commit a9bbaea
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 47 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# dbt_asana v0.8.1
[PR #29](https://github.com/fivetran/dbt_asana/pull/29) includes the following updates:
## 🎉 Feature Update 🎉
- Updated `int_asana__task_projects` to create the following new columns that are brought into `asana__task`. These new fields provide additional insight into your tasks.
- project_ids
- project_names
- number_of_projects
- Note `project_ids` and `project_names` are aggregated lists of all ids/names associated with the task. You can parse or explode the items in the list using a comma + space (`", "`) as a delimiter. To keep the table grain at the task_id level, this list is not parsed by default.
- See also [our documentation](https://fivetran.github.io/dbt_asana/#!/overview).

## Contributors
- [@irvingpop](https://github.com/irvingpop ) ([PR #25](https://github.com/fivetran/dbt_asana/pull/25))

# dbt_asana v0.8.0
## 🎉 Feature Update 🎉
- Databricks compatibility! ([#28](https://github.com/fivetran/dbt_asana/pull/28))
Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config-version: 2
name: 'asana'
version: 0.8.0
version: 0.8.1
require-dbt-version: [">=1.3.0", "<2.0.0"]
models:
asana:
Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 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.

10 changes: 5 additions & 5 deletions integration_tests/ci/sample.profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ integration_tests:
pass: "{{ env_var('CI_REDSHIFT_DBT_PASS') }}"
dbname: "{{ env_var('CI_REDSHIFT_DBT_DBNAME') }}"
port: 5439
schema: asana_integrations_tests
schema: asana_integrations_tests_03
threads: 8
bigquery:
type: bigquery
method: service-account-json
project: 'dbt-package-testing'
schema: asana_integrations_tests
schema: asana_integrations_tests_03
threads: 8
keyfile_json: "{{ env_var('GCLOUD_SERVICE_KEY') | as_native }}"
snowflake:
Expand All @@ -33,7 +33,7 @@ integration_tests:
role: "{{ env_var('CI_SNOWFLAKE_DBT_ROLE') }}"
database: "{{ env_var('CI_SNOWFLAKE_DBT_DATABASE') }}"
warehouse: "{{ env_var('CI_SNOWFLAKE_DBT_WAREHOUSE') }}"
schema: asana_integrations_tests
schema: asana_integrations_tests_03
threads: 8
postgres:
type: postgres
Expand All @@ -42,13 +42,13 @@ integration_tests:
pass: "{{ env_var('CI_POSTGRES_DBT_PASS') }}"
dbname: "{{ env_var('CI_POSTGRES_DBT_DBNAME') }}"
port: 5432
schema: asana_integrations_tests
schema: asana_integrations_tests_03
threads: 8
databricks:
catalog: "{{ env_var('CI_DATABRICKS_DBT_CATALOG') }}"
host: "{{ env_var('CI_DATABRICKS_DBT_HOST') }}"
http_path: "{{ env_var('CI_DATABRICKS_DBT_HTTP_PATH') }}"
schema: asana_integrations_tests
schema: asana_integrations_tests_03
threads: 8
token: "{{ env_var('CI_DATABRICKS_DBT_TOKEN') }}"
type: databricks
4 changes: 2 additions & 2 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
config-version: 2
name: 'asana_integration_tests'
version: 0.8.0
version: 0.8.1
profile: 'integration_tests'
vars:
asana_schema: asana_integrations_tests
asana_schema: asana_integrations_tests_03
asana_source:
asana_user_identifier: "user_data"
asana_project_identifier: "project_data"
Expand Down
19 changes: 18 additions & 1 deletion models/asana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ models:
description: Count of the tags associated with the task.

- name: projects_sections
description: A list of the projects + sections that this task is listed under.
description: >
A list of the projects + sections that this task is listed under.
You can parse or explode the items in the list using a comma + space (`", "`) as a delimiter.
To keep the table grain at the task_id level, this list is not parsed by default.
- name: is_subtask
description: Boolean that's true if the task is a subtask of another.
Expand Down Expand Up @@ -130,6 +133,20 @@ models:
- name: number_of_likes
description: Number of users who have liked this task.

- name: project_ids
description: >
List of all `project_ids` associated with the task.
You can parse or explode the items in the list using a comma + space (`", "`) as a delimiter.
To keep the table grain at the task_id level, this list is not parsed by default.
- name: project_names
description: >
List of all `project_names` associated with the task.
You can parse or explode the items in the list using a comma + space (`", "`) as a delimiter.
To keep the table grain at the task_id level, this list is not parsed by default.
- name: number_of_projects
description: The number of projects associated with the task.

- name: asana__user
description: Enriched user table consisting of base user info + metrics around tasks and completions
Expand Down
31 changes: 17 additions & 14 deletions models/asana__task.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ with task as (

task_comments as (

select *
select *
from {{ ref('int_asana__task_comments') }}
),

Expand All @@ -29,7 +29,7 @@ task_tags as (

task_assignee as (

select *
select *
from {{ ref('int_asana__task_assignee') }}
where has_assignee
),
Expand All @@ -42,13 +42,13 @@ task_projects as (

subtask_parent as (

select *
select *
from {{ ref('int_asana__subtask_parent') }}

),

task_first_modifier as (

select *
from {{ ref('int_asana__task_first_modifier') }}
),
Expand All @@ -60,26 +60,29 @@ task_join as (
concat('https://app.asana.com/0/0/', task.task_id) as task_link,
task_assignee.assignee_name,
task_assignee.assignee_email,
task_open_length.days_open,

task_open_length.days_open,
task_open_length.is_currently_assigned,
task_open_length.has_been_assigned,
task_open_length.days_since_last_assignment, -- is null for never-assigned tasks
task_open_length.days_since_first_assignment, -- is null for never-assigned tasks
task_open_length.last_assigned_at,
task_open_length.first_assigned_at,
task_open_length.first_assigned_at,

task_first_modifier.first_modifier_user_id,
task_first_modifier.first_modifier_name,

task_comments.conversation,
coalesce(task_comments.number_of_comments, 0) as number_of_comments,
task_comments.conversation,
coalesce(task_comments.number_of_comments, 0) as number_of_comments,
task_followers.followers,
coalesce(task_followers.number_of_followers, 0) as number_of_followers,
task_tags.tags,
coalesce(task_tags.number_of_tags, 0) as number_of_tags,

task_tags.tags,
coalesce(task_tags.number_of_tags, 0) as number_of_tags,

task_projects.project_ids,
task_projects.project_names,
task_projects.projects_sections,
task_projects.number_of_projects,

subtask_parent.subtask_id is not null as is_subtask, -- parent id is in task.*
subtask_parent.parent_task_name,
Expand All @@ -96,7 +99,7 @@ task_join as (
left join task_comments on task.task_id = task_comments.task_id
left join task_followers on task.task_id = task_followers.task_id
left join task_tags on task.task_id = task_tags.task_id

left join task_assignee on task.task_id = task_assignee.task_id

left join subtask_parent on task.task_id = subtask_parent.subtask_id
Expand All @@ -105,4 +108,4 @@ task_join as (

)

select * from task_join
select * from task_join
35 changes: 19 additions & 16 deletions models/intermediate/int_asana__task_projects.sql
Original file line number Diff line number Diff line change
@@ -1,57 +1,60 @@
with task_project as (

select *
select *
from {{ var('project_task') }}

),

project as (
select *

select *
from {{ var ('project') }}
),

task_section as (

select *
select *
from {{ var('task_section') }}

),

section as (
select *

select *
from {{ var ('section') }}

),

task_project_section as (

select
select
task_project.task_id,
project.project_name || (case when section.section_name = '(no section)' then ''
else ': ' || section.section_name end) as project_section,
project.project_id
else ': ' || section.section_name end) as project_section,
cast(project.project_id as {{ dbt.type_string() }}) as project_id,
project.project_name
from
task_project
join project
task_project
join project
on project.project_id = task_project.project_id
join task_section
on task_section.task_id = task_project.task_id
join section
on section.section_id = task_section.section_id
join section
on section.section_id = task_section.section_id
and section.project_id = project.project_id
),

agg_project_sections as (
select
select
task_id,
{{ fivetran_utils.string_agg( 'task_project_section.project_section', "', '" )}} as projects_sections,
{{ fivetran_utils.string_agg( 'task_project_section.project_id', "', '" )}} as project_ids,
{{ fivetran_utils.string_agg( 'task_project_section.project_name', "', '" )}} as project_names,
count(project_id) as number_of_projects

from task_project_section
from task_project_section

group by 1
)

select * from agg_project_sections
select * from agg_project_sections
4 changes: 2 additions & 2 deletions packages.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
packages:
- package: fivetran/asana_source
version: [">=0.8.0", "<0.9.0"]
- package: fivetran/asana_source
version: [">=0.8.0", "<0.9.0"]

0 comments on commit a9bbaea

Please sign in to comment.