From e2bb39d157fdc96446687f5c2ca5b7a65716c5ea Mon Sep 17 00:00:00 2001 From: Agnes Kiss Date: Wed, 12 Jun 2024 10:16:58 +0100 Subject: [PATCH] Fix Spark field extractions --- .../get_app_context_fields.sql | 4 +- .../get_app_error_event_fields.sql | 18 +++---- .../get_browser_context_fields.sql | 26 +++++----- .../get_cmp_visible_event_fields.sql | 2 +- .../get_consent_event_fields.sql | 14 +++--- .../get_deep_link_context_fields.sql | 4 +- .../get_geo_context_fields.sql | 14 +++--- .../get_iab_context_fields.sql | 8 +-- .../get_mobile_context_fields.sql | 50 +++++++++---------- .../get_screen_context_fields.sql | 14 +++--- .../get_screen_summary_context_fields.sql | 20 ++++---- .../get_screen_view_event_fields.sql | 14 +++--- .../get_session_context_fields.sql | 16 +++--- .../get_ua_context_fields.sql | 24 ++++----- .../get_yauaa_context_fields.sql | 40 +++++++-------- 15 files changed, 134 insertions(+), 134 deletions(-) diff --git a/macros/field_extractions/get_app_context_fields.sql b/macros/field_extractions/get_app_context_fields.sql index 2edf39bb..a57953ab 100644 --- a/macros/field_extractions/get_app_context_fields.sql +++ b/macros/field_extractions/get_app_context_fields.sql @@ -39,8 +39,8 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0 {% macro spark__get_app_context_fields() %} {% if var('snowplow__enable_application_context', false) %} - , contexts_com_snowplowanalytics_mobile_application_1[0].build::STRING AS app__build - , contexts_com_snowplowanalytics_mobile_application_1[0].version::STRING AS app__version + , cast(contexts_com_snowplowanalytics_mobile_application_1[0].build as STRING) AS app__build + , cast(contexts_com_snowplowanalytics_mobile_application_1[0].version as STRING) AS app__version {% else %} , cast(null as {{ dbt.type_string() }}) as app__build , cast(null as {{ dbt.type_string() }}) as app__version diff --git a/macros/field_extractions/get_app_error_event_fields.sql b/macros/field_extractions/get_app_error_event_fields.sql index 044ca966..9d68947b 100644 --- a/macros/field_extractions/get_app_error_event_fields.sql +++ b/macros/field_extractions/get_app_error_event_fields.sql @@ -60,15 +60,15 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0 {% macro spark__get_app_error_event_fields() %} {% if var('snowplow__enable_app_errors', false) %} - , unstruct_event_com_snowplowanalytics_snowplow_application_error_1.message::STRING AS app_error__message - , unstruct_event_com_snowplowanalytics_snowplow_application_error_1.programming_language::STRING AS app_error__programming_language - , unstruct_event_com_snowplowanalytics_snowplow_application_error_1.class_name::STRING AS app_error__class_name - , unstruct_event_com_snowplowanalytics_snowplow_application_error_1.exception_name::STRING AS app_error__exception_name - , unstruct_event_com_snowplowanalytics_snowplow_application_error_1.is_fatal::BOOLEAN AS app_error__is_fatal - , unstruct_event_com_snowplowanalytics_snowplow_application_error_1.line_number::INT AS app_error__line_number - , unstruct_event_com_snowplowanalytics_snowplow_application_error_1.stack_trace::STRING AS app_error__stack_trace - , unstruct_event_com_snowplowanalytics_snowplow_application_error_1.thread_id::INT AS app_error__thread_id - , unstruct_event_com_snowplowanalytics_snowplow_application_error_1.thread_name::STRING AS app_error__thread_name + , cast(unstruct_event_com_snowplowanalytics_snowplow_application_error_1.message as STRING) AS app_error__message + , cast(unstruct_event_com_snowplowanalytics_snowplow_application_error_1.programming_language as STRING) AS app_error__programming_language + , cast(unstruct_event_com_snowplowanalytics_snowplow_application_error_1.class_name as STRING) AS app_error__class_name + , cast(unstruct_event_com_snowplowanalytics_snowplow_application_error_1.exception_name as STRING) AS app_error__exception_name + , cast(unstruct_event_com_snowplowanalytics_snowplow_application_error_1.is_fatal as BOOLEAN) AS app_error__is_fatal + , cast(unstruct_event_com_snowplowanalytics_snowplow_application_error_1.line_number as INT) AS app_error__line_number + , cast(unstruct_event_com_snowplowanalytics_snowplow_application_error_1.stack_trace as STRING) AS app_error__stack_trace + , cast(unstruct_event_com_snowplowanalytics_snowplow_application_error_1.thread_id as INT) AS app_error__thread_id + , cast(unstruct_event_com_snowplowanalytics_snowplow_application_error_1.thread_name as STRING) AS app_error__thread_name {% else %} , cast(null as {{ dbt.type_string() }}) as app_error__message , cast(null as {{ dbt.type_string() }}) as app_error__programming_language diff --git a/macros/field_extractions/get_browser_context_fields.sql b/macros/field_extractions/get_browser_context_fields.sql index f399dc9d..ba4b4fbe 100644 --- a/macros/field_extractions/get_browser_context_fields.sql +++ b/macros/field_extractions/get_browser_context_fields.sql @@ -72,19 +72,19 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0 {% macro spark__get_browser_context_fields() %} {% if var('snowplow__enable_browser_context', false) %} - , contexts_com_snowplowanalytics_snowplow_browser_context_1[0].viewport::STRING AS browser__viewport - , contexts_com_snowplowanalytics_snowplow_browser_context_1[0].document_size::STRING AS browser__document_size - , contexts_com_snowplowanalytics_snowplow_browser_context_1[0].resolution::STRING AS browser__resolution - , contexts_com_snowplowanalytics_snowplow_browser_context_1[0].color_depth::INT AS browser__color_depth - , contexts_com_snowplowanalytics_snowplow_browser_context_1[0].device_pixel_ratio::FLOAT AS browser__device_pixel_ratio - , contexts_com_snowplowanalytics_snowplow_browser_context_1[0].cookies_enabled::BOOLEAN AS browser__cookies_enabled - , contexts_com_snowplowanalytics_snowplow_browser_context_1[0].online::BOOLEAN AS browser__online - , contexts_com_snowplowanalytics_snowplow_browser_context_1[0].browser_language::STRING AS browser__browser_language - , contexts_com_snowplowanalytics_snowplow_browser_context_1[0].document_language::STRING AS browser__document_language - , contexts_com_snowplowanalytics_snowplow_browser_context_1[0].webdriver::BOOLEAN AS browser__webdriver - , contexts_com_snowplowanalytics_snowplow_browser_context_1[0].device_memory::INT AS browser__device_memory - , contexts_com_snowplowanalytics_snowplow_browser_context_1[0].hardware_concurrency::INT AS browser__hardware_concurrency - , contexts_com_snowplowanalytics_snowplow_browser_context_1[0].tab_id::STRING AS browser__tab_id + , cast(contexts_com_snowplowanalytics_snowplow_browser_context_1[0].viewport as STRING) AS browser__viewport + , cast(contexts_com_snowplowanalytics_snowplow_browser_context_1[0].document_size as STRING) AS browser__document_size + , cast(contexts_com_snowplowanalytics_snowplow_browser_context_1[0].resolution as STRING) AS browser__resolution + , cast(contexts_com_snowplowanalytics_snowplow_browser_context_1[0].color_depth as INT) AS browser__color_depth + , cast(contexts_com_snowplowanalytics_snowplow_browser_context_1[0].device_pixel_ratio as FLOAT) AS browser__device_pixel_ratio + , cast(contexts_com_snowplowanalytics_snowplow_browser_context_1[0].cookies_enabled as BOOLEAN) AS browser__cookies_enabled + , cast(contexts_com_snowplowanalytics_snowplow_browser_context_1[0].online as BOOLEAN) AS browser__online + , cast(contexts_com_snowplowanalytics_snowplow_browser_context_1[0].browser_language as STRING) AS browser__browser_language + , cast(contexts_com_snowplowanalytics_snowplow_browser_context_1[0].document_language as STRING) AS browser__document_language + , cast(contexts_com_snowplowanalytics_snowplow_browser_context_1[0].webdriver as BOOLEAN) AS browser__webdriver + , cast(contexts_com_snowplowanalytics_snowplow_browser_context_1[0].device_memory as INT) AS browser__device_memory + , cast(contexts_com_snowplowanalytics_snowplow_browser_context_1[0].hardware_concurrency as INT) AS browser__hardware_concurrency + , cast(contexts_com_snowplowanalytics_snowplow_browser_context_1[0].tab_id as STRING) AS browser__tab_id {% else %} , cast(null as {{ dbt.type_string() }}) as browser__viewport , cast(null as {{ dbt.type_string() }}) as browser__document_size diff --git a/macros/field_extractions/get_cmp_visible_event_fields.sql b/macros/field_extractions/get_cmp_visible_event_fields.sql index 11a2d083..f565bd4a 100644 --- a/macros/field_extractions/get_cmp_visible_event_fields.sql +++ b/macros/field_extractions/get_cmp_visible_event_fields.sql @@ -36,7 +36,7 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0 {% macro spark__get_cmp_visible_event_fields() %} {% if var('snowplow__enable_consent', false) %} - , unstruct_event_com_snowplowanalytics_snowplow_cmp_visible_1.elapsed_time::float as cmp__elapsed_time + , cast(unstruct_event_com_snowplowanalytics_snowplow_cmp_visible_1.elapsed_time as float) as cmp__elapsed_time {% else %} , cast(null as {{ dbt.type_float() }}) as cmp__elapsed_time diff --git a/macros/field_extractions/get_consent_event_fields.sql b/macros/field_extractions/get_consent_event_fields.sql index e2f71bf7..d41c7dc5 100644 --- a/macros/field_extractions/get_consent_event_fields.sql +++ b/macros/field_extractions/get_consent_event_fields.sql @@ -54,13 +54,13 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0 {% macro spark__get_consent_event_fields() %} {% if var('snowplow__enable_consent', false) %} - , unstruct_event_com_snowplowanalytics_snowplow_consent_preferences_1.event_type::STRING as consent__event_type - , unstruct_event_com_snowplowanalytics_snowplow_consent_preferences_1.basis_for_processing::STRING as consent__basis_for_processing - , unstruct_event_com_snowplowanalytics_snowplow_consent_preferences_1.consent_url::STRING as consent__consent_url - , unstruct_event_com_snowplowanalytics_snowplow_consent_preferences_1.consent_version::STRING as consent__consent_version - , unstruct_event_com_snowplowanalytics_snowplow_consent_preferences_1.consent_scopes::ARRAY as consent__consent_scopes - , unstruct_event_com_snowplowanalytics_snowplow_consent_preferences_1.domains_applied::ARRAY as consent__domains_applied - , unstruct_event_com_snowplowanalytics_snowplow_consent_preferences_1.gdpr_applies::boolean as consent__gdpr_applies + , cast(unstruct_event_com_snowplowanalytics_snowplow_consent_preferences_1.event_type as STRING) as consent__event_type + , cast(unstruct_event_com_snowplowanalytics_snowplow_consent_preferences_1.basis_for_processing as STRING) as consent__basis_for_processing + , cast(unstruct_event_com_snowplowanalytics_snowplow_consent_preferences_1.consent_url as STRING) as consent__consent_url + , cast(unstruct_event_com_snowplowanalytics_snowplow_consent_preferences_1.consent_version as STRING) as consent__consent_version + , cast(unstruct_event_com_snowplowanalytics_snowplow_consent_preferences_1.consent_scopes as ARRAY) as consent__consent_scopes + , cast(unstruct_event_com_snowplowanalytics_snowplow_consent_preferences_1.domains_applied as ARRAY) as consent__domains_applied + , cast(unstruct_event_com_snowplowanalytics_snowplow_consent_preferences_1.gdpr_applies as boolean) as consent__gdpr_applies {% else %} , cast(null as {{ dbt.type_string() }}) as consent__event_type , cast(null as {{ dbt.type_string() }}) as consent__basis_for_processing diff --git a/macros/field_extractions/get_deep_link_context_fields.sql b/macros/field_extractions/get_deep_link_context_fields.sql index a2692ed5..c7b7b7a6 100644 --- a/macros/field_extractions/get_deep_link_context_fields.sql +++ b/macros/field_extractions/get_deep_link_context_fields.sql @@ -39,8 +39,8 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0 {% macro spark__get_deep_link_context_fields() %} {% if var('snowplow__enable_deep_link_context', false) %} - , contexts_com_snowplowanalytics_mobile_deep_link_1[0].url::STRING AS deep_link__url - , contexts_com_snowplowanalytics_mobile_deep_link_1[0].referrer::STRING AS deep_link__referrer + , cast(contexts_com_snowplowanalytics_mobile_deep_link_1[0].url as STRING) AS deep_link__url + , cast(contexts_com_snowplowanalytics_mobile_deep_link_1[0].referrer as STRING) AS deep_link__referrer {% else %} , cast(null as {{ dbt.type_string() }}) as deep_link__url diff --git a/macros/field_extractions/get_geo_context_fields.sql b/macros/field_extractions/get_geo_context_fields.sql index 74ba4e28..90903ddb 100644 --- a/macros/field_extractions/get_geo_context_fields.sql +++ b/macros/field_extractions/get_geo_context_fields.sql @@ -54,13 +54,13 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0 {% macro spark__get_geo_context_fields() %} {% if var('snowplow__enable_geolocation_context', false) %} - , contexts_com_snowplowanalytics_snowplow_geolocation_context_1[0].latitude::double AS geo__latitude - , contexts_com_snowplowanalytics_snowplow_geolocation_context_1[0].longitude::double AS geo__longitude - , contexts_com_snowplowanalytics_snowplow_geolocation_context_1[0].latitude_longitude_accuracy::double AS geo__latitude_longitude_accuracy - , contexts_com_snowplowanalytics_snowplow_geolocation_context_1[0].altitude::double AS geo__altitude - , contexts_com_snowplowanalytics_snowplow_geolocation_context_1[0].altitude_accuracy::double AS geo__altitude_accuracy - , contexts_com_snowplowanalytics_snowplow_geolocation_context_1[0].bearing::double AS geo__bearing - , contexts_com_snowplowanalytics_snowplow_geolocation_context_1[0].speed::double AS geo__speed + , cast(contexts_com_snowplowanalytics_snowplow_geolocation_context_1[0].latitude as double) AS geo__latitude + , cast(contexts_com_snowplowanalytics_snowplow_geolocation_context_1[0].longitude as double) AS geo__longitude + , cast(contexts_com_snowplowanalytics_snowplow_geolocation_context_1[0].latitude_longitude_accuracy as double) AS geo__latitude_longitude_accuracy + , cast(contexts_com_snowplowanalytics_snowplow_geolocation_context_1[0].altitude as double) AS geo__altitude + , cast(contexts_com_snowplowanalytics_snowplow_geolocation_context_1[0].altitude_accuracy as double) AS geo__altitude_accuracy + , cast(contexts_com_snowplowanalytics_snowplow_geolocation_context_1[0].bearing as double) AS geo__bearing + , cast(contexts_com_snowplowanalytics_snowplow_geolocation_context_1[0].speed as double) AS geo__speed {% else %} , cast(null as double) as geo__latitude , cast(null as double) as geo__longitude diff --git a/macros/field_extractions/get_iab_context_fields.sql b/macros/field_extractions/get_iab_context_fields.sql index f169e9e6..8df97b7c 100644 --- a/macros/field_extractions/get_iab_context_fields.sql +++ b/macros/field_extractions/get_iab_context_fields.sql @@ -45,10 +45,10 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0 {% macro spark__get_iab_context_fields() %} {%- if var('snowplow__enable_iab', false) -%} - , contexts_com_iab_snowplow_spiders_and_robots_1[0].category::STRING as iab__category - , contexts_com_iab_snowplow_spiders_and_robots_1[0].primary_impact::STRING as iab__primary_impact - , contexts_com_iab_snowplow_spiders_and_robots_1[0].reason::STRING as iab__reason - , contexts_com_iab_snowplow_spiders_and_robots_1[0].spider_or_robot::BOOLEAN as iab__spider_or_robot + , cast(contexts_com_iab_snowplow_spiders_and_robots_1[0].category as STRING) as iab__category + , cast(contexts_com_iab_snowplow_spiders_and_robots_1[0].primary_impact as STRING) as iab__primary_impact + , cast(contexts_com_iab_snowplow_spiders_and_robots_1[0].reason as STRING) as iab__reason + , cast(contexts_com_iab_snowplow_spiders_and_robots_1[0].spider_or_robot as BOOLEAN) as iab__spider_or_robot {%- else -%} , cast(null as {{ dbt.type_string() }}) as iab__category , cast(null as {{ dbt.type_string() }}) as iab__primary_impact diff --git a/macros/field_extractions/get_mobile_context_fields.sql b/macros/field_extractions/get_mobile_context_fields.sql index 8ae8ac3c..d25e6361 100644 --- a/macros/field_extractions/get_mobile_context_fields.sql +++ b/macros/field_extractions/get_mobile_context_fields.sql @@ -108,31 +108,31 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0 {% macro spark__get_mobile_context_fields() %} {% if var('snowplow__enable_mobile_context', false) %} - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.device_manufacturer')::STRING AS mobile__device_manufacturer - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.device_model')::STRING AS mobile__device_model - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.os_type')::STRING AS mobile__os_type - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.os_version')::STRING AS mobile__os_version - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.android_idfa')::STRING AS mobile__android_idfa - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.apple_idfa')::STRING AS mobile__apple_idfa - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.apple_idfv')::STRING AS mobile__apple_idfv - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.carrier')::STRING AS mobile__carrier - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.open_idfa')::STRING AS mobile__open_idfa - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.network_technology')::STRING AS mobile__network_technology - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.network_type')::STRING AS mobile__network_type - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.physical_memory')::INT AS mobile__physical_memory - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.system_available_memory')::INT AS mobile__system_available_memory - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.app_available_memory')::INT AS mobile__app_available_memory - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.battery_level')::INT AS mobile__battery_level - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.battery_state')::STRING AS mobile__battery_state - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.low_power_mode')::BOOLEAN AS mobile__low_power_mode - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.available_storage')::BIGINT AS mobile__available_storage - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.total_storage')::BIGINT AS mobile__total_storage - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.is_portrait')::BOOLEAN AS mobile__is_portrait - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.resolution')::STRING AS mobile__resolution - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.scale')::FLOAT AS mobile__scale - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.language')::STRING AS mobile__language - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.app_set_id')::STRING AS mobile__app_set_id - , get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.app_set_id_scope')::STRING AS mobile__app_set_id_scope + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.device_manufacturer') AS STRING) AS mobile__device_manufacturer + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.device_model') AS STRING) AS mobile__device_model + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.os_type') AS STRING) AS mobile__os_type + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.os_version') AS STRING) AS mobile__os_version + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.android_idfa') AS STRING) AS mobile__android_idfa + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.apple_idfa') AS STRING) AS mobile__apple_idfa + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.apple_idfv') AS STRING) AS mobile__apple_idfv + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.carrier') AS STRING) AS mobile__carrier + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.open_idfa') AS STRING) AS mobile__open_idfa + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.network_technology') AS STRING) AS mobile__network_technology + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.network_type') AS STRING) AS mobile__network_type + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.physical_memory') AS INT) AS mobile__physical_memory + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.system_available_memory') AS INT) AS mobile__system_available_memory + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.app_available_memory') AS INT) AS mobile__app_available_memory + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.battery_level') AS INT) AS mobile__battery_level + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.battery_state') AS STRING) AS mobile__battery_state + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.low_power_mode') AS BOOLEAN) AS mobile__low_power_mode + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.available_storage') AS BIGINT) AS mobile__available_storage + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.total_storage') AS BIGINT) AS mobile__total_storage + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.is_portrait') AS BOOLEAN) AS mobile__is_portrait + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.resolution') AS STRING) AS mobile__resolution + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.scale') AS FLOAT) AS mobile__scale + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.language') AS STRING) AS mobile__language + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.app_set_id') AS STRING) AS mobile__app_set_id + , cast(get_json_object(to_json(contexts_com_snowplowanalytics_snowplow_mobile_context_1[0])::String,'$.app_set_id_scope') AS STRING) AS mobile__app_set_id_scope {% else %} , cast(null as {{ dbt.type_string() }}) as mobile__device_manufacturer , cast(null as {{ dbt.type_string() }}) as mobile__device_model diff --git a/macros/field_extractions/get_screen_context_fields.sql b/macros/field_extractions/get_screen_context_fields.sql index d94055bf..df3f0993 100644 --- a/macros/field_extractions/get_screen_context_fields.sql +++ b/macros/field_extractions/get_screen_context_fields.sql @@ -54,13 +54,13 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0 {% macro spark__get_screen_context_fields() %} {% if var('snowplow__enable_screen_context', false) %} - , contexts_com_snowplowanalytics_mobile_screen_1[0].id::STRING AS screen__id - , contexts_com_snowplowanalytics_mobile_screen_1[0].name::STRING AS screen__name - , contexts_com_snowplowanalytics_mobile_screen_1[0].activity::STRING AS screen__activity - , contexts_com_snowplowanalytics_mobile_screen_1[0].fragment::STRING AS screen__fragment - , contexts_com_snowplowanalytics_mobile_screen_1[0].top_view_controller::STRING AS screen__top_view_controller - , contexts_com_snowplowanalytics_mobile_screen_1[0].type::STRING AS screen__type - , contexts_com_snowplowanalytics_mobile_screen_1[0].view_controller::STRING AS screen__view_controller + , cast(contexts_com_snowplowanalytics_mobile_screen_1[0].id as STRING) AS screen__id + , cast(contexts_com_snowplowanalytics_mobile_screen_1[0].name as STRING) AS screen__name + , cast(contexts_com_snowplowanalytics_mobile_screen_1[0].activity as STRING) AS screen__activity + , cast(contexts_com_snowplowanalytics_mobile_screen_1[0].fragment as STRING) AS screen__fragment + , cast(contexts_com_snowplowanalytics_mobile_screen_1[0].top_view_controller as STRING) AS screen__top_view_controller + , cast(contexts_com_snowplowanalytics_mobile_screen_1[0].type as STRING) AS screen__type + , cast(contexts_com_snowplowanalytics_mobile_screen_1[0].view_controller as STRING) AS screen__view_controller {% else %} , cast(null as {{ dbt.type_string() }}) as screen__id , cast(null as {{ dbt.type_string() }}) as screen__name diff --git a/macros/field_extractions/get_screen_summary_context_fields.sql b/macros/field_extractions/get_screen_summary_context_fields.sql index be1734da..6695dd10 100644 --- a/macros/field_extractions/get_screen_summary_context_fields.sql +++ b/macros/field_extractions/get_screen_summary_context_fields.sql @@ -63,16 +63,16 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0 {% macro spark__get_screen_summary_context_fields() %} {% if var('snowplow__enable_screen_summary_context', false) %} - , contexts_com_snowplowanalytics_mobile_screen_summary_1[0].foreground_sec::FLOAT AS screen_summary__foreground_sec - , contexts_com_snowplowanalytics_mobile_screen_summary_1[0].background_sec::FLOAT AS screen_summary__background_sec - , contexts_com_snowplowanalytics_mobile_screen_summary_1[0].last_item_index::INT AS screen_summary__last_item_index - , contexts_com_snowplowanalytics_mobile_screen_summary_1[0].items_count::INT AS screen_summary__items_count - , contexts_com_snowplowanalytics_mobile_screen_summary_1[0].min_x_offset::INT AS screen_summary__min_x_offset - , contexts_com_snowplowanalytics_mobile_screen_summary_1[0].min_y_offset::INT AS screen_summary__min_y_offset - , contexts_com_snowplowanalytics_mobile_screen_summary_1[0].max_x_offset::INT AS screen_summary__max_x_offset - , contexts_com_snowplowanalytics_mobile_screen_summary_1[0].max_y_offset::INT AS screen_summary__max_y_offset - , contexts_com_snowplowanalytics_mobile_screen_summary_1[0].content_width::INT AS screen_summary__content_width - , contexts_com_snowplowanalytics_mobile_screen_summary_1[0].content_height::INT AS screen_summary__content_height + , cast(contexts_com_snowplowanalytics_mobile_screen_summary_1[0].foreground_sec as FLOAT) AS screen_summary__foreground_sec + , cast(contexts_com_snowplowanalytics_mobile_screen_summary_1[0].background_sec as FLOAT) AS screen_summary__background_sec + , cast(contexts_com_snowplowanalytics_mobile_screen_summary_1[0].last_item_index as INT) AS screen_summary__last_item_index + , cast(contexts_com_snowplowanalytics_mobile_screen_summary_1[0].items_count as INT) AS screen_summary__items_count + , cast(contexts_com_snowplowanalytics_mobile_screen_summary_1[0].min_x_offset as INT) AS screen_summary__min_x_offset + , cast(contexts_com_snowplowanalytics_mobile_screen_summary_1[0].min_y_offset as INT) AS screen_summary__min_y_offset + , cast(contexts_com_snowplowanalytics_mobile_screen_summary_1[0].max_x_offset as INT) AS screen_summary__max_x_offset + , cast(contexts_com_snowplowanalytics_mobile_screen_summary_1[0].max_y_offset as INT) AS screen_summary__max_y_offset + , cast(contexts_com_snowplowanalytics_mobile_screen_summary_1[0].content_width as INT) AS screen_summary__content_width + , cast(contexts_com_snowplowanalytics_mobile_screen_summary_1[0].content_height as INT) AS screen_summary__content_height {% else %} , cast(null as {{ dbt.type_float() }}) as screen_summary__foreground_sec , cast(null as {{ dbt.type_float() }}) as screen_summary__background_sec diff --git a/macros/field_extractions/get_screen_view_event_fields.sql b/macros/field_extractions/get_screen_view_event_fields.sql index cd95b6c1..153c2be9 100644 --- a/macros/field_extractions/get_screen_view_event_fields.sql +++ b/macros/field_extractions/get_screen_view_event_fields.sql @@ -54,13 +54,13 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0 {% macro spark__get_screen_view_event_fields() %} {% if var('snowplow__enable_mobile', false) %} - , unstruct_event_com_snowplowanalytics_mobile_screen_view_1.id::STRING AS screen_view__id - , unstruct_event_com_snowplowanalytics_mobile_screen_view_1.name::STRING AS screen_view__name - , unstruct_event_com_snowplowanalytics_mobile_screen_view_1.previous_id::STRING AS screen_view__previous_id - , unstruct_event_com_snowplowanalytics_mobile_screen_view_1.previous_name::STRING AS screen_view__previous_name - , unstruct_event_com_snowplowanalytics_mobile_screen_view_1.previous_type::STRING AS screen_view__previous_type - , unstruct_event_com_snowplowanalytics_mobile_screen_view_1.transition_type::STRING AS screen_view__transition_type - , unstruct_event_com_snowplowanalytics_mobile_screen_view_1.type::STRING AS screen_view__type + , cast(unstruct_event_com_snowplowanalytics_mobile_screen_view_1.id as STRING) AS screen_view__id + , cast(unstruct_event_com_snowplowanalytics_mobile_screen_view_1.name as STRING) AS screen_view__name + , cast(unstruct_event_com_snowplowanalytics_mobile_screen_view_1.previous_id as STRING) AS screen_view__previous_id + , cast(unstruct_event_com_snowplowanalytics_mobile_screen_view_1.previous_name as STRING) AS screen_view__previous_name + , cast(unstruct_event_com_snowplowanalytics_mobile_screen_view_1.previous_type as STRING) AS screen_view__previous_type + , cast(unstruct_event_com_snowplowanalytics_mobile_screen_view_1.transition_type as STRING) AS screen_view__transition_type + , cast(unstruct_event_com_snowplowanalytics_mobile_screen_view_1.type as STRING) AS screen_view__type {% else %} , cast(null as {{ dbt.type_string() }}) as screen_view__id , cast(null as {{ dbt.type_string() }}) as screen_view__name diff --git a/macros/field_extractions/get_session_context_fields.sql b/macros/field_extractions/get_session_context_fields.sql index fe192b49..56e57fb8 100644 --- a/macros/field_extractions/get_session_context_fields.sql +++ b/macros/field_extractions/get_session_context_fields.sql @@ -54,14 +54,14 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0 {% macro spark__get_session_context_fields() %} {% if var('snowplow__enable_mobile', false) %} - , contexts_com_snowplowanalytics_snowplow_client_session_1[0].session_id::STRING AS session__session_id - , contexts_com_snowplowanalytics_snowplow_client_session_1[0].session_index::INT AS session__session_index - , contexts_com_snowplowanalytics_snowplow_client_session_1[0].previous_session_id::STRING AS session__previous_session_id - , contexts_com_snowplowanalytics_snowplow_client_session_1[0].user_id::STRING AS session__user_id - , contexts_com_snowplowanalytics_snowplow_client_session_1[0].first_event_id::STRING AS session__first_event_id - , contexts_com_snowplowanalytics_snowplow_client_session_1[0].event_index::INT AS session__event_index - , contexts_com_snowplowanalytics_snowplow_client_session_1[0].storage_mechanism::STRING AS session__storage_mechanism - , contexts_com_snowplowanalytics_snowplow_client_session_1[0].first_event_timestamp::STRING AS session__first_event_timestamp + , cast(contexts_com_snowplowanalytics_snowplow_client_session_1[0].session_id as STRING) AS session__session_id + , cast(contexts_com_snowplowanalytics_snowplow_client_session_1[0].session_index as INT) AS session__session_index + , cast(contexts_com_snowplowanalytics_snowplow_client_session_1[0].previous_session_id as STRING) AS session__previous_session_id + , cast(contexts_com_snowplowanalytics_snowplow_client_session_1[0].user_id as STRING) AS session__user_id + , cast(contexts_com_snowplowanalytics_snowplow_client_session_1[0].first_event_id as STRING) AS session__first_event_id + , cast(contexts_com_snowplowanalytics_snowplow_client_session_1[0].event_index as INT) AS session__event_index + , cast(contexts_com_snowplowanalytics_snowplow_client_session_1[0].storage_mechanism as STRING) AS session__storage_mechanism + , cast(contexts_com_snowplowanalytics_snowplow_client_session_1[0].first_event_timestamp as STRING) AS session__first_event_timestamp {% else %} , cast(null as {{ dbt.type_string() }}) as session__session_id , cast(null as {{ dbt.type_numeric() }}) as session__session_index diff --git a/macros/field_extractions/get_ua_context_fields.sql b/macros/field_extractions/get_ua_context_fields.sql index 71a0f11e..53f54146 100644 --- a/macros/field_extractions/get_ua_context_fields.sql +++ b/macros/field_extractions/get_ua_context_fields.sql @@ -70,18 +70,18 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0 {% macro spark__get_ua_context_fields() %} {%- if var('snowplow__enable_ua', false) -%} - , contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].useragent_family::STRING as ua__useragent_family - , contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].useragent_major::STRING as ua__useragent_major - , contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].useragent_minor::STRING as ua__useragent_minor - , contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].useragent_patch::STRING as ua__useragent_patch - , contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].useragent_version::STRING as ua__useragent_version - , contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].os_family::STRING as ua__os_family - , contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].os_major::STRING as ua__os_major - , contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].os_minor::STRING as ua__os_minor - , contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].os_patch::STRING as ua__os_patch - , contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].os_patch_minor::STRING as ua__os_patch_minor - , contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].os_version::STRING as ua__os_version - , contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].device_family::STRING as ua__device_family + , cast(contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].useragent_family as STRING) as ua__useragent_family + , cast(contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].useragent_major as STRING) as ua__useragent_major + , cast(contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].useragent_minor as STRING) as ua__useragent_minor + , cast(contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].useragent_patch as STRING) as ua__useragent_patch + , cast(contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].useragent_version as STRING) as ua__useragent_version + , cast(contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].os_family as STRING) as ua__os_family + , cast(contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].os_major as STRING) as ua__os_major + , cast(contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].os_minor as STRING) as ua__os_minor + , cast(contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].os_patch as STRING) as ua__os_patch + , cast(contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].os_patch_minor as STRING) as ua__os_patch_minor + , cast(contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].os_version as STRING) as ua__os_version + , cast(contexts_com_snowplowanalytics_snowplow_ua_parser_context_1[0].device_family as STRING) as ua__device_family {%- else -%} , cast(null as {{ dbt.type_string() }}) as ua__useragent_family , cast(null as {{ dbt.type_string() }}) as ua__useragent_major diff --git a/macros/field_extractions/get_yauaa_context_fields.sql b/macros/field_extractions/get_yauaa_context_fields.sql index c99ea258..6137a07f 100644 --- a/macros/field_extractions/get_yauaa_context_fields.sql +++ b/macros/field_extractions/get_yauaa_context_fields.sql @@ -93,26 +93,26 @@ You may obtain a copy of the Snowplow Personal and Academic License Version 1.0 {% macro spark__get_yauaa_context_fields() %} {%- if var('snowplow__enable_yauaa', false) -%} - , contexts_nl_basjes_yauaa_context_1[0].device_class::STRING as yauaa__device_class - , contexts_nl_basjes_yauaa_context_1[0].agent_class::STRING as yauaa__agent_class - , contexts_nl_basjes_yauaa_context_1[0].agent_name::STRING as yauaa__agent_name - , contexts_nl_basjes_yauaa_context_1[0].agent_name_version::STRING as yauaa__agent_name_version - , contexts_nl_basjes_yauaa_context_1[0].agent_name_version_major::STRING as yauaa__agent_name_version_major - , contexts_nl_basjes_yauaa_context_1[0].agent_version::STRING as yauaa__agent_version - , contexts_nl_basjes_yauaa_context_1[0].agent_version_major::STRING as yauaa__agent_version_major - , contexts_nl_basjes_yauaa_context_1[0].device_brand::STRING as yauaa__device_brand - , contexts_nl_basjes_yauaa_context_1[0].device_name::STRING as yauaa__device_name - , contexts_nl_basjes_yauaa_context_1[0].device_version::STRING as yauaa__device_version - , contexts_nl_basjes_yauaa_context_1[0].layout_engine_class::STRING as yauaa__layout_engine_class - , contexts_nl_basjes_yauaa_context_1[0].layout_engine_name::STRING as yauaa__layout_engine_name - , contexts_nl_basjes_yauaa_context_1[0].layout_engine_name_version::STRING as yauaa__layout_engine_name_version - , contexts_nl_basjes_yauaa_context_1[0].layout_engine_name_version_major::STRING as yauaa__layout_engine_name_version_major - , contexts_nl_basjes_yauaa_context_1[0].layout_engine_version::STRING as yauaa__layout_engine_version - , contexts_nl_basjes_yauaa_context_1[0].layout_engine_version_major::STRING as yauaa__layout_engine_version_major - , contexts_nl_basjes_yauaa_context_1[0].operating_system_class::STRING as yauaa__operating_system_class - , contexts_nl_basjes_yauaa_context_1[0].operating_system_name::STRING as yauaa__operating_system_name - , contexts_nl_basjes_yauaa_context_1[0].operating_system_name_version::STRING as yauaa__operating_system_name_version - , contexts_nl_basjes_yauaa_context_1[0].operating_system_version::STRING as yauaa__operating_system_version + , cast(contexts_nl_basjes_yauaa_context_1[0].device_class as STRING) as yauaa__device_class + , cast(contexts_nl_basjes_yauaa_context_1[0].agent_class as STRING) as yauaa__agent_class + , cast(contexts_nl_basjes_yauaa_context_1[0].agent_name as STRING) as yauaa__agent_name + , cast(contexts_nl_basjes_yauaa_context_1[0].agent_name_version as STRING) as yauaa__agent_name_version + , cast(contexts_nl_basjes_yauaa_context_1[0].agent_name_version_major as STRING) as yauaa__agent_name_version_major + , cast(contexts_nl_basjes_yauaa_context_1[0].agent_version as STRING) as yauaa__agent_version + , cast(contexts_nl_basjes_yauaa_context_1[0].agent_version_major as STRING) as yauaa__agent_version_major + , cast(contexts_nl_basjes_yauaa_context_1[0].device_brand as STRING) as yauaa__device_brand + , cast(contexts_nl_basjes_yauaa_context_1[0].device_name as STRING) as yauaa__device_name + , cast(contexts_nl_basjes_yauaa_context_1[0].device_version as STRING) as yauaa__device_version + , cast(contexts_nl_basjes_yauaa_context_1[0].layout_engine_class as STRING) as yauaa__layout_engine_class + , cast(contexts_nl_basjes_yauaa_context_1[0].layout_engine_name as STRING) as yauaa__layout_engine_name + , cast(contexts_nl_basjes_yauaa_context_1[0].layout_engine_name_version as STRING) as yauaa__layout_engine_name_version + , cast(contexts_nl_basjes_yauaa_context_1[0].layout_engine_name_version_major as STRING) as yauaa__layout_engine_name_version_major + , cast(contexts_nl_basjes_yauaa_context_1[0].layout_engine_version as STRING) as yauaa__layout_engine_version + , cast(contexts_nl_basjes_yauaa_context_1[0].layout_engine_version_major as STRING) as yauaa__layout_engine_version_major + , cast(contexts_nl_basjes_yauaa_context_1[0].operating_system_class as STRING) as yauaa__operating_system_class + , cast(contexts_nl_basjes_yauaa_context_1[0].operating_system_name as STRING) as yauaa__operating_system_name + , cast(contexts_nl_basjes_yauaa_context_1[0].operating_system_name_version as STRING) as yauaa__operating_system_name_version + , cast(contexts_nl_basjes_yauaa_context_1[0].operating_system_version as STRING) as yauaa__operating_system_version {%- else -%} , cast(null as {{ dbt.type_string() }}) as yauaa__device_class , cast(null as {{ dbt.type_string() }}) as yauaa__agent_class