Skip to main content

Unified Digital

Upgrading to 0.4.0

If you make use of the conversion module, and don't wish to do a full refresh, you will need to add the new column and update the existing records with the correct values for the model to run successfully incrementally.

ALTER TABLE your_schema_derived.snowplow_unified_conversions add column cv_id TEXT;

UPDATE your_schema_derived.snowplow_unified_conversions set cv_id = md5(cast(coalesce(cast(event_id as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(cv_type as TEXT), '_dbt_utils_surrogate_key_null_') as TEXT))
where 1=1;

Upgrading to 0.3.0

  • snowplow__page_view_passthroughs has been renamed to snowplow__view_passthroughs. Please rename this in your project yaml if you have set any.
  • If you currently use snowplow__allow_refresh without also adding a --full-refresh flag in any script this is now required to ensure the manifest tables are fully refreshed.

Upgrading to 0.2.0

The views table needs to be altered for existing Snowflake, Databricks or Redshift users as the data type of engaged_time_in_s, absolute_time_in_s have changed. Please modify the below script to fit your schemas and apply them before running the upgraded package.

The other option is to do a complete refresh of the package.

Updates to the views table

  • Changed type: engaged_time_in_s, absolute_time_in_s
SQL scripts
create or replace TRANSIENT TABLE (your_schema)_derived.snowplow_unified_views_new cluster by (to_date(start_tstamp))(
VIEW_ID VARCHAR(16777216),
EVENT_NAME VARCHAR(16777216),
EVENT_ID VARCHAR(16777216),
SESSION_IDENTIFIER VARCHAR(16777216),
VIEW_IN_SESSION_INDEX NUMBER(18,0),
VIEWS_IN_SESSION NUMBER(18,0),
SESSION__PREVIOUS_SESSION_ID VARCHAR(36),
USER_ID VARCHAR(16777216),
USER_IDENTIFIER VARCHAR(16777216),
STITCHED_USER_ID VARCHAR(16777216),
NETWORK_USERID VARCHAR(16777216),
DVCE_CREATED_TSTAMP TIMESTAMP_NTZ(9),
COLLECTOR_TSTAMP TIMESTAMP_NTZ(9),
DERIVED_TSTAMP TIMESTAMP_NTZ(9),
START_TSTAMP TIMESTAMP_NTZ(9),
END_TSTAMP TIMESTAMP_NTZ(9),
MODEL_TSTAMP TIMESTAMP_NTZ(9),
APP_ID VARCHAR(16777216),
PLATFORM VARCHAR(16777216),
DEVICE_IDENTIFIER VARCHAR(16777216),
DEVICE_CATEGORY VARCHAR(16777216),
DEVICE_SESSION_INDEX NUMBER(38,0),
OS_VERSION VARCHAR(16777216),
OS_TYPE VARCHAR(16777216),
MOBILE__DEVICE_MANUFACTURER VARCHAR(16777216),
MOBILE__DEVICE_MODEL VARCHAR(16777216),
MOBILE__OS_TYPE VARCHAR(16777216),
MOBILE__OS_VERSION VARCHAR(16777216),
MOBILE__ANDROID_IDFA VARCHAR(16777216),
MOBILE__APPLE_IDFA VARCHAR(16777216),
MOBILE__APPLE_IDFV VARCHAR(16777216),
MOBILE__CARRIER VARCHAR(16777216),
MOBILE__OPEN_IDFA VARCHAR(16777216),
MOBILE__NETWORK_TECHNOLOGY VARCHAR(16777216),
MOBILE__NETWORK_TYPE VARCHAR(255),
MOBILE__PHYSICAL_MEMORY NUMBER(38,0),
MOBILE__SYSTEM_AVAILABLE_MEMORY NUMBER(38,0),
MOBILE__APP_AVAILABLE_MEMORY NUMBER(38,0),
MOBILE__BATTERY_LEVEL NUMBER(38,0),
MOBILE__BATTERY_STATE VARCHAR(16777216),
MOBILE__LOW_POWER_MODE BOOLEAN,
MOBILE__AVAILABLE_STORAGE NUMBER(38,0),
MOBILE__TOTAL_STORAGE NUMBER(38,0),
MOBILE__IS_PORTRAIT BOOLEAN,
MOBILE__RESOLUTION VARCHAR(16777216),
MOBILE__SCALE FLOAT,
MOBILE__LANGUAGE VARCHAR(16777216),
MOBILE__APP_SET_ID VARCHAR(16777216),
MOBILE__APP_SET_ID_SCOPE VARCHAR(16777216),
OS_TIMEZONE VARCHAR(16777216),
SCREEN_RESOLUTION VARCHAR(16777216),
YAUAA__DEVICE_CLASS VARCHAR(16777216),
YAUAA__DEVICE_VERSION VARCHAR(16777216),
YAUAA__OPERATING_SYSTEM_VERSION VARCHAR(16777216),
YAUAA__OPERATING_SYSTEM_CLASS VARCHAR(16777216),
YAUAA__OPERATING_SYSTEM_NAME VARCHAR(16777216),
YAUAA__OPERATING_SYSTEM_NAME_VERSION VARCHAR(16777216),
GEO_COUNTRY VARCHAR(16777216),
GEO_REGION VARCHAR(16777216),
GEO_REGION_NAME VARCHAR(16777216),
GEO_CITY VARCHAR(16777216),
GEO_ZIPCODE VARCHAR(16777216),
GEO_LATITUDE FLOAT,
GEO_LONGITUDE FLOAT,
GEO_TIMEZONE VARCHAR(16777216),
USER_IPADDRESS VARCHAR(16777216),
ENGAGED_TIME_IN_S DOUBLE,
ABSOLUTE_TIME_IN_S DOUBLE,
HORIZONTAL_PIXELS_SCROLLED NUMBER(38,0),
VERTICAL_PIXELS_SCROLLED NUMBER(38,0),
HORIZONTAL_PERCENTAGE_SCROLLED FLOAT,
VERTICAL_PERCENTAGE_SCROLLED FLOAT,
MKT_MEDIUM VARCHAR(16777216),
MKT_SOURCE VARCHAR(16777216),
MKT_TERM VARCHAR(16777216),
MKT_CONTENT VARCHAR(16777216),
MKT_CAMPAIGN VARCHAR(16777216),
MKT_CLICKID VARCHAR(16777216),
MKT_NETWORK VARCHAR(16777216),
DEFAULT_CHANNEL_GROUP VARCHAR(25),
PAGE_URL VARCHAR(16777216),
PAGE_REFERRER VARCHAR(16777216),
REFR_MEDIUM VARCHAR(16777216),
REFR_SOURCE VARCHAR(16777216),
REFR_TERM VARCHAR(16777216),
PAGE_TITLE VARCHAR(16777216),
CONTENT_GROUP VARCHAR(39),
PAGE_URLSCHEME VARCHAR(16777216),
PAGE_URLHOST VARCHAR(16777216),
PAGE_URLPATH VARCHAR(16777216),
PAGE_URLQUERY VARCHAR(16777216),
PAGE_URLFRAGMENT VARCHAR(16777216),
REFR_URLSCHEME VARCHAR(16777216),
REFR_URLHOST VARCHAR(16777216),
REFR_URLPATH VARCHAR(16777216),
REFR_URLQUERY VARCHAR(16777216),
REFR_URLFRAGMENT VARCHAR(16777216),
BR_LANG VARCHAR(16777216),
BR_VIEWWIDTH NUMBER(38,0),
BR_VIEWHEIGHT NUMBER(38,0),
BR_COLORDEPTH VARCHAR(16777216),
BR_RENDERENGINE VARCHAR(16777216),
DOC_WIDTH NUMBER(38,0),
DOC_HEIGHT NUMBER(38,0),
IAB__CATEGORY VARCHAR(16777216),
IAB__PRIMARY_IMPACT VARCHAR(16777216),
IAB__REASON VARCHAR(16777216),
IAB__SPIDER_OR_ROBOT BOOLEAN,
YAUAA__DEVICE_NAME VARCHAR(16777216),
YAUAA__AGENT_CLASS VARCHAR(16777216),
YAUAA__AGENT_NAME VARCHAR(16777216),
YAUAA__AGENT_NAME_VERSION VARCHAR(16777216),
YAUAA__AGENT_NAME_VERSION_MAJOR VARCHAR(16777216),
YAUAA__AGENT_VERSION VARCHAR(16777216),
YAUAA__AGENT_VERSION_MAJOR VARCHAR(16777216),
YAUAA__LAYOUT_ENGINE_CLASS VARCHAR(16777216),
YAUAA__LAYOUT_ENGINE_NAME VARCHAR(16777216),
YAUAA__LAYOUT_ENGINE_NAME_VERSION VARCHAR(16777216),
YAUAA__LAYOUT_ENGINE_NAME_VERSION_MAJOR VARCHAR(16777216),
YAUAA__LAYOUT_ENGINE_VERSION VARCHAR(16777216),
YAUAA__LAYOUT_ENGINE_VERSION_MAJOR VARCHAR(16777216),
UA__DEVICE_FAMILY VARCHAR(16777216),
UA__OS_VERSION VARCHAR(16777216),
UA__OS_MAJOR VARCHAR(16777216),
UA__OS_MINOR VARCHAR(16777216),
UA__OS_PATCH VARCHAR(16777216),
UA__OS_PATCH_MINOR VARCHAR(16777216),
UA__USERAGENT_FAMILY VARCHAR(16777216),
UA__USERAGENT_MAJOR VARCHAR(16777216),
UA__USERAGENT_MINOR VARCHAR(16777216),
UA__USERAGENT_PATCH VARCHAR(16777216),
UA__USERAGENT_VERSION VARCHAR(16777216),
SCREEN_VIEW__NAME VARCHAR(16777216),
SCREEN_VIEW__PREVIOUS_ID VARCHAR(36),
SCREEN_VIEW__PREVIOUS_NAME VARCHAR(16777216),
SCREEN_VIEW__PREVIOUS_TYPE VARCHAR(16777216),
SCREEN_VIEW__TRANSITION_TYPE VARCHAR(16777216),
SCREEN_VIEW__TYPE VARCHAR(16777216),
APP__BUILD VARCHAR(255),
APP__VERSION VARCHAR(255),
GEO__ALTITUDE FLOAT,
GEO__ALTITUDE_ACCURACY FLOAT,
GEO__BEARING FLOAT,
GEO__LATITUDE FLOAT,
GEO__LATITUDE_LONGITUDE_ACCURACY FLOAT,
GEO__LONGITUDE FLOAT,
GEO__SPEED FLOAT,
SCREEN__FRAGMENT VARCHAR(16777216),
SCREEN__TOP_VIEW_CONTROLLER VARCHAR(16777216),
SCREEN__VIEW_CONTROLLER VARCHAR(16777216),
USERAGENT VARCHAR(16777216),
V_COLLECTOR VARCHAR(16777216),
EVENT_ID2 VARCHAR(16777216),
LAST_LIST_ITEM_INDEX NUMBER(38,0),
LIST_ITEMS_COUNT NUMBER(38,0),
LIST_ITEMS_PERCENTAGE_SCROLLED FLOAT
);

insert into (your_schema)_derived.snowplow_unified_views_new select *, NULL AS LAST_LIST_ITEM_INDEX, NULL AS LIST_ITEMS_COUNT, NULL AS LIST_ITEMS_PERCENTAGE_SCROLLED from (your_schema)_derived.snowplow_unified_views;
drop table (your_schema)_derived.snowplow_unified_views;
create table (your_schema)_derived.snowplow_unified_views as select * from (your_schema)_derived.snowplow_unified_views_new;
drop table (your_schema)_derived.snowplow_unified_views_new;