Skip to content

Commit

Permalink
[create-pull-request] automated change (#623)
Browse files Browse the repository at this point in the history
Co-authored-by: rlh1994 <rlh1994@users.noreply.github.com>
  • Loading branch information
2 people authored and agnessnowplow committed Oct 6, 2023
1 parent 59d1f08 commit 6c67bcb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2214,7 +2214,7 @@ with new_events_session_ids as (
group by 1
)
{% if snowplow_utils.snowplow_is_incremental() %}
{% if is_incremental() %}
, previous_sessions as (
select *
Expand Down Expand Up @@ -2321,7 +2321,7 @@ with session_context as (
group by 1
)
{% if snowplow_utils.snowplow_is_incremental() %}
{% if is_incremental() %}
, previous_sessions as (
select *
Expand Down Expand Up @@ -2384,6 +2384,7 @@ from session_lifecycle sl
</TabItem>
<TabItem value="macro" label="Macros">

- macro.dbt.is_incremental
- [macro.snowplow_mobile.allow_refresh](/docs/modeling-your-data/modeling-your-data-with-dbt/reference/snowplow_mobile/macros/index.md#macro.snowplow_mobile.allow_refresh)
- [macro.snowplow_mobile.get_device_user_id_path_sql](/docs/modeling-your-data/modeling-your-data-with-dbt/reference/snowplow_mobile/macros/index.md#macro.snowplow_mobile.get_device_user_id_path_sql)
- [macro.snowplow_mobile.get_session_id_path_sql](/docs/modeling-your-data/modeling-your-data-with-dbt/reference/snowplow_mobile/macros/index.md#macro.snowplow_mobile.get_session_id_path_sql)
Expand All @@ -2394,7 +2395,6 @@ from session_lifecycle sl
- [macro.snowplow_utils.is_run_with_new_events](/docs/modeling-your-data/modeling-your-data-with-dbt/reference/snowplow_utils/macros/index.md#macro.snowplow_utils.is_run_with_new_events)
- [macro.snowplow_utils.return_base_new_event_limits](/docs/modeling-your-data/modeling-your-data-with-dbt/reference/snowplow_utils/macros/index.md#macro.snowplow_utils.return_base_new_event_limits)
- [macro.snowplow_utils.set_query_tag](/docs/modeling-your-data/modeling-your-data-with-dbt/reference/snowplow_utils/macros/index.md#macro.snowplow_utils.set_query_tag)
- [macro.snowplow_utils.snowplow_is_incremental](/docs/modeling-your-data/modeling-your-data-with-dbt/reference/snowplow_utils/macros/index.md#macro.snowplow_utils.snowplow_is_incremental)
- [macro.snowplow_utils.timestamp_add](/docs/modeling-your-data/modeling-your-data-with-dbt/reference/snowplow_utils/macros/index.md#macro.snowplow_utils.timestamp_add)

</TabItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ This macro does not currently have a description.
and a.dvce_sent_tstamp <= {{ snowplow_utils.timestamp_add('day', days_late_allowed, 'a.dvce_created_tstamp') }}
and a.{{ session_timestamp }} >= {{ lower_limit }}
and a.{{ session_timestamp }} <= {{ upper_limit }}
and a.{{ session_timestamp }} >= b.start_tstamp -- deal with late loading events
{% if derived_tstamp_partitioned and target.type == 'bigquery' | as_bool() %}
and a.derived_tstamp >= {{ snowplow_utils.timestamp_add('hour', -1, lower_limit) }}
Expand Down Expand Up @@ -384,6 +385,7 @@ This macro does not currently have a description.
and a.dvce_sent_tstamp <= {{ snowplow_utils.timestamp_add('day', days_late_allowed, 'a.dvce_created_tstamp') }}
and a.{{ session_timestamp }} >= {{ lower_limit }}
and a.{{ session_timestamp }} <= {{ upper_limit }}
and a.{{ session_timestamp }} >= b.start_tstamp -- deal with late loading events
and {{ snowplow_utils.app_id_filter(app_ids) }}
)
Expand Down Expand Up @@ -549,7 +551,11 @@ This macro does not currently have a description.
{% set create_quarantined_query %}
with prep as (
select
cast(null as {{ snowplow_utils.type_max_string() }}) session_identifier
{% if target.type == 'redshift' %} {# Done because max causes errors when used in subquery, #}
cast(null as varchar(6000)) session_identifier
{% else %}
cast(null as {{ snowplow_utils.type_max_string() }}) session_identifier
{% endif %}
)
select *
Expand Down Expand Up @@ -644,7 +650,7 @@ This macro does not currently have a description.
NULL
) as session_identifier,
{%- else -%}
{% do exceptions.raise_compiler_error("Need to specify either session identifiers or custom session code") %}
{% do exceptions.raise_compiler_error("Need to specify either session identifiers or custom session SQL") %}
{%- endif %}
{%- if user_sql -%}
{{ user_sql }} as user_identifier,
Expand All @@ -663,7 +669,7 @@ This macro does not currently have a description.
)
) as user_identifier, -- Edge case 1: Arbitary selection to avoid window function like first_value.
{% else %}
{% do exceptions.raise_compiler_error("Need to specify either session identifiers or custom session code") %}
{% do exceptions.raise_compiler_error("Need to specify either user identifiers or custom user SQL") %}
{%- endif %}
min({{ session_timestamp }}) as start_tstamp,
max({{ session_timestamp }}) as end_tstamp
Expand Down Expand Up @@ -5102,7 +5108,7 @@ This macro does not currently have a description.
<center><b><i><a href="https://github.com/snowplow/dbt-snowplow-utils/blob/main/macros/incremental_hooks/snowplow_incremental_post_hook.sql">Source</a></i></b></center>

```jinja2
{% macro snowplow_incremental_post_hook(package_name='snowplow', incremental_manifest_table_name=none, base_events_this_run_table_name=none) %}
{% macro snowplow_incremental_post_hook(package_name='snowplow', incremental_manifest_table_name=none, base_events_this_run_table_name=none, session_timestamp=var('snowplow__session_timestamp', 'load_tstamp')) %}
{% set enabled_snowplow_models = snowplow_utils.get_enabled_snowplow_models(package_name) -%}
Expand All @@ -5120,7 +5126,7 @@ This macro does not currently have a description.
{% set base_events_this_run_table = ref(package_name~'_base_events_this_run') -%}
{%- endif -%}
{{ snowplow_utils.update_incremental_manifest_table(incremental_manifest_table, base_events_this_run_table, successful_snowplow_models) }}
{{ snowplow_utils.update_incremental_manifest_table(incremental_manifest_table, base_events_this_run_table, successful_snowplow_models, session_timestamp) }}
{% endmacro %}
```
Expand Down Expand Up @@ -5742,9 +5748,9 @@ This macro does not currently have a description.
<TabItem value="raw" label="raw" default>

```jinja2
{% macro update_incremental_manifest_table(manifest_table, base_events_table, models) -%}
{% macro update_incremental_manifest_table(manifest_table, base_events_table, models, session_timestamp=var('snowplow__session_timestamp', 'load_tstamp')) -%}
{{ return(adapter.dispatch('update_incremental_manifest_table', 'snowplow_utils')(manifest_table, base_events_table, models)) }}
{{ return(adapter.dispatch('update_incremental_manifest_table', 'snowplow_utils')(manifest_table, base_events_table, models, session_timestamp)) }}
{% endmacro %}
```
Expand All @@ -5753,7 +5759,7 @@ This macro does not currently have a description.
<TabItem value="default" label="default">

```jinja2
{% macro default__update_incremental_manifest_table(manifest_table, base_events_table, models) -%}
{% macro default__update_incremental_manifest_table(manifest_table, base_events_table, models, session_timestamp) -%}
{% if models %}
Expand All @@ -5763,7 +5769,7 @@ This macro does not currently have a description.
a.last_success
from
(select max(collector_tstamp) as last_success from {{ base_events_table }}) a,
(select max({{ session_timestamp }}) as last_success from {{ base_events_table }}) a,
({% for model in models %} select '{{model}}' as model {%- if not loop.last %} union all {% endif %} {% endfor %}) b
where a.last_success is not null -- if run contains no data don't add to manifest
Expand All @@ -5790,7 +5796,7 @@ This macro does not currently have a description.
<TabItem value="postgres" label="postgres">

```jinja2
{% macro postgres__update_incremental_manifest_table(manifest_table, base_events_table, models) -%}
{% macro postgres__update_incremental_manifest_table(manifest_table, base_events_table, models, session_timestamp) -%}
{% if models %}
Expand All @@ -5809,7 +5815,7 @@ This macro does not currently have a description.
last_success
from
(select max(collector_tstamp) as last_success from {{ base_events_table }}) as ls,
(select max({{ session_timestamp }}) as last_success from {{ base_events_table }}) as ls,
({% for model in models %} select '{{model}}' as model {%- if not loop.last %} union all {% endif %} {% endfor %}) as mod
where last_success is not null -- if run contains no data don't add to manifest
Expand Down
13 changes: 13 additions & 0 deletions src/dbtVersions.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,13 @@ export const dbtVersions = {
"dbt-labs/dbt_utils": ">=1.0.0 <2.0.0",
"snowplow/snowplow_utils": ">=0.14.0 <0.16.0"
}
},
"0.7.3": {
"dbtversion": ">=1.4.0 <2.0.0",
"packages": {
"dbt-labs/dbt_utils": ">=1.0.0 <2.0.0",
"snowplow/snowplow_utils": ">=0.14.0 <0.16.0"
}
}
},
"snowplow/snowplow_normalize": {
Expand Down Expand Up @@ -624,6 +631,12 @@ export const dbtVersions = {
"packages": {
"dbt-labs/dbt_utils": ">=1.0.0 <2.0.0"
}
},
"0.15.1": {
"dbtversion": ">=1.4.0 <2.0.0",
"packages": {
"dbt-labs/dbt_utils": ">=1.0.0 <2.0.0"
}
}
},
"snowplow/snowplow_web": {
Expand Down

0 comments on commit 6c67bcb

Please sign in to comment.