From ef1fed0e4fb8fbe10efde50b4dacb487e2392bed Mon Sep 17 00:00:00 2001 From: Joel Labes Date: Tue, 6 Dec 2022 14:46:54 +1300 Subject: [PATCH] Add v1 compatibility and deprecation notice (#89) * Add v1 compatibility and deprecation notice * Temporarily allow release candidate for testing * Update packages.yml --- README.md | 2 ++ dbt_project.yml | 2 +- macros/generate_sessionization_incremental_filter.sql | 4 ++-- models/base/segment_web_page_views.sql | 2 +- models/sessionization/segment_web_page_views__sessionized.sql | 4 ++-- models/sessionization/segment_web_sessions__initial.sql | 2 +- packages.yml | 2 +- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ae54efc..9362ac5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +> ⛔🏚️ This package is no longer developed or maintained by dbt Labs. If you're interested in forking/adopting it, reach out in #package-ecosystem on dbt Slack. + # dbt-segment This [dbt package](https://docs.getdbt.com/docs/package-management): * Performs "user stitching" to tie all events associated with a cookie to the same user_id diff --git a/dbt_project.yml b/dbt_project.yml index 92d1c77..dc86936 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -1,6 +1,6 @@ name: 'segment' version: '0.7.0' -require-dbt-version: [">=1.0.0", "<2.0.0"] +require-dbt-version: [">=1.3.0", "<2.0.0"] config-version: 2 model-paths: ["models"] diff --git a/macros/generate_sessionization_incremental_filter.sql b/macros/generate_sessionization_incremental_filter.sql index a5498dc..ce6f97d 100644 --- a/macros/generate_sessionization_incremental_filter.sql +++ b/macros/generate_sessionization_incremental_filter.sql @@ -6,7 +6,7 @@ {% macro default__generate_sessionization_incremental_filter(merge_target, filter_tstamp, max_tstamp, operator) %} where {{ filter_tstamp }} {{ operator }} ( select - {{ dbt_utils.dateadd( + {{ dbt.dateadd( 'hour', -var('segment_sessionization_trailing_window'), 'max(' ~ max_tstamp ~ ')' @@ -29,7 +29,7 @@ {% macro postgres__generate_sessionization_incremental_filter(merge_target, filter_tstamp, max_tstamp, operator) %} where cast({{ filter_tstamp }} as timestamp) {{ operator }} ( select - {{ dbt_utils.dateadd( + {{ dbt.dateadd( 'hour', -var('segment_sessionization_trailing_window'), 'max(' ~ max_tstamp ~ ')' diff --git a/models/base/segment_web_page_views.sql b/models/base/segment_web_page_views.sql index c808a6b..ff9ffca 100644 --- a/models/base/segment_web_page_views.sql +++ b/models/base/segment_web_page_views.sql @@ -58,7 +58,7 @@ renamed as ( case when lower(context_user_agent) like '%android%' then 'Android' else replace( - {{ dbt_utils.split_part(dbt_utils.split_part('context_user_agent', "'('", 2), "' '", 1) }}, + {{ dbt.split_part(dbt.split_part('context_user_agent', "'('", 2), "' '", 1) }}, ';', '') end as device diff --git a/models/sessionization/segment_web_page_views__sessionized.sql b/models/sessionization/segment_web_page_views__sessionized.sql index add2a5b..ef347e2 100644 --- a/models/sessionization/segment_web_page_views__sessionized.sql +++ b/models/sessionization/segment_web_page_views__sessionized.sql @@ -77,7 +77,7 @@ diffed as ( select *, - {{ dbt_utils.datediff('previous_tstamp', 'tstamp', 'second') }} as period_of_inactivity + {{ dbt.datediff('previous_tstamp', 'tstamp', 'second') }} as period_of_inactivity from lagged ), @@ -127,7 +127,7 @@ session_ids as ( {{dbt_utils.star(ref('segment_web_page_views'))}}, page_view_number, - {{dbt_utils.surrogate_key(['anonymous_id', 'session_number'])}} as session_id + {{dbt_utils.generate_surrogate_key(['anonymous_id', 'session_number'])}} as session_id from session_numbers diff --git a/models/sessionization/segment_web_sessions__initial.sql b/models/sessionization/segment_web_sessions__initial.sql index 02b6354..2ea0da7 100644 --- a/models/sessionization/segment_web_sessions__initial.sql +++ b/models/sessionization/segment_web_sessions__initial.sql @@ -90,7 +90,7 @@ diffs as ( *, - {{ dbt_utils.datediff('session_start_tstamp', 'session_end_tstamp', 'second') }} as duration_in_s + {{ dbt.datediff('session_start_tstamp', 'session_end_tstamp', 'second') }} as duration_in_s from agg diff --git a/packages.yml b/packages.yml index 83da812..2d359af 100644 --- a/packages.yml +++ b/packages.yml @@ -1,3 +1,3 @@ packages: - package: dbt-labs/dbt_utils - version: [">=0.8.0", "<0.9.0"] + version: [">=1.0.0", "<2.0.0"]