Skip to content
Merged
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
17 changes: 16 additions & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
steps:
- label: ":postgres: Run Tests - Postgres"
key: "run-dbt-postgres"
plugins:
- docker#v3.13.0:
image: "python:3.8"
shell: [ "/bin/bash", "-e", "-c" ]
environment:
- "BASH_ENV=/tmp/.bashrc"
- "CI_POSTGRES_DBT_DBNAME"
- "CI_POSTGRES_DBT_HOST"
- "CI_POSTGRES_DBT_PASS"
- "CI_POSTGRES_DBT_USER"
commands: |
bash .buildkite/scripts/run_models.sh postgres

- label: ":snowflake-db: Run Tests - Snowflake"
key: "run_dbt_snowflake"
plugins:
Expand Down Expand Up @@ -43,7 +58,7 @@ steps:
commands: |
bash .buildkite/scripts/run_models.sh redshift

- label: ":bricks: Run Tests - Databricks"
- label: ":databricks: Run Tests - Databricks"
key: "run_dbt_databricks"
plugins:
- docker#v3.13.0:
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
# dbt_github v0.7.0

## 🚨 Breaking Change 🚨
- Updated the following models to aggregate at the repository grain in addition to their time period grain. ([#42](https://github.com/fivetran/dbt_github/pull/42), [#43](https://github.com/fivetran/dbt_github/pull/43))
- `github__daily_metrics`
- `github__weekly_metrics`
- `github__monthly_metrics`
- `github__quarterly_metrics`

## 🎉 Features
- Added column `requested_reviewers` to provide a list of users that were requested to review on a pull request. This is to supplement the column `reviewers`, which provides a list of users that have submitted a reivew, weather or not they were requested to.
- PostgreSQL compatibility!

## 🔧 Bug Fix
- Updated model `int_github__pull_request_reviewers` so that the list of reviewers generated does not contain duplicate usernames.

## Contributors 📝
- @onimsha ([#42](https://github.com/fivetran/dbt_github/pull/42))

# dbt_github v0.6.0
[PR #35](https://github.com/fivetran/dbt_github/pull/35) includes the following breaking changes:
## 🚨 Breaking Changes 🚨:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The following table provides a detailed list of all models materialized within t
To use this dbt package, you must have the following:

- At least one Fivetran Github connector syncing data into your destination.
- A **BigQuery**, **Snowflake**, **Redshift**, or **Databricks** destination.
- A **BigQuery**, **Snowflake**, **Redshift**, **PostgreSQL**, or **Databricks** destination.

### Databricks Dispatch Configuration
If you are using a Databricks destination with this package you will need to add the below (or a variation of the below) dispatch configuration within your `dbt_project.yml`. This is required in order for the package to accurately search for macros within the `dbt-labs/spark_utils` then the `dbt-labs/dbt_utils` packages respectively.
Expand Down
3 changes: 3 additions & 0 deletions models/github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ models:
- name: reviewers
description: List of Users who reviewed the pull request

- name: requested_reviewers
description: List of Users who were requested to review the pull request

- name: number_of_reviews
description: Number of times a pull request was reviewed

Expand Down
3 changes: 2 additions & 1 deletion models/intermediate/int_github__issue_joined.sql
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ select
hours_request_review_to_first_action,
hours_request_review_to_merge,
merged_at,
reviewers,
reviewers,
requested_reviewers,
number_of_reviews
from issue
left join issue_labels as labels
Expand Down
42 changes: 37 additions & 5 deletions models/intermediate/int_github__pull_request_reviewers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,44 @@ with pull_request_review as (
github_user as (
select *
from {{ var('user')}}
)
),

select
pull_request_review.pull_request_id,
{{ fivetran_utils.string_agg( 'github_user.login_name', "', '" )}} as reviewers,
count(*) as number_of_reviews
actual_reviewers as (
select
pull_request_review.pull_request_id,
{{ fivetran_utils.string_agg( 'distinct github_user.login_name', "', '" )}} as reviewers,
count(*) as number_of_reviews
from pull_request_review
left join github_user on pull_request_review.user_id = github_user.user_id
group by 1
),

requested_reviewer_history as (

select *
from {{ var('requested_reviewer_history') }}
where removed = false
),

requested_reviewers as (
select
requested_reviewer_history.pull_request_id,
{{ fivetran_utils.string_agg( 'distinct github_user.login_name', "', '" )}} as requested_reviewers
from requested_reviewer_history
left join github_user on requested_reviewer_history.requested_id = github_user.user_id
group by 1
),

joined as (
select
actual_reviewers.pull_request_id,
actual_reviewers.reviewers,
requested_reviewers.requested_reviewers,
actual_reviewers.number_of_reviews
from actual_reviewers
full outer join requested_reviewers
on requested_reviewers.pull_request_id = actual_reviewers.pull_request_id
)

select *
from joined