+
Skip to content

Add disabling variables for issue_assignee, issue_label, label, and requested_reviewer_history #64

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

Merged
merged 7 commits into from
Jul 2, 2025
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
4 changes: 2 additions & 2 deletions .buildkite/scripts/run_models.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ cd integration_tests
dbt deps
dbt seed --target "$db" --full-refresh
dbt source freshness --target "$db" || echo "...Only verifying freshness runs…"
dbt run --vars '{github__using_repo_team: false, github__using_issue_assignee: false, github__using_issue_label: false, github__using_requested_reviewer_history: false, github__using_label: false}' --target "$db" --full-refresh
dbt test --vars '{github__using_repo_team: false, github__using_issue_assignee: false, github__using_issue_label: false, github__using_requested_reviewer_history: false, github__using_label: false}' --target "$db"
dbt run --target "$db" --full-refresh
dbt test --target "$db"
dbt run --vars '{github__using_repo_team: false}' --target "$db" --full-refresh
dbt test --target "$db"

dbt run-operation fivetran_utils.drop_schemas_automation --target "$db"
52 changes: 29 additions & 23 deletions .github/PULL_REQUEST_TEMPLATE/maintainer_pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
## PR Overview
**This PR will address the following Issue/Feature:**
<!--
Pre-Submission Reminders
Before marking this PR as "ready for review":

**This PR will result in the following new package version:**
<!--- Please add details around your decision for breaking vs non-breaking version upgrade. If this is a breaking change, were backwards-compatible options explored? -->
- `dbt run --full-refresh && dbt test`
- `dbt run` && `dbt test` (if incremental models are present)
- The related issue is linked, tagged, and appropriately assigned
- Documentation and version updates are included, if applicable
- `docs` have been regenerated (unless there are no code or YAML changes)
- BuildKite integration tests are passing
-->

**Please provide the finalized CHANGELOG entry which details the relevant changes included in this PR:**
<!--- Copy/paste the CHANGELOG for this version below. -->
## PR Overview
**Package version introduced in this PR:**

**This PR addresses the following Issue/Feature(s):**
<!-- Add Issue # or internal ticket reference -->

## PR Checklist
### Basic Validation
Please acknowledge that you have successfully performed the following commands locally:
- [ ] dbt run –full-refresh && dbt test
- [ ] dbt run (if incremental models are present) && dbt test
**Summary of changes:**
<!-- 1-2 sentences describing PR changes. -->

Before marking this PR as "ready for review" the following have been applied:
- [ ] The appropriate issue has been linked, tagged, and properly assigned
- [ ] All necessary documentation and version upgrades have been applied
- [ ] docs were regenerated (unless this PR does not include any code or yml updates)
- [ ] BuildKite integration tests are passing
- [ ] Detailed validation steps have been provided below

### Detailed Validation
Please share any and all of your validation steps:
<!--- Provide the steps you took to validate your changes below. -->
### Submission Checklist
- [ ] Alignment meeting with the reviewer (if needed)
- [ ] Timeline and validation requirements discussed
- [ ] Provide validation details:
- [ ] **Validation Steps:** Check for unintentional effects (e.g., add/run consistency & integrity tests)
- [ ] **Testing Instructions:** Confirm the change addresses the issue(s)
- [ ] **Focus Areas:** Complex logic or queries that need extra attention

### If you had to summarize this PR in an emoji, which would it be?
<!--- For a complete list of markdown compatible emojis check our this git repo (https://gist.github.com/rxaviers/7360908) -->
:dancer:
### Changelog
<!-- Recommend drafting changelog notes, then refining via ChatGPT using:
"Draft a changelog entry based on the following notes." -->
- [ ] Draft changelog for PR
- [ ] Final changelog for release review
8 changes: 8 additions & 0 deletions .quickstart/quickstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ schema_key: github_schema
dbt_versions: ">=1.3.0 <2.0.0"

table_variables:
github__using_issue_assignee:
- issue_assignee
github__using_issue_label:
- issue_label
github__using_label:
- label
github__using_repo_team:
- repo_team
- team
github__using_requested_reviewer_history:
- requested_reviewer_history

destination_configurations:
databricks:
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# dbt_github v0.9.1

[PR #64](https://github.com/fivetran/dbt_github/pull/64) includes the following updates:

## Feature Updates
- Added the following variables to account for potentially missing tables. For dbt Core users, each is `True` by default and will need to be set to `False` in the root project's `dbt_project.yml`. For Fivetran Quickstart users, they will be dynamically enabled/disabled based on the presence of the associated source table.
- `github__using_issue_assignee`: Disable if missing `ISSUE_ASSIGNEE`
- `github__using_issue_label`: Disable if missing `ISSUE_LABEL`
- `github__using_label`: Disable if missing `LABEL`
- `github__using_requested_reviewer_history`: Disable if missing `REQUESTED_REVIEWER_HISTORY`

## Under the Hood
- Updated package maintainer PR template.
- Added new variables to the `quickstart.yml` file.
- Added consistency validation tests for the `github__daily/weeky/monthly/quarterly_metrics` models.

# dbt_github v0.9.0

[PR #63](https://github.com/fivetran/dbt_github/pull/63) includes the following updates:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright © 2025 Fivetran Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<p align="center">
# Github dbt Package ([Docs](https://fivetran.github.io/dbt_github/))

<p align="left">
<a alt="License"
href="https://github.com/fivetran/dbt_github/blob/main/LICENSE">
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" /></a>
Expand All @@ -13,7 +15,6 @@
<img src="https://img.shields.io/badge/Fivetran_Quickstart_Compatible%3F-yes-green.svg" /></a>
</p>

# Github dbt Package ([Docs](https://fivetran.github.io/dbt_github/))
## What does this dbt package do?

- Produces modeled tables that leverage Github data from [Fivetran's connector](https://fivetran.com/docs/applications/github) in the format described by [this ERD](https://fivetran.com/docs/applications/github#schemainformation) and builds off of the output from our [github source package](https://github.com/fivetran/dbt_github_source).
Expand Down Expand Up @@ -80,14 +81,18 @@ vars:
### Step 4: Disable models for non-existent sources
Your Github connection might not sync every table that this package expects. If your syncs exclude certain tables, it is because you either don't use that functionality in Github or have actively excluded some tables from your syncs.

If you do not have the `REPO_TEAM` table synced, add the following variable to your `dbt_project.yml` file:
If you do not have the `TEAM`, `REPO_TEAM`, `ISSUE_ASSIGNEE`, `ISSUE_LABEL`, `LABEL`, or `REQUESTED_REVIEWER_HISTORY` tables synced and are not running the package via Fivetran Quickstart, add the following variables to your `dbt_project.yml` file:

```yml
vars:
github__using_repo_team: false # by default this is assumed to be true
github__using_repo_team: false # by default this is assumed to be true. Set to false if missing TEAM or REPO_TEAM
github__using_issue_assignee: false # by default this is assumed to be true
github__using_issue_label: false # by default this is assumed to be true
github__using_label: false # by default this is assumed to be true
github__using_requested_reviewer_history: false # by default this is assumed to be true
Comment on lines +89 to +92
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we update line 84 with the similar tables not being synced?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep updated!

```

*Note: This package only integrates the above variable. If you'd like to disable other models, please create an [issue](https://github.com/fivetran/dbt_github/issues) specifying which ones.*
*Note: This package only integrates the above variables. If you'd like to disable other models, please create an [issue](https://github.com/fivetran/dbt_github/issues) specifying which ones.*

### (Optional) Step 5: Additional configurations

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: 'github'
version: '0.9.0'
version: '0.9.1'
require-dbt-version: [">=1.3.0", "<2.0.0"]
models:
github:
Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

253 changes: 214 additions & 39 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.

8 changes: 5 additions & 3 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'github_integration_tests'
version: '0.9.0'
version: '0.9.1'
config-version: 2
profile: 'integration_tests'
vars:
Expand All @@ -20,10 +20,12 @@ vars:
github_team_identifier: "github_team_data"
github_user_identifier: "github_user_data"

# models:
# +schema: "github_{{ var('directed_schema','dev') }}"
models:
+schema: "github_{{ var('directed_schema','dev') }}"

seeds:
+docs:
show: false
github_integration_tests:
+quote_columns: "{{ true if target.type == 'redshift' else false }}"
+column_types:
Expand Down
83 changes: 83 additions & 0 deletions integration_tests/tests/consistency_daily_metrics.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{{ config(
tags="fivetran_validations",
enabled=var('fivetran_validation_tests_enabled', false)
) }}

-- this test ensures the github__daily_metrics end model matches the prior version
with prod as (
select
day,
repository,
sum(coalesce(number_issues_opened, 0)) as number_issues_opened,
sum(coalesce(number_issues_closed, 0)) as number_issues_closed,
sum(coalesce(sum_days_issue_open, 0)) as sum_days_issue_open,
sum(coalesce(longest_days_issue_open, 0)) as longest_days_issue_open,
sum(coalesce(number_prs_opened, 0)) as number_prs_opened,
sum(coalesce(number_prs_merged, 0)) as number_prs_merged,
sum(coalesce(number_prs_closed_without_merge, 0)) as number_prs_closed_without_merge,
sum(coalesce(sum_days_pr_open, 0)) as sum_days_pr_open,
sum(coalesce(longest_days_pr_open, 0)) as longest_days_pr_open

from {{ target.schema }}_github_prod.github__daily_metrics
where date(day) < current_date() -- BQ
group by 1, 2
),

dev as (
select
day,
repository,
sum(coalesce(number_issues_opened, 0)) as number_issues_opened,
sum(coalesce(number_issues_closed, 0)) as number_issues_closed,
sum(coalesce(sum_days_issue_open, 0)) as sum_days_issue_open,
sum(coalesce(longest_days_issue_open, 0)) as longest_days_issue_open,
sum(coalesce(number_prs_opened, 0)) as number_prs_opened,
sum(coalesce(number_prs_merged, 0)) as number_prs_merged,
sum(coalesce(number_prs_closed_without_merge, 0)) as number_prs_closed_without_merge,
sum(coalesce(sum_days_pr_open, 0)) as sum_days_pr_open,
sum(coalesce(longest_days_pr_open, 0)) as longest_days_pr_open

from {{ target.schema }}_github_dev.github__daily_metrics
where date(day) < current_date() -- BQ
group by 1, 2
),

final as (
select
coalesce(prod.day, dev.day) as day,
prod.number_issues_opened as prod_number_issues_opened,
dev.number_issues_opened as dev_number_issues_opened,
prod.number_issues_closed as prod_number_issues_closed,
dev.number_issues_closed as dev_number_issues_closed,
prod.sum_days_issue_open as prod_sum_days_issue_open,
dev.sum_days_issue_open as dev_sum_days_issue_open,
prod.longest_days_issue_open as prod_longest_days_issue_open,
dev.longest_days_issue_open as dev_longest_days_issue_open,
prod.number_prs_opened as prod_number_prs_opened,
dev.number_prs_opened as dev_number_prs_opened,
prod.number_prs_merged as prod_number_prs_merged,
dev.number_prs_merged as dev_number_prs_merged,
prod.number_prs_closed_without_merge as prod_number_prs_closed_without_merge,
dev.number_prs_closed_without_merge as dev_number_prs_closed_without_merge,
prod.sum_days_pr_open as prod_sum_days_pr_open,
dev.sum_days_pr_open as dev_sum_days_pr_open,
prod.longest_days_pr_open as prod_longest_days_pr_open,
dev.longest_days_pr_open as dev_longest_days_pr_open
from prod
full outer join dev
on dev.repository = prod.repository
and dev.day = prod.day
)

select *
from final
where
abs(prod_number_issues_opened - dev_number_issues_opened) >= .01
or abs(prod_number_issues_closed - dev_number_issues_closed) >= .01
or abs(prod_sum_days_issue_open - dev_sum_days_issue_open) >= .01
or abs(prod_longest_days_issue_open - dev_longest_days_issue_open) >= .01
or abs(prod_number_prs_opened - dev_number_prs_opened) >= .01
or abs(prod_number_prs_merged - dev_number_prs_merged) >= .01
or abs(prod_number_prs_closed_without_merge - dev_number_prs_closed_without_merge) >= .01
or abs(prod_sum_days_pr_open - dev_sum_days_pr_open) >= .01
or abs(prod_longest_days_pr_open - dev_longest_days_pr_open) >= .01
83 changes: 83 additions & 0 deletions integration_tests/tests/consistency_monthly_metrics.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{{ config(
tags="fivetran_validations",
enabled=var('fivetran_validation_tests_enabled', false)
) }}

-- this test ensures the github__monthly_metrics end model matches the prior version
with prod as (
select
month,
repository,
sum(coalesce(number_issues_opened, 0)) as number_issues_opened,
sum(coalesce(number_issues_closed, 0)) as number_issues_closed,
sum(coalesce(avg_days_issue_open, 0)) as avg_days_issue_open,
sum(coalesce(longest_days_issue_open, 0)) as longest_days_issue_open,
sum(coalesce(number_prs_opened, 0)) as number_prs_opened,
sum(coalesce(number_prs_merged, 0)) as number_prs_merged,
sum(coalesce(number_prs_closed_without_merge, 0)) as number_prs_closed_without_merge,
sum(coalesce(avg_days_pr_open, 0)) as avg_days_pr_open,
sum(coalesce(longest_days_pr_open, 0)) as longest_days_pr_open

from {{ target.schema }}_github_prod.github__monthly_metrics
where date(month) < current_date() -- BQ
group by 1, 2
),

dev as (
select
month,
repository,
sum(coalesce(number_issues_opened, 0)) as number_issues_opened,
sum(coalesce(number_issues_closed, 0)) as number_issues_closed,
sum(coalesce(avg_days_issue_open, 0)) as avg_days_issue_open,
sum(coalesce(longest_days_issue_open, 0)) as longest_days_issue_open,
sum(coalesce(number_prs_opened, 0)) as number_prs_opened,
sum(coalesce(number_prs_merged, 0)) as number_prs_merged,
sum(coalesce(number_prs_closed_without_merge, 0)) as number_prs_closed_without_merge,
sum(coalesce(avg_days_pr_open, 0)) as avg_days_pr_open,
sum(coalesce(longest_days_pr_open, 0)) as longest_days_pr_open

from {{ target.schema }}_github_dev.github__monthly_metrics
where date(month) < current_date() -- BQ
group by 1, 2
),

final as (
select
coalesce(prod.month, dev.month) as month,
prod.number_issues_opened as prod_number_issues_opened,
dev.number_issues_opened as dev_number_issues_opened,
prod.number_issues_closed as prod_number_issues_closed,
dev.number_issues_closed as dev_number_issues_closed,
prod.avg_days_issue_open as prod_avg_days_issue_open,
dev.avg_days_issue_open as dev_avg_days_issue_open,
prod.longest_days_issue_open as prod_longest_days_issue_open,
dev.longest_days_issue_open as dev_longest_days_issue_open,
prod.number_prs_opened as prod_number_prs_opened,
dev.number_prs_opened as dev_number_prs_opened,
prod.number_prs_merged as prod_number_prs_merged,
dev.number_prs_merged as dev_number_prs_merged,
prod.number_prs_closed_without_merge as prod_number_prs_closed_without_merge,
dev.number_prs_closed_without_merge as dev_number_prs_closed_without_merge,
prod.avg_days_pr_open as prod_avg_days_pr_open,
dev.avg_days_pr_open as dev_avg_days_pr_open,
prod.longest_days_pr_open as prod_longest_days_pr_open,
dev.longest_days_pr_open as dev_longest_days_pr_open
from prod
full outer join dev
on dev.repository = prod.repository
and dev.month = prod.month
)

select *
from final
where
abs(prod_number_issues_opened - dev_number_issues_opened) >= .01
or abs(prod_number_issues_closed - dev_number_issues_closed) >= .01
or abs(prod_avg_days_issue_open - dev_avg_days_issue_open) >= .01
or abs(prod_longest_days_issue_open - dev_longest_days_issue_open) >= .01
or abs(prod_number_prs_opened - dev_number_prs_opened) >= .01
or abs(prod_number_prs_merged - dev_number_prs_merged) >= .01
or abs(prod_number_prs_closed_without_merge - dev_number_prs_closed_without_merge) >= .01
or abs(prod_avg_days_pr_open - dev_avg_days_pr_open) >= .01
or abs(prod_longest_days_pr_open - dev_longest_days_pr_open) >= .01
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载