From c886b6cb941f8cdb631fb6ea19b33b73fd6a1456 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Fri, 29 May 2020 15:18:08 -0400 Subject: [PATCH] docs on docs on docs --- models/src_marketo.yml | 554 +++++++++++++++++- models/stg_marketo.yml | 480 ++++++++++++++- ...tg_marketo__activity_change_data_value.sql | 11 +- models/stg_marketo__activity_click_email.sql | 14 +- .../stg_marketo__activity_email_bounced.sql | 15 +- .../stg_marketo__activity_email_delivered.sql | 9 +- models/stg_marketo__activity_open_email.sql | 13 +- models/stg_marketo__activity_send_email.sql | 9 +- ...tg_marketo__activity_unsubscribe_email.sql | 16 +- models/stg_marketo__campaigns.sql | 3 +- .../stg_marketo__email_template_history.sql | 26 +- models/stg_marketo__lead.sql | 4 +- models/stg_marketo__lead_describe.sql | 8 +- 13 files changed, 1136 insertions(+), 26 deletions(-) diff --git a/models/src_marketo.yml b/models/src_marketo.yml index af4fefc..efc3aa3 100644 --- a/models/src_marketo.yml +++ b/models/src_marketo.yml @@ -7,15 +7,565 @@ sources: tables: - name: lead + description: Table with all Marketo leads. + columns: + - name: id + description: Unique integer id of a lead record. + + - name: updated_at + description: The timestamp each lead object was last updated at. + - name: lead_describe + description: Table with metadata about lead object columns + columns: + - name: data_type + description: Datatype of the field. + + - name: display_name + description: UI display-name of the field. + + - name: id + description: Unique integer id of the field. + + - name: length + description: Max length of the field. Only applicable to text, string, and text area. + + - name: restname + description: Description of REST API usage attributes. + + - name: restread_only + description: Whether the field is only available via the REST API. + + - name: soapname + description: Description of SOAP API usage attributes. + + - name: soapread_only + description: Whether the field is only available via the SOAP API. + - name: activity_change_data_value + description: Table with data value changes from the leads object. + columns: + - name: api_method_name + description: API method used for change, if applicable. + + - name: activity_date + description: Timestamp of the actvity. + + - name: activity_type_id + description: ID of the activity type. + + - name: campaign_id + description: The ID of the related campaign, if applicable. + + - name: id + description: ID of the activity. + + - name: lead_id + description: Id of the lead associated to the activity. + + - name: modifying_user + description: The user who instigated the change, if applicable. + + - name: new_value + description: New value after the change. + + - name: old_value + description: Old value before the change. + + - name: primary_attribute_value + description: Value of the primary attribute. + + - name: primary_attribute_value_id + description: ID of the primary attribute field. + + - name: reason + description: Reason for the data change. + + - name: request_id + description: ID of the request made. + - name: campaign + description: Table with all Marketo campaigns. + columns: + - name: active + description: Whether the campaign is active. Only applicable to trigger campaigns. + + - name: created_at + description: Timestamp when the campaign was created. + + - name: description + description: Description of the campaign + + - name: id + description: Unique integer ID of the campaign. + + - name: name + description: Name of the campaign. + + - name: program_id + description: ID of the parent program, if applicable. + + - name: program_name + description: Name of the parent program, if applicable. + + - name: type + description: Type of campaign, either 'batch' or 'trigger'. + + - name: updated_at + description: Timestamp when the campaign was most recently updated. + + - name: workspace_name + description: Name of the parent workspace, if applicable. + - name: program + description: Table with all Marketo programs. + columns: + - name: channel + description: Channel of the program. + + - name: created_at + description: Timestamp the program was created at + + - name: description + description: Description of the program. + + - name: end_date + description: End date of the program. Applicable to event, email, and webinar type programs. + + - name: id + description: ID of the program. + + - name: name + description: Name of the program. + + - name: sfdc_id + description: SFDC id of the program if linked to an SFDC campaign. + + - name: sfdc_name + description: Name of the linked SFDC campaign if applicable. + + - name: start_date + description: Start date of program. Applicable to event, email and webinar type programs. + + - name: status + description: | + Status of the program. Only valid for Email and engagement program types. + Allowed values: locked, unlocked, on, off + + - name: type + description: | + Type of the program. Allowed values: program, event, webinar, nurture + + - name: updated_at + description: Timestamp the program was most recently updated. + + - name: url + description: URL of the program in the Marketo UI. + + - name: workspace + description: Name of the workspace. + - name: email_template_history + description: Table with a history of email template versions. + columns: + - name: created_at + description: Timestamp the email template was created. + + - name: description + description: Description of the email template. + + - name: folder_folder_name + description: The name of the email template's folder. + + - name: folder_id + description: The ID of the email template's folder. + + - name: folder_type + description: The type of the email template's folder. + + - name: folder_value + description: The value of the email template's folder. + + - name: from_email + description: The 'From' address of the email. + + - name: from_name + description: The 'From' name of the email. + + - name: id + description: ID of the email template + + - name: name + description: Name of the email template. + + - name: operational + description: Whether the email is operational. Operational emails bypass unsubscribe status. Defaults to false. + + - name: program_id + description: The ID of the email template's program. + + - name: publish_to_msi + description: Whether the email is published to Marketo Sales Insight. + + - name: reply_email + description: Reply-To address of the Email. + + - name: status + description: Status filter for draft or approved versions. + + - name: subject + description: Subject line of the email. + + - name: template + description: ID of the parent template. + + - name: text_only + description: Setting to include text-only version of email when sent. + + - name: updated_at + description: Timestamp the email template was last updated. + + - name: url + description: URL of the email template in the Marketo UI. + + - name: version + description: The type version of the email, either '1' or '2'. + + - name: web_view + description: Whether 'View as Webpage' function is enabled for the email. + + - name: workspace + description: Name of the workspace. + - name: activity_click_email - - name: activity_click_link + description: Table with email click activities. + columns: + - name: activity_date + description: The date of the activity. + + - name: activity_type_id + description: The ID of the activity type. + + - name: campaign_id + description: The ID of the email's campaign. + + - name: campaign_run_id + description: The ID of the email's campaign run. + + - name: choice_number + description: The choice number of the current step that triggered the activity. + + - name: device + description: The device type the activity occurred on. + + - name: email_template_id + description: The ID of the email's template. + + - name: id + description: ID of the activity. + + - name: is_mobile_device + description: Whether the activity occurred on a mobile device. + + - name: lead_id + description: The ID of the lead related to the activity. + + - name: link + description: The URL of the link clicked. + + - name: primary_attribute_value + description: The primary attribute of the activity. + + - name: primary_attribute_value_id + description: The ID of the primary attribute of the activity. + + - name: step_id + description: The Id of the current step in the flow. + + - name: user_agent + description: The Web browser user agent information obtained when the lead clicked the email link. + - name: activity_email_delivered + description: Table with email delivery activities. + columns: + - name: activity_date + description: The timestamp the email was delivered. + + - name: activity_type_id + description: The ID of the activity type. + + - name: campaign_id + description: The ID of the email's campaign. + + - name: campaign_run_id + description: The ID of the email's campaign run. + + - name: choice_number + description: The choice number of the current step that triggered the activity. + + - name: email_template_id + description: The ID of the email's template. + + - name: id + description: ID of the activity. + + - name: lead_id + description: The ID of the lead related to the activity. + + - name: primary_attribute_value + description: The primary attribute of the activity. + + - name: primary_attribute_value_id + description: The ID of the primary attribute of the activity. + + - name: step_id + description: The Id of the current step in the flow. + - name: activity_email_bounced + description: Table with email bounce activities. + columns: + - name: activity_date + description: The timestamp the email bounced. + + - name: activity_type_id + description: The ID of the activity type. + + - name: campaign_id + description: The ID of the email's campaign. + + - name: campaign_run_id + description: The ID of the email's campaign run. + + - name: category + description: The category associated with bounced email. + + - name: choice_number + description: The choice number of the current step that triggered the activity. + + - name: details + description: Details about why the email bounced. + + - name: email + description: The email address that bounced. + + - name: email_template_id + description: The ID of the email's template. + + - name: id + description: ID of the activity. + + - name: lead_id + description: The ID of the lead related to the activity. + + - name: primary_attribute_value + description: The primary attribute of the activity. + + - name: primary_attribute_value_id + description: The ID of the primary attribute of the activity. + + - name: step_id + description: The Id of the current step in the flow. + + - name: subcategory + description: The subcategory associated with bounced email. + - name: activity_open_email + description: Table with email bounce activities. + columns: + - name: activity_date + description: The timestamp the email was opened. + + - name: activity_type_id + description: The ID of the activity type. + + - name: campaign_id + description: The ID of the email's campaign. + + - name: campaign_run_id + description: The ID of the email's campaign run. + + - name: choice_number + description: The choice number of the current step that triggered the activity. + + - name: device + description: The device that was used to open the email. + + - name: email_template_id + description: The ID of the email's template. + + - name: id + description: ID of the activity. + + - name: is_mobile_device + description: Identifies whether a mobile device was used to open the email. + + - name: lead_id + description: The ID of the lead related to the activity. + + - name: platform + description: The platform that was used to open the email. + + - name: primary_attribute_value + description: The primary attribute of the activity. + + - name: primary_attribute_value_id + description: The ID of the primary attribute of the activity. + + - name: step_id + description: The Id of the current step in the flow. + + - name: user_agent + description: The web browser user agent information obtained when the email was opened. + - name: activity_unsubscribe_email - - name: activity_send_email \ No newline at end of file + description: Table with email unsusbscribe activities. + columns: + - name: activity_date + description: The timestamp the lead unsubscribed. + + - name: activity_type_id + description: The ID of the activity type. + + - name: campaign_id + description: The ID of the email's campaign. + + - name: campaign_run_id + description: The ID of the email's campaign run. + + - name: client_ip_address + description: The IP address of the client that unsubscribed. + + - name: email_template_id + description: The ID of the email's template. + + - name: form_fields + description: The query parameters contained within the URL. + + - name: id + description: ID of the activity. + + - name: lead_id + description: The ID of the lead related to the activity. + + - name: primary_attribute_value + description: The primary attribute of the activity. + + - name: primary_attribute_value_id + description: The ID of the primary attribute of the activity. + + - name: query_parameters + description: The query parameters contained within the URL. + + - name: referrer_url + description: The URL of the referrer used to identify where the form visit originated from. + + - name: user_agent + description: The web browser user agent information obtained when the lead unsubscribed. + + - name: webform_id + description: The ID of the unsubscribe web page. + + - name: webpage_id + description: The ID of the unsubscribe web form. + + - name: activity_send_email + description: Table with email send activities. + columns: + - name: activity_date + description: The timestamp the email was sent. + + - name: activity_type_id + description: The ID of the activity type. + + - name: campaign_id + description: The ID of the email's campaign. + + - name: campaign_run_id + description: The ID of the email's campaign run. + + - name: choice_number + description: The choice number of the current step that triggered the activity. + + - name: email_template_id + description: The ID of the email's template. + + - name: id + description: ID of the activity. + + - name: lead_id + description: The ID of the lead related to the activity. + + - name: primary_attribute_value + description: The primary attribute of the activity. + + - name: primary_attribute_value_id + description: The ID of the primary attribute of the activity. + + - name: step_id + description: The Id of the current step in the flow. + + - name: list_membership + description: Mapping table, linking leads to lists. + columns: + - name: id + description: ID of a lead. + + - name: list_id + description: ID of the list they are a member of. + + - name: list + description: Table with all Marketo lists. + columns: + - name: created_at + description: Timestamp when the list was created. + + - name: description + description: Description of the list. + + - name: id + description: ID of the list. + + - name: name + description: Name of the list. + + - name: program_name + description: Name of the program related to the list. + + - name: updated_at + description: Timestamp when the list was last updated. + + - name: workspace_name + description: Name of the parent workspace, if applicable + + - name: program_membership + description: Mapping table, linking leads to programs. + columns: + - name: acquired_by + description: Whether the lead was acquired by the parent program. + + - name: id + description: ID of a Lead. + + - name: is_exhausted + description: Whether the lead is currently exhausted in the stream, if applicable. + + - name: membership_date + description: Date the lead first became a member of the program. + + - name: nurture_cadence + description: Cadence of the parent stream if applicable. + + - name: program_id + description: ID of the related program. + + - name: progression_status + description: Program status of the lead in the parent program. + + - name: reached_success + description: Whether the lead is in a success-status in the parent program. + + - name: reached_success_date + description: Timestamp the lead reached success-status. + + - name: stream + description: Stream that the lead is a member of, if the parent program is an engagement program. \ No newline at end of file diff --git a/models/stg_marketo.yml b/models/stg_marketo.yml index 2218de0..53d892c 100644 --- a/models/stg_marketo.yml +++ b/models/stg_marketo.yml @@ -4,9 +4,49 @@ models: - name: stg_marketo__activity_change_data_value columns: - name: activity_id + description: ID of the activity. tests: - unique - not_null + + - name: activity_timestamp + description: Timestamp of the actvity. + + - name: activity_type_id + description: ID of the activity type. + + - name: api_method_name + description: API method used for change, if applicable. + + - name: campaign_id + description: The ID of the related campaign, if applicable. + + - name: change_reason + description: Reason for the data change. + + - name: change_source + description: Source of the data change. + + - name: lead_id + description: Id of the lead associated to the activity. + + - name: modifying_user_id + description: The user who instigated the change, if applicable. + + - name: new_value + description: New value after the change. + + - name: old_value + description: Old value before the change. + + - name: primary_attribute_value + description: Value of the primary attribute. + + - name: primary_attribute_value_id + description: ID of the primary attribute field. + + - name: request_id + description: ID of the request made. - name: stg_marketo__activity_click_email columns: @@ -14,56 +54,423 @@ models: tests: - unique - not_null + + - name: activity_timestamp + description: Timestamp of the actvity. + + - name: activity_type_id + description: ID of the activity type. + + - name: campaign_id + description: The ID of the related campaign, if applicable. + + - name: campaign_run_id + description: The ID of the email's campaign run. + + - name: choice_number + description: The choice number of the current step that triggered the activity. + + - name: click_device + description: The device type the activity occurred on. + + - name: click_link_url + description: The URL of the link clicked. + + - name: email_send_id + description: The inferred ID for the email sent. + + - name: email_template_id + description: The ID of the email's template. + + - name: is_mobile_device + description: Whether the activity occurred on a mobile device. + + - name: lead_id + description: The ID of the lead related to the activity. + + - name: primary_attribute_value + description: The primary attribute of the activity. + + - name: primary_attribute_value_id + description: The ID of the primary attribute of the activity. + + - name: step_id + description: The Id of the current step in the flow. + + - name: user_agent + description: The Web browser user agent information obtained when the lead clicked the email link. - name: stg_marketo__activity_email_bounced columns: - name: activity_id + description: ID of the activity. tests: - unique - not_null + + - name: activity_timestamp + description: The timestamp the email bounced. + + - name: activity_type_id + description: The ID of the activity type. + + - name: bounce_category + description: The category associated with bounced email. + + - name: bounce_subcategory + description: The subcategory associated with bounced email. + + - name: campaign_id + description: The ID of the email's campaign. + + - name: campaign_run_id + description: The ID of the email's campaign run. + + - name: choice_number + description: The choice number of the current step that triggered the activity. + + - name: details + description: Details about why the email bounced. + + - name: email_address + description: The email address that bounced. + + - name: email_send_id + description: The inferred ID for the email sent. + + - name: email_template_id + description: The ID of the email's template. + + - name: lead_id + description: The ID of the lead related to the activity. + + - name: primary_attribute_value + description: The primary attribute of the activity. + + - name: primary_attribute_value_id + description: The ID of the primary attribute of the activity. + + - name: step_id + description: The Id of the current step in the flow. - name: stg_marketo__activity_email_delivered columns: - name: activity_id + description: ID of the activity. tests: - unique - not_null + + - name: activity_timestamp + description: The timestamp the email was delivered. + + - name: activity_type_id + description: The ID of the activity type. + + - name: campaign_id + description: The ID of the email's campaign. + + - name: campaign_run_id + description: The ID of the email's campaign run. + + - name: choice_number + description: The choice number of the current step that triggered the activity. + + - name: email_send_id + description: The inferred ID for the email sent. + + - name: email_template_id + description: The ID of the email's template. + + - name: lead_id + description: The ID of the lead related to the activity. + + - name: primary_attribute_value + description: The primary attribute of the activity. + + - name: primary_attribute_value_id + description: The ID of the primary attribute of the activity. + + - name: step_id + description: The Id of the current step in the flow. - name: stg_marketo__activity_open_email columns: - name: activity_id + description: ID of the activity. tests: - unique - not_null + + - name: activity_timestamp + description: The timestamp the email was opened. + + - name: activity_type_id + description: The ID of the activity type. + + - name: campaign_id + description: The ID of the email's campaign. + + - name: campaign_run_id + description: The ID of the email's campaign run. + + - name: choice_number + description: The choice number of the current step that triggered the activity. + + - name: device + description: The device that was used to open the email. + + - name: email_send_id + description: The inferred ID for the email sent. + + - name: email_template_id + description: The ID of the email's template. + + - name: is_mobile_device + description: Identifies whether a mobile device was used to open the email. + + - name: lead_id + description: The ID of the lead related to the activity. + + - name: platform + description: The platform that was used to open the email. + + - name: primary_attribute_value + description: The primary attribute of the activity. + + - name: primary_attribute_value_id + description: The ID of the primary attribute of the activity. + + - name: step_id + description: The Id of the current step in the flow. + + - name: user_agent + description: The web browser user agent information obtained when the email was opened. - name: stg_marketo__activity_send_email columns: - name: activity_id + description: ID of the activity. tests: - unique - not_null + + - name: activity_timestamp + description: The timestamp the email was sent. + + - name: activity_type_id + description: The ID of the activity type. + + - name: campaign_id + description: The ID of the email's campaign. + + - name: campaign_run_id + description: The ID of the email's campaign run. + + - name: choice_number + description: The choice number of the current step that triggered the activity. + + - name: email_send_id + description: The inferred ID for the email sent. + + - name: email_template_id + description: The ID of the email's template. + + - name: lead_id + description: The ID of the lead related to the activity. + + - name: primary_attribute_value + description: The primary attribute of the activity. + + - name: primary_attribute_value_id + description: The ID of the primary attribute of the activity. + + - name: step_id + description: The Id of the current step in the flow. - name: stg_marketo__activity_unsubscribe_email columns: - name: activity_id + description: ID of the activity. tests: - unique - not_null + + - name: activity_timestamp + description: The timestamp the lead unsubscribed. + + - name: activity_type_id + description: The ID of the activity type. + + - name: campaign_id + description: The ID of the email's campaign. + + - name: campaign_run_id + description: The ID of the email's campaign run. + + - name: client_ip_address + description: The IP address of the client that unsubscribed. + + - name: email_send_id + description: The inferred ID for the email sent. + + - name: email_template_id + description: The ID of the email's template. + + - name: form_fields + description: The query parameters contained within the URL. + + - name: lead_id + description: The ID of the lead related to the activity. + + - name: primary_attribute_value + description: The primary attribute of the activity. + + - name: primary_attribute_value_id + description: The ID of the primary attribute of the activity. + + - name: query_parameters + description: The query parameters contained within the URL. + + - name: referrer_url + description: The URL of the referrer used to identify where the form visit originated from. + + - name: user_agent + description: The web browser user agent information obtained when the lead unsubscribed. + + - name: webform_id + description: The ID of the unsubscribe web page. + + - name: webpage_id + description: The ID of the unsubscribe web form. - name: stg_marketo__campaigns columns: - name: campaign_id + description: ID of the campaign. tests: - unique - not_null + + - name: campaign_name + description: Name of the campaign. + + - name: campaign_type + description: Type of campaign, either 'batch' or 'trigger'. + + - name: created_timestamp + description: Timestamp when the campaign was created. + + - name: description + description: Description of the campaign + + - name: is_active + description: Whether the campaign is active. Only applicable to trigger campaigns. + + - name: program_id + description: ID of the parent program, if applicable. + + - name: program_name + description: Name of the parent program, if applicable. + + - name: updated_timestamp + description: Timestamp when the campaign was most recently updated. + + - name: workspace_name + description: Name of the parent workspace, if applicable. - name: stg_marketo__email_template_history columns: - name: email_template_history_id + description: ID of the email template. tests: - unique - not_null + - name: created_timestamp + description: Timestamp the email template was created. + + - name: description + description: Description of the email template. + + - name: email_subject + description: Subject line of the email. + + - name: email_template_history_id + description: ID of the version of the email template. + + - name: email_template_id + description: ID of the email template + + - name: email_template_name + description: Name of the email template. + + - name: email_template_status + description: Status filter for draft or approved versions. + + - name: email_template_url + description: URL of the email template in the Marketo UI. + + - name: folder_name + description: The name of the email template's folder. + + - name: folder_id + description: The ID of the email template's folder. + + - name: folder_type + description: The type of the email template's folder. + + - name: folder_value + description: The value of the email template's folder. + + - name: from_email + description: The 'From' address of the email. + + - name: from_name + description: The 'From' name of the email. + + - name: has_web_view_enabled + description: Whether 'View as Webpage' function is enabled for the email. + + - name: inferred_version + description: Incrementing integer version of the email template. + + - name: is_most_recent_version + description: Whether it is the most recent version of the email template. + + - name: is_operational + description: Whether the email is operational. Operational emails bypass unsubscribe status. Defaults to false. + + - name: is_text_only + description: Setting to include text-only version of email when sent. + + - name: parent_template_id + description: ID of the parent template. + + - name: program_id + description: The ID of the email template's program. + + - name: publish_to_msi + description: Whether the email is published to Marketo Sales Insight. + + - name: reply_email + description: Reply-To address of the Email. + + - name: updated_timestamp + description: Timestamp the email template was last updated. + + - name: valid_from + description: When the version of the email template was is valid from. + + - name: valid_to + description: When the version of the email template was is valid to. + + - name: version_type + description: The type version of the email, either '1' or '2'. + + - name: workspace_name + description: Name of the workspace. + - name: stg_marketo__lead_describe columns: - name: lead_describe_id @@ -71,16 +478,87 @@ models: - unique - not_null + - name: data_type + description: Datatype of the field. + + - name: display_name + description: UI display-name of the field. + + - name: field_max_length + description: Max length of the field. Only applicable to text, string, and text area. + + - name: is_rest_readonly + description: Whether the field is only available via the REST API. + + - name: is_soap_readonly + description: Whether the field is only available via the SOAP API. + + - name: rest_name + description: Description of REST API usage attributes. + + - name: soap_name + description: Description of SOAP API usage attributes. + - name: stg_marketo__lead columns: - name: lead_id + description: ID of the lead. tests: - unique - not_null + + - name: updated_at + description: The timestamp each lead object was last updated at. + + - name: updated_at + description: The timestamp each lead object was created at. - name: stg_marketo__program columns: - name: program_id + description: ID of the program. tests: - unique - - not_null \ No newline at end of file + - not_null + + - name: channel + description: Channel of the program. + + - name: created_timestamp + description: Timestamp the program was created at + + - name: description + description: Description of the program. + + - name: end_timestamp + description: End date of the program. Applicable to event, email, and webinar type programs. + + - name: program_name + description: Name of the program. + + - name: program_status + description: | + Status of the program. Only valid for Email and engagement program types. + Allowed values: locked, unlocked, on, off + + - name: program_type + description: | + Type of the program. Allowed values: program, event, webinar, nurture + + - name: sfdc_id + description: SFDC id of the program if linked to an SFDC campaign. + + - name: sfdc_name + description: Name of the linked SFDC campaign if applicable. + + - name: start_timestamp + description: Start date of program. Applicable to event, email and webinar type programs. + + - name: updated_timestamp + description: Timestamp the program was most recently updated. + + - name: url + description: URL of the program in the Marketo UI. + + - name: workspace + description: Name of the workspace. \ No newline at end of file diff --git a/models/stg_marketo__activity_change_data_value.sql b/models/stg_marketo__activity_change_data_value.sql index 2d03855..618fce5 100644 --- a/models/stg_marketo__activity_change_data_value.sql +++ b/models/stg_marketo__activity_change_data_value.sql @@ -6,13 +6,20 @@ with base as ( ), fields as ( select + activity_date as activity_timestamp, + activity_type_id, + api_method_name, + campaign_id, id as activity_id, - activity_date, lead_id, + modifying_user as modifying_user_id, new_value, old_value, primary_attribute_value, - primary_attribute_value_id + primary_attribute_value_id, + reason as change_reason, + request_id, + source as change_source from base ) diff --git a/models/stg_marketo__activity_click_email.sql b/models/stg_marketo__activity_click_email.sql index 5f4fac7..427c2f6 100644 --- a/models/stg_marketo__activity_click_email.sql +++ b/models/stg_marketo__activity_click_email.sql @@ -6,12 +6,22 @@ with base as ( ), fields as ( select - id as activity_id, activity_date as activity_timestamp, + activity_type_id, campaign_id, campaign_run_id, + choice_number, + device as click_device, email_template_id, - lead_id + id as activity_id, + is_mobile_device, + lead_id, + link as click_link_url, + platform as user_platform, + primary_attribute_value, + primary_attribute_value_id, + step_id, + user_agent from base ), surrogate as ( diff --git a/models/stg_marketo__activity_email_bounced.sql b/models/stg_marketo__activity_email_bounced.sql index bb15ad8..b6c5367 100644 --- a/models/stg_marketo__activity_email_bounced.sql +++ b/models/stg_marketo__activity_email_bounced.sql @@ -5,13 +5,22 @@ with base as ( ), fields as ( - select - id as activity_id, + select activity_date as activity_timestamp, + activity_type_id, campaign_id, campaign_run_id, + category as bounce_category, + choice_number, + details, + email as email_address, email_template_id, - lead_id + id as activity_id, + lead_id, + primary_attribute_value, + primary_attribute_value_id, + step_id, + subcategory as bounce_subcategory from base ), surrogate as ( diff --git a/models/stg_marketo__activity_email_delivered.sql b/models/stg_marketo__activity_email_delivered.sql index 440dcda..bc521a6 100644 --- a/models/stg_marketo__activity_email_delivered.sql +++ b/models/stg_marketo__activity_email_delivered.sql @@ -6,12 +6,17 @@ with base as ( ), fields as ( select - id as activity_id, activity_date as activity_timestamp, + activity_type_id, campaign_id, campaign_run_id, + choice_number, email_template_id, - lead_id + id as activity_id, + lead_id, + primary_attribute_value, + primary_attribute_value_id, + step_id from base ), surrogate as ( diff --git a/models/stg_marketo__activity_open_email.sql b/models/stg_marketo__activity_open_email.sql index af10656..94d32f4 100644 --- a/models/stg_marketo__activity_open_email.sql +++ b/models/stg_marketo__activity_open_email.sql @@ -6,12 +6,21 @@ with base as ( ), fields as ( select - id as activity_id, activity_date as activity_timestamp, + activity_type_id, campaign_id, campaign_run_id, + choice_number, + device, email_template_id, - lead_id + id as activity_id, + is_mobile_device, + lead_id, + platform, + primary_attribute_value, + primary_attribute_value_id, + step_id, + user_agent from base ), surrogate as ( diff --git a/models/stg_marketo__activity_send_email.sql b/models/stg_marketo__activity_send_email.sql index fae419a..22f1ee5 100644 --- a/models/stg_marketo__activity_send_email.sql +++ b/models/stg_marketo__activity_send_email.sql @@ -6,12 +6,17 @@ with base as ( ), fields as ( select - id as activity_id, activity_date as activity_timestamp, + activity_type_id, campaign_id, campaign_run_id, + choice_number, email_template_id, - lead_id + id as activity_id, + lead_id, + primary_attribute_value, + primary_attribute_value_id, + step_id from base ), surrogate as ( diff --git a/models/stg_marketo__activity_unsubscribe_email.sql b/models/stg_marketo__activity_unsubscribe_email.sql index 91ee1a1..d367325 100644 --- a/models/stg_marketo__activity_unsubscribe_email.sql +++ b/models/stg_marketo__activity_unsubscribe_email.sql @@ -5,13 +5,23 @@ with base as ( ), fields as ( - select - id as activity_id, + select activity_date as activity_timestamp, + activity_type_id, campaign_id, campaign_run_id, + client_ip_address, email_template_id, - lead_id + form_fields, + id as activity_id, + lead_id, + primary_attribute_value, + primary_attribute_value_id, + query_parameters, + referrer_url, + user_agent, + webform_id, + webpage_id from base ), surrogate as ( diff --git a/models/stg_marketo__campaigns.sql b/models/stg_marketo__campaigns.sql index 67fa472..cc43fc4 100644 --- a/models/stg_marketo__campaigns.sql +++ b/models/stg_marketo__campaigns.sql @@ -6,14 +6,15 @@ with base as ( ), fields as ( select - id as campaign_id, active as is_active, created_at as created_timestamp, description, + id as campaign_id, name as campaign_name, program_id, program_name, type as campaign_type, + updated_at as updated_timestamp, workspace_name from base diff --git a/models/stg_marketo__email_template_history.sql b/models/stg_marketo__email_template_history.sql index c451bde..6ea4191 100644 --- a/models/stg_marketo__email_template_history.sql +++ b/models/stg_marketo__email_template_history.sql @@ -6,11 +6,29 @@ with base as ( ), fields as ( select - id as email_template_id, - updated_at as updated_timestamp, created_at as created_timestamp, description, - operational as is_operational + folder_folder_name as folder_name, + folder_id, + folder_type, + folder_value, + from_email, + from_name, + id as email_template_id, + name as email_template_name, + operational as is_operational, + program_id, + publish_to_msi, + reply_email, + status as email_template_status, + subject as email_subject, + template as parent_template_id, + text_only as is_text_only, + updated_at as updated_timestamp, + url as email_template_url, + version as version_type, + web_view as has_web_view_enabled, + workspace as workspace_name from base ), versions as ( @@ -24,7 +42,7 @@ with base as ( ), valid as ( select - *, + * except (total_count_of_versions), case when inferred_version = 1 then created_timestamp else updated_timestamp diff --git a/models/stg_marketo__lead.sql b/models/stg_marketo__lead.sql index 948a3c8..ded79a6 100644 --- a/models/stg_marketo__lead.sql +++ b/models/stg_marketo__lead.sql @@ -7,7 +7,9 @@ with base as ( select id as lead_id, - {{ dbt_utils.star(from=ref('stg_marketo__lead_adapter'), except=['id']) }} + created_at as created_timestamp, + updated_at as updated_timestamp, + {{ dbt_utils.star(from=ref('stg_marketo__lead_adapter'), except=['id', 'created_at', 'updated_at']) }} from base ) diff --git a/models/stg_marketo__lead_describe.sql b/models/stg_marketo__lead_describe.sql index 1f4846d..44be656 100644 --- a/models/stg_marketo__lead_describe.sql +++ b/models/stg_marketo__lead_describe.sql @@ -6,8 +6,14 @@ with base as ( ), fields as ( select + data_type, + display_name, id as lead_describe_id, - restname + length as field_max_length, + restname as rest_name, + restread_only as is_rest_readonly, + soapname as soap_name, + soapread_only as is_soap_readonly from base )