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

feat(source-jira): add fivetran converter #64

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
89 changes: 84 additions & 5 deletions connectors/source_jira/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,88 @@
# Airbyte source_jira dbt Package
# Jira Airbyte dbt Package

This package contains dbt models for Airbyte Jira source.
This package contains dbt models for Airbyte source_jira source.

What it includes:

- A complete source description
- ERD model for the source
- Diagram documentation for the source
- This package contains dbt models to work with Airbyte Jira connector.
- The package is compatible with latest version of Airbyte Jira connector.
- Currently, it is limited to creating transformations compatible with [Fivetran's modeling dbt package](https://github.com/fivetran/dbt_jira/tree/main).
- In the future, specific models will be applied directly to Airbyte connector output. If you have an idea or want to propose an analytical model for this source, please refer to the contributing guide, which explains how to propose a new transformation model.
- This package was tested with BigQuery, Snowflake, and Postgres data warehouses.

---

## 🎯 Intructions how to use

### Airbyte dbt Package

For now Airbyte dbt packages aren't versioned. You must configure using git and subdirectory. For now there isn't any transformation model directly applied to this package. But you can generate docs and tests with dbt.

Create the following files:

**`dbt_project.yml`**

```yaml
vars:
using_fivetran_model: False
airbyte_database: "airbyte_db_default"
airbyte_schema: "airbyte_dbt_jira"
```

**`packages.yml`**

```yaml
packages:
- git: "https://github.com/airbytehq/airbyte-dbt-models.git"
subdirectory: "connectors/source_jira"
```

After you can run `dbt tests` or `dbt docs generate` to have a preview of Airbyte output data.

### Fivetran Jira Modeling dbt package

This package transforms Airbyte connector output data, making it compatible with Fivetran's Jira dbt package. You can check the analytical models Fivetran creates [here](https://github.com/fivetran/dbt_jira/tree/main?tab=readme-ov-file#-what-does-this-dbt-package-do). The link also provides information about how the package works and what is configurable.

Create the require files to use Airbyte and Fivetran dbt packages:

**`packages.yml`**

```yaml
packages:
- git: "https://github.com/airbytehq/airbyte-dbt-models.git"
subdirectory: "connectors/source_jira"

- package: fivetran/jira
version: [">=0.5.0", "<0.6.0"]
```

This is a default variable definition you must configure to have the models created.

**`dbt_project.yml`**

```yaml
vars:
# Required by Airbyte dbt model
using_fivetran_model: True
airbyte_database: "airbyte_db_default"
airbyte_schema: "dbt_source_jira"

# Required by Fivetran dbt model
jira_database: "airbyte_db_default"
jira_schema: "dbt_source_jira"

jira_issue_type_identifier: "issue_types"
jira_priority_identifier: "issue_priorities"
jira_resolution_identifier: "issue_resolutions"
jira_status_category_identifier: "workflow_status_categories"

```

After run `dbt run`, you can see the models being created.

---

## :package: Package Maintenance

- This package is maintained by the Airbyte Community.
- You can contribute any time please read the Contributing Guidelines or enter the Airbyte Slack Channel `#airbyte-dbt-packages`
2 changes: 1 addition & 1 deletion connectors/source_jira/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ config-version: 2

version: 0.1.0

profile: airbyte
profile: integration_tests

model-paths:
- models
Expand Down
61 changes: 61 additions & 0 deletions connectors/source_jira/integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: integration_test_jira

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_jira:
materialized: view
+schema: dbt_source_jira
staging:
materialized: view
tmp:
materialized: view

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

# Required by Fivetran dbt model
jira_database: "airbyte_db_default"
jira_schema: "dbt_source_jira"

jira_comment_identifier: "comment"
jira_component_identifier: "component"
jira_field_identifier: "field"
jira_field_option_identifier: "field_option"
jira_issue_identifier: "issue"
jira_issue_field_history_identifier: "issue_field_history"
jira_issue_link_identifier: "issue_link"
jira_issue_multiselect_history_identifier: "issue_multiselect_history"
jira_issue_type_identifier: "issue_types"
jira_priority_identifier: "issue_priorities"
jira_project_identifier: "project"
jira_resolution_identifier: "issue_resolutions"
jira_sprint_identifier: "sprint"
jira_status_identifier: "status"
jira_status_category_identifier: "workflow_status_categories"
jira_user_identifier: "user"
jira_version_identifier: "version"
13 changes: 13 additions & 0 deletions connectors/source_jira/integration_tests/package-lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
packages:
- local: ../
- package: fivetran/jira
version: 0.17.0
- package: fivetran/jira_source
version: 0.7.0
- package: fivetran/fivetran_utils
version: 0.4.10
- package: dbt-labs/spark_utils
version: 0.3.0
- package: dbt-labs/dbt_utils
version: 1.3.0
sha1_hash: b216f815347320cdcdf10fdbf54ef51e49b42e2a
5 changes: 5 additions & 0 deletions connectors/source_jira/integration_tests/packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
packages:
- local: ../

- package: fivetran/jira
version: [">=0.17.0", "<0.18.0"]
1 change: 1 addition & 0 deletions connectors/source_jira/integration_tests/vars
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{airbyte_database: $AB_DB, jira_database: $AB_DB}
56 changes: 56 additions & 0 deletions connectors/source_jira/models/fivetran_converter/comment.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

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

WITH TMP AS (
SELECT
author AS author_id,
body,
created,
id,
issueId AS issue_id,
jsdPublic AS is_public,
updateAuthor AS update_author_id,
updated
FROM
{{ source('source_jira', 'issue_comments') }}
)

SELECT * FROM TMP

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

WITH TMP AS (
SELECT
author AS author_id,
body,
created,
id,
issueId AS issue_id,
jsdPublic AS is_public,
updateAuthor AS update_author_id,
updated
FROM
{{ source('source_jira', 'issue_comments') }}
)

SELECT * FROM TMP

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

WITH TMP AS (
SELECT
author AS author_id,
body,
created,
id,
issueId AS issue_id,
jsdPublic AS is_public,
updateAuthor AS update_author_id,
updated
FROM
{{ source('source_jira', 'issue_comments') }}
)

SELECT * FROM TMP

{%endif%}
27 changes: 27 additions & 0 deletions connectors/source_jira/models/fivetran_converter/comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: 2

models:
- name: comment
schema: "{{ var('airbyte_schema', target.schema) }}"
database: "{{ var('airbyte_database', target.database) }}"
identifier: "{{ var('jira_comment_identifier', 'comment') }}"
description: All fields and field values associated with comments.
config:
+enabled: "{{ var('using_fivetran_model', False) }}"
columns:
- name: id
description: "The ID of the comment"
- name: issue_id
description: "ID of the related issue"
- name: author_id
description: "The ID of the user who created the comment"
- name: body
description: "The comment text in Atlassian Document Format"
- name: update_author_id
description: "The ID of the user who updated the comment last"
- name: created
description: "The date and time at which the comment was created"
- name: updated
description: "The date and time at which the comment was updated last"
- name: is_public
description: "Whether the comment is visible in Jira Service Desk"
44 changes: 44 additions & 0 deletions connectors/source_jira/models/fivetran_converter/component.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

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

WITH TMP AS (
SELECT
description,
id,
name,
projectId AS project_id
FROM
{{ source('source_jira', 'issue_comments') }}
)

SELECT * FROM TMP

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

WITH TMP AS (
SELECT
description,
id,
name,
projectId AS project_id
FROM
{{ source('source_jira', 'issue_comments') }}
)

SELECT * FROM TMP

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

WITH TMP AS (
SELECT
description,
id,
name,
projectId AS project_id
FROM
{{ source('source_jira', 'issue_comments') }}
)

SELECT * FROM TMP

{%endif%}
19 changes: 19 additions & 0 deletions connectors/source_jira/models/fivetran_converter/component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2

models:
- name: component
schema: "{{ var('airbyte_schema', target.schema) }}"
database: "{{ var('airbyte_database', target.database) }}"
identifier: "{{ var('jira_component_identifier', 'component') }}"
description: Table of project components (subsections to group issues).
config:
+enabled: "{{ var('using_fivetran_model', False) }}"
columns:
- name: id
description: ID of the component.
- name: description
description: Description given to the component.
- name: name
description: UI-facing name of the component.
- name: project_id
description: Foreign key referencing the id of the component's `project`.
Loading
Loading