generated from snowplow-incubator/dbt-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
1,139 additions
and
1,373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{% macro get_action_context_fields() %} | ||
{{ return(adapter.dispatch('get_action_context_fields', 'snowplow_ecommerce')()) }} | ||
{%- endmacro -%} | ||
|
||
{% macro postgres__get_action_context_fields() %} | ||
, ecommerce_action_type | ||
, ecommerce_action_name | ||
{% endmacro %} | ||
|
||
{% macro bigquery__get_action_context_fields() %} | ||
,{{ snowplow_utils.get_optional_fields( | ||
enabled=true, | ||
fields=tracking_action_fields(), | ||
col_prefix='unstruct_event_com_snowplowanalytics_snowplow_ecommerce_snowplow_ecommerce_action_1_', | ||
relation=source('atomic', 'events') if project_name != 'snowplow_ecommerce_integration_tests' else ref('snowplow_ecommerce_events_stg'), | ||
relation_alias=none) }} | ||
{% endmacro %} | ||
|
||
{% macro spark__get_action_context_fields() %} | ||
, unstruct_event_com_snowplowanalytics_snowplow_ecommerce_snowplow_ecommerce_action_1.type::string as ecommerce_action_type | ||
, unstruct_event_com_snowplowanalytics_snowplow_ecommerce_snowplow_ecommerce_action_1.name::string as ecommerce_action_name | ||
{% endmacro %} | ||
|
||
{% macro snowflake__get_action_context_fields() %} | ||
, unstruct_event_com_snowplowanalytics_snowplow_ecommerce_snowplow_ecommerce_action_1:type::varchar as ecommerce_action_type | ||
, unstruct_event_com_snowplowanalytics_snowplow_ecommerce_snowplow_ecommerce_action_1:name::varchar as ecommerce_action_name | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{% macro get_cart_context_fields() %} | ||
{{ return(adapter.dispatch('get_cart_context_fields', 'snowplow_ecommerce')()) }} | ||
{%- endmacro -%} | ||
|
||
{% macro postgres__get_cart_context_fields() %} | ||
{% if var('snowplow__disable_ecommerce_carts', false) %} | ||
, cast(NULL as {{ type_string() }}) as cart_id | ||
, cast(NULL as {{ type_string() }}) as cart_currency | ||
, cast(NULL as decimal(9,2)) as cart_total_value | ||
{% else %} | ||
, cart__cart_id as cart_id | ||
, cart__currency as cart_currency | ||
, cart__total_value as cart_total_value | ||
{% endif %} | ||
{% endmacro %} | ||
|
||
{% macro bigquery__get_cart_context_fields() %} | ||
|
||
{% if var('snowplow__disable_ecommerce_carts', false) %} | ||
, cast(NULL as {{ type_string() }}) as cart_id | ||
, cast(NULL as {{ type_string() }}) as cart_currency | ||
, cast(NULL as decimal(9,2)) as cart_total_value | ||
{% else %} | ||
, {{ snowplow_utils.get_optional_fields( | ||
enabled=true, | ||
fields=cart_fields(), | ||
col_prefix='contexts_com_snowplowanalytics_snowplow_ecommerce_cart_1_', | ||
relation=source('atomic', 'events') if project_name != 'snowplow_ecommerce_integration_tests' else ref('snowplow_ecommerce_events_stg'), | ||
relation_alias=none) }} | ||
{% endif %} | ||
{% endmacro %} | ||
|
||
{% macro spark__get_cart_context_fields() %} | ||
{% if var('snowplow__disable_ecommerce_carts', false) %} | ||
, cast(NULL as {{ type_string() }}) as cart_id | ||
, cast(NULL as {{ type_string() }}) as cart_currency | ||
, cast(NULL as decimal(9,2)) as cart_total_value | ||
{% else %} | ||
, contexts_com_snowplowanalytics_snowplow_ecommerce_cart_1[0].cart_id::string as cart_id | ||
, contexts_com_snowplowanalytics_snowplow_ecommerce_cart_1[0].currency::string as cart_currency | ||
, contexts_com_snowplowanalytics_snowplow_ecommerce_cart_1[0].total_value::decimal(9,2) as cart_total_value | ||
{% endif %} | ||
{% endmacro %} | ||
|
||
{% macro snowflake__get_cart_context_fields() %} | ||
{% if var('snowplow__disable_ecommerce_carts', false) %} | ||
, cast(NULL as {{ type_string() }}) as cart_id | ||
, cast(NULL as {{ type_string() }}) as cart_currency | ||
, cast(NULL as decimal(9,2)) as cart_total_value | ||
{% else %} | ||
, contexts_com_snowplowanalytics_snowplow_ecommerce_cart_1[0]:cartId::varchar as cart_id | ||
, contexts_com_snowplowanalytics_snowplow_ecommerce_cart_1[0]:currency::varchar as cart_currency | ||
, contexts_com_snowplowanalytics_snowplow_ecommerce_cart_1[0]:totalValue::decimal(9,2) as cart_total_value | ||
{% endif %} | ||
{% endmacro %} |
Oops, something went wrong.