Skip to content
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# dbt_github v1.1.1

## Under the Hood
- Adds the `partition_by_source_relation` macro to improve window function partition handling and prevent conflicts when the unioned data feature is disabled.

# dbt_github v1.1.0

## Schema/Data Change
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: '1.1.0'
version: '1.1.1'
require-dbt-version: [">=1.3.0", "<2.0.0"]
models:
github:
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'github_integration_tests'
version: '1.1.0'
version: '1.1.1'
config-version: 2
profile: 'integration_tests'
vars:
Expand Down
15 changes: 15 additions & 0 deletions macros/union/partition_by_source_relation.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{%- macro partition_by_source_relation(has_other_partitions='yes', alias=None) -%}

{{ adapter.dispatch('partition_by_source_relation', 'github') () }}

{%- endmacro %}

{% macro default__partition_by_source_relation(has_other_partitions, alias) -%}
{% set prefix = '' if alias is none else alias ~ '.' %}

{%- if has_other_partitions == 'no' -%}
{{ 'partition by ' ~ prefix ~ 'source_relation' if var('github_sources', [])|length > 1 }}
{%- else -%}
{{ ', ' ~ prefix ~ 'source_relation' if var('github_sources', [])|length > 1 }}
{%- endif -%}
{%- endmacro -%}
2 changes: 1 addition & 1 deletion models/intermediate/int_github__issue_open_length.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ close_events_with_timestamps as (
source_relation,
issue_id,
updated_at as valid_starting,
coalesce(lead(updated_at) over (partition by issue_id, source_relation order by updated_at), {{ dbt.current_timestamp() }}) as valid_until,
coalesce(lead(updated_at) over (partition by issue_id {{ github.partition_by_source_relation() }} order by updated_at), {{ dbt.current_timestamp() }}) as valid_until,
is_closed
from close_events_stacked
)
Expand Down