Skip to content

Commit

Permalink
Merge pull request #72 from fivetran/bugfix/incremental-mar-filter-re…
Browse files Browse the repository at this point in the history
…moval

bugfix/incremental-mar-filter-removal
  • Loading branch information
fivetran-joemarkiewicz authored Feb 15, 2023
2 parents 226deff + 6568031 commit 6e5fbe7
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 14 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# dbt_fivetran_log v0.7.1
## Bug Fixes
- Modified the logic within the `fivetran_log__mar_table_history` model to no longer filter out previous historical MAR records. Previously, these fields were filtered out as the `active_volume` source (since deprecated and replaced with `incremental_mar`) produced a cumulative daily MAR total. However, the `incremental_mar` source is not cumulative and will need to include all historical records. ([#72](https://github.com/fivetran/dbt_fivetran_log/pull/72))

## Under the Hood
- Added coalesce statements to the `paid_monthly_active_rows` and `free_monthly_active_rows` fields within the [fivetran_log__mar_table_history](https://fivetran.github.io/dbt_fivetran_log/#!/model/model.fivetran_log.fivetran_log__mar_table_history) model to coalesce to 0. ([#72](https://github.com/fivetran/dbt_fivetran_log/pull/72))

## Contributors
- [@pkanter](https://github.com/pkanter) ([#63](https://github.com/fivetran/dbt_fivetran_log/issues/63))

# dbt_fivetran_log v0.7.0

## 🚨 Breaking Changes 🚨:
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: 'fivetran_log'
version: '0.7.0'
version: '0.7.1'
require-dbt-version: [">=1.3.0", "<2.0.0"]

models:
Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion 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.

2 changes: 1 addition & 1 deletion docs/run_results.json

Large diffs are not rendered by default.

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: 'fivetran_log_integration_tests'
version: '0.7.0'
version: '0.7.1'

config-version: 2
profile: 'integration_tests'
Expand Down
12 changes: 4 additions & 8 deletions models/fivetran_log__mar_table_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,12 @@ ordered_mar as (
measured_date,
measured_month,
incremental_rows,
case when lower(free_type) = 'paid'
coalesce(case when lower(free_type) = 'paid'
then incremental_rows
end as paid_monthly_active_rows,
case when lower(free_type) != 'paid'
end, 0) as paid_monthly_active_rows,
coalesce(case when lower(free_type) != 'paid'
then incremental_rows
end as free_monthly_active_rows,

-- each measurement is cumulative for the month, so we'll only look at the latest date for each month
row_number() over(partition by table_name, connector_name, destination_id, measured_month order by measured_date desc) as n
end, 0) as free_monthly_active_rows

from incremental_mar

Expand All @@ -57,7 +54,6 @@ latest_mar as (
(free_monthly_active_rows + paid_monthly_active_rows) as total_monthly_active_rows

from ordered_mar
where n = 1

),

Expand Down

0 comments on commit 6e5fbe7

Please sign in to comment.