Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source Asana: Add dbt converter #53

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion connectors/source_asana/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ clean-targets:
- logs

require-dbt-version:
- '>=1.0.0'
- ">=1.0.0"
- <2.0.0

models:
Expand Down
43 changes: 43 additions & 0 deletions connectors/source_asana/integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: integration_test_asana

config-version: 2

version: 0.1.0

profile: integration_tests

model-paths:
- models

macro-paths:
- macros

target-path: target

clean-targets:
- target
- dbt_modules
- logs

require-dbt-version:
- ">=1.0.0"
- <2.0.0

models:
airbyte_dbt_source_asana:
materialized: view
+schema: dbt_asana
staging:
materialized: view
tmp:
materialized: view

vars:
# Required by Airbyte dbt model
using_fivetran_model: True
airbyte_database: "airbyte_db_default"
airbyte_schema: "airbyte_dbt_asana"

# Required by Fivetran dbt model
asana_database: "airbyte_db_default"
asana_schema: "airbyte_dbt_asana"
11 changes: 11 additions & 0 deletions connectors/source_asana/integration_tests/package-lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
packages:
- local: ../
- package: fivetran/asana
version: 0.8.1
- package: fivetran/asana_source
version: 0.8.0
- package: fivetran/fivetran_utils
version: 0.4.10
- package: dbt-labs/dbt_utils
version: 1.2.0
sha1_hash: fc497513774e493a6374e162f78845f94d8ed0c9
5 changes: 5 additions & 0 deletions connectors/source_asana/integration_tests/packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
packages:
- local: ../

- package: fivetran/asana
version: [">=0.8.0", "<0.9.0"]
1 change: 1 addition & 0 deletions connectors/source_asana/integration_tests/vars
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{airbyte_database: $AB_DB, amplitude_database: $AB_DB}
26 changes: 26 additions & 0 deletions connectors/source_asana/models/fivetran_converter/project.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{% if target.type == "snowflake" %}

{% elif target.type == "bigquery" %}
WITH tmp AS (
SELECT
t.gid as id,
t.archived,
t.created_at,
t.current_status,
t.due_date,
t.modified_at,
t.name,
JSON_QUERY(t.owner, '$.gid') as owner_id,
t.public,
JSON_QUERY(t.team, '$.gid') as team_id,
JSON_QUERY(t.workspace, '$.gid') as workspace_id,
t.notes
FROM
{{ source('source_asana', 'projects') }} t
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice start @pangeran-bottor you can use Chatgpt to translate to snowflake and postgres.

SELECT * FROM tmp


{% elif target.type == "postgres" %}

{%endif%}
37 changes: 37 additions & 0 deletions connectors/source_asana/models/fivetran_converter/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: 2

models:
- name: project
schema: "{{ var('airbyte_schema', target.schema) }}"
database: "{{ var('airbyte_database', target.database) }}"
identifier: "{{ var('asana_project_identifier', 'project') }}"
description: All fields and field values associated with project.
config:
+enabled: "{{ var('using_fivetran_model', False) }}"
columns:
- name: id
description: System generated unique ID of the project.
- name: archived
description: Boolean representing whether the project has been archived (removed from asana UI).
- name: color
description: Color of the project as seen in the UI.
- name: created_at
description: Timestamp of when the story was made/the action was logged.
- name: current_status
description: The most recent progress status update for the project. This is sent to all project followers.
- name: due_date
description: The date the project is due.
- name: modified_at
description: The last time the project was updated. Does not include comments nor changes in associations (ie new tasks).
- name: name
description: The given name of the project.
- name: notes
description: Free-form textual notes associated with the project.
- name: owner_id
description: Foreign key referencing the USER who owns the project.
- name: public
description: Boolean that is true if the project is public to the whole organization, false if not.
- name: team_id
description: Foreign key referencing the TEAM that the project is shared with.
- name: workspace_id
description: The id of an organization's workspace in asana. Not necessary unless you have access to multiple asana workspaces.
46 changes: 23 additions & 23 deletions connectors/source_asana/models/source/projects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,77 +10,77 @@ sources:
- name: projects
columns:
- name: gid
description: ''
description: 'System generated unique ID of the project.'
data_type: string
- name: resource_type
description: ''
data_type: string
- name: name
description: ''
description: 'The given name of the project.'
data_type: string
- name: archived
description: ''
description: 'Boolean representing whether the project has been archived (removed from asana UI).'
data_type: boolean
- name: color
description: ''
description: 'Color of the project as seen in the UI.'
data_type: string
- name: created_at
description: ''
description: 'Timestamp of when the story was made/the action was logged.'
data_type: string
- name: current_status
description: ''
description: 'The most recent progress status update for the project. This is sent to all project followers.'
data_type: object
- name: custom_field_settings
description: ''
description: 'Array of Custom Field Settings (in compact form).'
data_type: array
- name: default_view
description: ''
description: 'The default view (list, board, calendar, or timeline) of a project.'
data_type: string
- name: due_date
description: ''
description: 'The date the project is due. Deprecated: new integrations should prefer the due_on field.'
data_type: string
- name: due_on
description: ''
description: 'The day on which this project is due. This takes a date with format YYYY-MM-DD.'
data_type: string
- name: html_notes
description: ''
description: 'The notes of the project with formatting as HTML.'
data_type: string
- name: is_template
description: ''
data_type: boolean
- name: members
description: ''
description: 'Array of users who are members of this project.'
data_type: array
- name: modified_at
description: ''
description: 'The last time the project was updated. Does not include comments nor changes in associations (ie new tasks).'
data_type: string
- name: notes
description: ''
description: 'Free-form textual notes associated with the project.'
data_type: string
- name: public
description: ''
description: 'Boolean that is true if the project is public to the whole organization, false if not.'
data_type: boolean
- name: start_on
description: ''
description: 'The day on which work for this project begins, or null if the project has no start date. This takes a date with YYYY-MM-DD format.'
data_type: string
- name: workspace
description: ''
description: 'The workspace or organization this project is associated with.'
data_type: object
- name: custom_fields
description: ''
description: 'Array of Custom Fields.'
data_type: array
- name: followers
description: ''
description: 'Array of users following this project.'
data_type: array
- name: icon
description: ''
description: 'The icon for a project.'
data_type: string
- name: owner
description: ''
description: 'A user object represents an account in Asana that can be given access to various workspaces, projects, and tasks.'
data_type: object
- name: permalink_url
description: ''
description: 'A url that points directly to the object within Asana.'
data_type: string
- name: team
description: ''
description: 'The team that this project is shared with.'
data_type: object