Fivetran Salesforce

We display the source tables from the data warehouses to model.

sf_account_data (first 100 rows)

_fivetran_synced account_number account_source annual_revenue billing_city billing_country billing_country_code billing_geocode_accuracy billing_latitude billing_longitude billing_postal_code billing_state billing_state_code billing_street description fax id industry is_deleted jigsaw_company_id last_activity_date last_referenced_date last_viewed_date master_record_id name number_of_employees owner_id ownership parent_id phone photo_url rating record_type_id shipping_city shipping_country shipping_country_code shipping_geocode_accuracy shipping_latitude shipping_longitude shipping_postal_code shipping_state shipping_state_code shipping_street sic sic_desc site ticker_symbol type website _fivetran_active
0 2019-10-17 21:10:19 NaN None NaN None None None NaN NaN NaN None None None None None NaN 0015500000Xyy06AAB None False NaN NaN NaN NaN None Eric's Test NaN tqs6UXPA/Lm7W+0dX0+syw== NaN NaN None cHWjfsf2Ht8rqw1PfJJQAw== NaN ulhLv5btm8B/N7JURh1/+w== NaN None None NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ziZgHawN6hOLcpXwK3Ygpw== None True
1 2019-10-17 21:33:00 NaN TDK+SgtPSM3Vk67zX9aeRA== NaN None None None NaN NaN NaN None None None None None NaN 0015500000Ygpq1AAB None True NaN NaN NaN NaN L4izOo4yZpLq5io5YM8pvA== Seinfeld NaN soS8gWpPTwLhsepmOnEc0w== NaN NaN None UYCWM7QeZFg3GdlAkhe9fg== NaN ulhLv5btm8B/N7JURh1/+w== NaN None None NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ziZgHawN6hOLcpXwK3Ygpw== None True
2 2019-04-04 18:36:06 NaN None NaN n9oradGMpYOT/QxsY/psmw== 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== NaN NaN NaN gnzLDuqKcGxMNKFokfhOew== mAzuwdui02wrqGf2g7R4OA== uOqY3hqD9h0ZdgJ3QaRYvg== 2YEqg12uvpIXyu6aR9mQlg== None NaN 001q000000wW9BeAAK None True NaN NaN NaN NaN None Blue Test NaN Air1Prg9Tsiw3UANemom6g== NaN NaN WIDCNIeVb5iHBWziEBitQw== uiHRGP2vPD84LdjD3hMTrw== NaN ulhLv5btm8B/N7JURh1/+w== NaN 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN iFbCAfBS66w7LWV2PbAhCg== ye4O0TtPzpTBUyS5TfSNig== True
3 2019-04-04 18:36:06 NaN 4sUcAmMzCJTMD0K4Qnsiog== NaN n9oradGMpYOT/QxsY/psmw== 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== NaN NaN NaN gnzLDuqKcGxMNKFokfhOew== mAzuwdui02wrqGf2g7R4OA== uOqY3hqD9h0ZdgJ3QaRYvg== 2YEqg12uvpIXyu6aR9mQlg== None NaN 001q000000wW9BZAA0 None True NaN NaN NaN NaN None Blue Test NaN Air1Prg9Tsiw3UANemom6g== NaN NaN WIDCNIeVb5iHBWziEBitQw== 5KRYOy6rMW5wXVulkbNi1w== NaN ulhLv5btm8B/N7JURh1/+w== NaN 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN iFbCAfBS66w7LWV2PbAhCg== ye4O0TtPzpTBUyS5TfSNig== True
4 2019-04-04 18:36:06 NaN MfuqnemFQBY2RwqM7YBkKA== NaN ZxAK+LCOBzw7p/TeJwdYSw== 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== NaN NaN NaN bnxaENqWaHK61C0CuTdesA== FeSUdeQlOf7tk/xcziXTyw== Qpg7BeLyzCKCLjC+t73WaA== qvC68WCtjj4ClzOUWJSkCw== wf9VogLxiOoQJExQ13q6Vw== NaN 001q0000010PXTEAA4 None True NaN NaN NaN NaN None Rick Thomas Company NaN Air1Prg9Tsiw3UANemom6g== NaN NaN pixghWKhHJrqHD4kBeM6Gw== GweXup29BdjkT9BjcSkzPQ== NaN ulhLv5btm8B/N7JURh1/+w== NaN 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN iFbCAfBS66w7LWV2PbAhCg== +6N+ddY6amrzExJicFCd3w== False
5 2019-04-04 18:36:06 NaN Fbu50LvyXo0peN4RaMdJ3A== NaN W08cDivYvBunJs1R3XDBpg== 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== NaN NaN NaN auObPzjeIkCwKijyu7QQCw== NWd5qaFpZxRID1f6P7ZtTA== Po0RXrSzK56UefOH2+FO4Q== UisBzX5S+vz7B0xHE4v4bg== None NaN 001q0000013WMSUAA4 yCBcdjbnKNRIwndOakqUSw== True NaN NaN NaN NaN None Testins Opp Close 120210.0 nqxS50kwRjtOYb9ZB4/PoQ== NaN NaN None J/YOmfl+qwv6i4jsHY+ujQ== NaN ulhLv5btm8B/N7JURh1/+w== NaN 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ziZgHawN6hOLcpXwK3Ygpw== HVkg9LRLJ6gCvXfE8FNvWg== True
6 2019-04-04 18:36:06 NaN MfuqnemFQBY2RwqM7YBkKA== NaN ZxAK+LCOBzw7p/TeJwdYSw== 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== NaN NaN NaN None FeSUdeQlOf7tk/xcziXTyw== Qpg7BeLyzCKCLjC+t73WaA== None None NaN 001q0000010Pe9xAAC None True NaN NaN NaN NaN None Test 1234 NaN AwxR76rxgr77EfSnTHH57Q== NaN NaN zYXs9P+yNjgg8uwZvFV8PQ== 1fQ7foJAfJKZX7Ndu+Celg== NaN ulhLv5btm8B/N7JURh1/+w== NaN 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN iFbCAfBS66w7LWV2PbAhCg== jcDRlq9Jxi7l0+tk1aTTdg== True
7 2019-04-04 18:36:06 NaN 4sUcAmMzCJTMD0K4Qnsiog== NaN None 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== NaN NaN NaN None None None None None NaN 001q0000010QZZ7AAO None True NaN NaN NaN NaN None allbound ID test NaN AwxR76rxgr77EfSnTHH57Q== NaN NaN None gbEQmTQh/HHUsuesIq+NFw== NaN ulhLv5btm8B/N7JURh1/+w== NaN 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN iFbCAfBS66w7LWV2PbAhCg== None False
8 2019-04-04 18:36:06 NaN 4sUcAmMzCJTMD0K4Qnsiog== NaN None 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== NaN NaN NaN None None None None None NaN 001q0000010PiFMAA0 None True NaN NaN NaN NaN None Test 123 NaN AwxR76rxgr77EfSnTHH57Q== NaN NaN None 3RgfHUrW6KCagqoD/sdXyA== NaN ulhLv5btm8B/N7JURh1/+w== NaN 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN iFbCAfBS66w7LWV2PbAhCg== None False
9 2019-04-04 18:36:06 NaN MfuqnemFQBY2RwqM7YBkKA== NaN ZxAK+LCOBzw7p/TeJwdYSw== 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== NaN NaN NaN bnxaENqWaHK61C0CuTdesA== FeSUdeQlOf7tk/xcziXTyw== Qpg7BeLyzCKCLjC+t73WaA== XBbaBQNtkym1SAcPiKF1UA== None NaN 001q0000010kZLuAAM yCBcdjbnKNRIwndOakqUSw== True NaN NaN NaN NaN None Balto Dog NaN AwxR76rxgr77EfSnTHH57Q== NaN NaN pixghWKhHJrqHD4kBeM6Gw== sibCUUkOHR2dqeGf+xov+A== NaN ulhLv5btm8B/N7JURh1/+w== NaN 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN iFbCAfBS66w7LWV2PbAhCg== +Z00MuxehkeqPQlcxh/nBA== True

sf_account_history_data (first 100 rows)

_fivetran_active _fivetran_start _fivetran_end _fivetran_synced account_number account_source annual_revenue billing_city billing_country billing_postal_code billing_state billing_street description id industry is_deleted last_activity_date last_referenced_date last_viewed_date master_record_id name number_of_employees owner_id ownership parent_id rating record_type_id shipping_city shipping_country shipping_postal_code shipping_state shipping_street type website
0 True 2019-10-17 21:10:19 9999-12-31 23:59:59 2019-10-17 21:10:19 NaN None NaN None None None None None None 0015500000Xyy06AAB None False NaN NaN NaN None Eric's Test NaN tqs6UXPA/Lm7W+0dX0+syw== NaN NaN NaN ulhLv5btm8B/N7JURh1/+w== NaN None NaN NaN NaN ziZgHawN6hOLcpXwK3Ygpw== None
1 True 2019-10-17 21:33:00 9999-12-31 23:59:59 2019-10-17 21:33:00 NaN TDK+SgtPSM3Vk67zX9aeRA== NaN None None None None None None 0015500000Ygpq1AAB None True NaN NaN NaN L4izOo4yZpLq5io5YM8pvA== Seinfeld NaN soS8gWpPTwLhsepmOnEc0w== NaN NaN NaN ulhLv5btm8B/N7JURh1/+w== NaN None NaN NaN NaN ziZgHawN6hOLcpXwK3Ygpw== None
2 True 2019-04-04 18:36:06 9999-12-31 23:59:59 2019-04-04 18:36:06 NaN None NaN n9oradGMpYOT/QxsY/psmw== 8lPv4wLTKrJkp24M5lvnaQ== gnzLDuqKcGxMNKFokfhOew== mAzuwdui02wrqGf2g7R4OA== 2YEqg12uvpIXyu6aR9mQlg== None 001q000000wW9BeAAK None True NaN NaN NaN None Blue Test NaN Air1Prg9Tsiw3UANemom6g== NaN NaN NaN ulhLv5btm8B/N7JURh1/+w== NaN 8lPv4wLTKrJkp24M5lvnaQ== NaN NaN NaN iFbCAfBS66w7LWV2PbAhCg== ye4O0TtPzpTBUyS5TfSNig==
3 True 2019-04-04 18:36:06 9999-12-31 23:59:59 2019-04-04 18:36:06 NaN 4sUcAmMzCJTMD0K4Qnsiog== NaN n9oradGMpYOT/QxsY/psmw== 8lPv4wLTKrJkp24M5lvnaQ== gnzLDuqKcGxMNKFokfhOew== mAzuwdui02wrqGf2g7R4OA== 2YEqg12uvpIXyu6aR9mQlg== None 001q000000wW9BZAA0 None True NaN NaN NaN None Blue Test NaN Air1Prg9Tsiw3UANemom6g== NaN NaN NaN ulhLv5btm8B/N7JURh1/+w== NaN 8lPv4wLTKrJkp24M5lvnaQ== NaN NaN NaN iFbCAfBS66w7LWV2PbAhCg== ye4O0TtPzpTBUyS5TfSNig==
4 False 2019-04-04 18:36:06 2019-04-04 18:36:07 2019-04-04 18:36:06 NaN MfuqnemFQBY2RwqM7YBkKA== NaN ZxAK+LCOBzw7p/TeJwdYSw== 8lPv4wLTKrJkp24M5lvnaQ== bnxaENqWaHK61C0CuTdesA== FeSUdeQlOf7tk/xcziXTyw== qvC68WCtjj4ClzOUWJSkCw== wf9VogLxiOoQJExQ13q6Vw== 001q0000010PXTEAA4 None True NaN NaN NaN None Rick Thomas Company NaN Air1Prg9Tsiw3UANemom6g== NaN NaN NaN ulhLv5btm8B/N7JURh1/+w== NaN 8lPv4wLTKrJkp24M5lvnaQ== NaN NaN NaN iFbCAfBS66w7LWV2PbAhCg== +6N+ddY6amrzExJicFCd3w==
5 True 2019-04-04 18:36:06 9999-12-31 23:59:59 2019-04-04 18:36:06 NaN Fbu50LvyXo0peN4RaMdJ3A== NaN W08cDivYvBunJs1R3XDBpg== 8lPv4wLTKrJkp24M5lvnaQ== auObPzjeIkCwKijyu7QQCw== NWd5qaFpZxRID1f6P7ZtTA== UisBzX5S+vz7B0xHE4v4bg== None 001q0000013WMSUAA4 yCBcdjbnKNRIwndOakqUSw== True NaN NaN NaN None Testins Opp Close 120210.0 nqxS50kwRjtOYb9ZB4/PoQ== NaN NaN NaN ulhLv5btm8B/N7JURh1/+w== NaN 8lPv4wLTKrJkp24M5lvnaQ== NaN NaN NaN ziZgHawN6hOLcpXwK3Ygpw== HVkg9LRLJ6gCvXfE8FNvWg==
6 True 2019-04-04 18:36:06 9999-12-31 23:59:59 2019-04-04 18:36:06 NaN MfuqnemFQBY2RwqM7YBkKA== NaN ZxAK+LCOBzw7p/TeJwdYSw== 8lPv4wLTKrJkp24M5lvnaQ== None FeSUdeQlOf7tk/xcziXTyw== None None 001q0000010Pe9xAAC None True NaN NaN NaN None Test 1234 NaN AwxR76rxgr77EfSnTHH57Q== NaN NaN NaN ulhLv5btm8B/N7JURh1/+w== NaN 8lPv4wLTKrJkp24M5lvnaQ== NaN NaN NaN iFbCAfBS66w7LWV2PbAhCg== jcDRlq9Jxi7l0+tk1aTTdg==
7 False 2019-04-04 18:36:06 2019-04-04 18:36:07 2019-04-04 18:36:06 NaN 4sUcAmMzCJTMD0K4Qnsiog== NaN None 8lPv4wLTKrJkp24M5lvnaQ== None None None None 001q0000010QZZ7AAO None True NaN NaN NaN None allbound ID test NaN AwxR76rxgr77EfSnTHH57Q== NaN NaN NaN ulhLv5btm8B/N7JURh1/+w== NaN 8lPv4wLTKrJkp24M5lvnaQ== NaN NaN NaN iFbCAfBS66w7LWV2PbAhCg== None
8 False 2019-04-04 18:36:06 2019-04-04 18:36:07 2019-04-04 18:36:06 NaN 4sUcAmMzCJTMD0K4Qnsiog== NaN None 8lPv4wLTKrJkp24M5lvnaQ== None None None None 001q0000010PiFMAA0 None True NaN NaN NaN None Test 123 NaN AwxR76rxgr77EfSnTHH57Q== NaN NaN NaN ulhLv5btm8B/N7JURh1/+w== NaN 8lPv4wLTKrJkp24M5lvnaQ== NaN NaN NaN iFbCAfBS66w7LWV2PbAhCg== None
9 True 2019-04-04 18:36:06 9999-12-31 23:59:59 2019-04-04 18:36:06 NaN MfuqnemFQBY2RwqM7YBkKA== NaN ZxAK+LCOBzw7p/TeJwdYSw== 8lPv4wLTKrJkp24M5lvnaQ== bnxaENqWaHK61C0CuTdesA== FeSUdeQlOf7tk/xcziXTyw== XBbaBQNtkym1SAcPiKF1UA== None 001q0000010kZLuAAM yCBcdjbnKNRIwndOakqUSw== True NaN NaN NaN None Balto Dog NaN AwxR76rxgr77EfSnTHH57Q== NaN NaN NaN ulhLv5btm8B/N7JURh1/+w== NaN 8lPv4wLTKrJkp24M5lvnaQ== NaN NaN NaN iFbCAfBS66w7LWV2PbAhCg== +Z00MuxehkeqPQlcxh/nBA==

sf_contact_data (first 100 rows)

id _fivetran_synced account_id cbit_clearbit_c cbit_clearbit_ready_c created_by_id created_date department email email_bounced_date email_bounced_reason fax first_name is_deleted is_email_bounced jigsaw_contact_id last_activity_date last_curequest_date last_cuupdate_date last_modified_by_id last_modified_date last_name last_referenced_date last_viewed_date mailing_city mailing_country mailing_country_code mailing_geocode_accuracy mailing_latitude mailing_longitude mailing_postal_code mailing_state mailing_state_code mailing_street master_record_id mc_4_sf_mc_subscriber_c mobile_phone name owner_id phone photo_url reports_to_id salutation system_modstamp title email_bounced_c email_quality_unknown_c gclid_c referral_account_c referral_contact_c has_opted_out_of_email act_on_lead_score_c cbit_created_by_clearbit_c fivetran_user_id_c no_longer_at_company_c pi_campaign_c pi_comments_c pi_conversion_date_c pi_conversion_object_name_c pi_conversion_object_type_c pi_created_date_c pi_first_activity_c pi_first_search_term_c pi_first_search_type_c pi_first_touch_url_c pi_grade_c pi_last_activity_c pi_needs_score_synced_c pi_notes_c pi_pardot_hard_bounced_c pi_pardot_last_scored_at_c pi_score_c pi_url_c pi_utm_campaign_c pi_utm_content_c pi_utm_medium_c pi_utm_source_c pi_utm_term_c lead_source contact_status_c region_c competitor_c bt_stripe_gender_c bt_stripe_ssn_last_4_encrypted_c bt_stripe_personal_id_number_c bt_stripe_personal_id_number_encrypted_c bt_stripe_maiden_name_c bt_stripe_languages_c bt_stripe_default_payment_method_c bt_stripe_ssn_last_4_c bt_stripe_personal_id_type_c bt_stripe_default_payment_gateway_c bt_stripe_level_c lean_data_routing_action_c lean_data_matched_buyer_persona_c lean_data_ld_segment_c lean_data_tag_c lean_data_modified_score_c do_not_route_lead_c technical_contact_c allbound_id_c notes_c netsuite_conn_sync_in_progress_c netsuite_conn_celigo_update_c netsuite_conn_net_suite_id_c netsuite_conn_net_suite_sync_err_c netsuite_conn_push_to_net_suite_c netsuite_conn_pushed_from_opportunity_c description lid_linked_in_company_id_c lid_linked_in_member_token_c is_eu_resident_c do_not_call sales_loft_1_most_recent_cadence_next_step_due_date_c sales_loft_1_most_recent_last_completed_step_c sales_loft_1_most_recent_cadence_name_c source_detail_c utm_source_c utm_content_c utm_term_c utm_medium_c utm_campaign_c network_c matchtype_c device_c creative_c adgroupid_c keyword_c campaignid_c partner_rep_email_c partner_rep_name_c contact_type_c old_lead_source_c old_lead_source_detail_c contact_stage_c original_utm_campaign_c original_utm_content_c original_utm_medium_c original_utm_source_c original_utm_term_c es_app_escreated_timestamp_c es_app_esecid_c es_app_esenriched_c es_app_esenriched_timestamp_c es_app_esintent_aggregate_score_c es_app_esintent_timestamp_c es_app_esintent_topics_c es_app_esoverall_fit_score_c es_app_essource_c individual_id marketing_process_c automation_tracking_c user_gems_has_changed_job_c email_opt_in_explicit_c email_opt_in_implicit_c gdpr_opt_in_explicit_c user_gems_is_a_user_gem_c user_gems_past_account_c user_gems_past_company_c user_gems_past_contact_c user_gems_past_title_c partner_contact_c promotion_id_c referral_exists_c referral_first_name_c referral_last_name_c mkto_71_contact_acquisition_date_c mkto_71_contact_acquisition_program_c mkto_71_contact_acquisition_program_id_c mkto_71_contact_inferred_city_c mkto_71_contact_inferred_company_c mkto_71_contact_inferred_country_c mkto_71_contact_inferred_metropolitan_a_c mkto_71_contact_inferred_phone_area_cod_c mkto_71_contact_inferred_postal_code_c mkto_71_contact_inferred_state_region_c mkto_71_contact_lead_score_c mkto_71_contact_original_referrer_c mkto_71_contact_original_search_engine_c mkto_71_contact_original_search_phrase_c mkto_71_contact_original_source_info_c mkto_71_contact_original_source_type_c mkto_si_hide_date_c mkto_si_last_interesting_moment_date_c mkto_si_last_interesting_moment_desc_c mkto_si_last_interesting_moment_source_c mkto_si_last_interesting_moment_type_c mkto_si_mkto_lead_score_c mkto_si_priority_c mkto_si_relative_score_value_c mkto_si_urgency_value_c cloudingo_agent_ces_c cloudingo_agent_mar_c cloudingo_agent_mas_c cloudingo_agent_mav_c cloudingo_agent_mrdi_c cloudingo_agent_mtz_c cloudingo_agent_oar_c cloudingo_agent_oas_c cloudingo_agent_oav_c cloudingo_agent_ordi_c cloudingo_agent_otz_c do_not_sync_marketo_c phone_extension_c job_function_c job_level_c direct_office_c city_c country_c state_c secondary_email_c es_seniority_c source_last_lead_source_c source_last_lead_source_category_c source_last_lead_source_detail_c drift_cql_c hot_contact_c behavioral_score_c unique_email_c is_emea_event_routing_c csi_code_c clearbit_role_c clearbit_seniority_c clearbit_sub_role_c rh_2_currency_test_c rh_2_describe_c rh_2_integer_test_c created_by_role_c demographic_score_c country_code_c state_code_c attended_event_c zoominfo_technologies_c mql_date_c user_gems_user_gems_id_c dozisf_zoom_info_company_id_c dozisf_zoom_info_first_updated_c dozisf_zoom_info_id_c dozisf_zoom_info_last_updated_c lean_data_manual_route_trigger_c first_mql_date_c active_relationship_c clarus_date_c clarus_editor_c clarus_notes_c clarus_project_c clarus_status_c historical_contact_status_c fivetran_account_association_date_c fivetran_account_user_role_s_c mql_reason_c attempting_contact_date_time_c linked_in_url_c trial_contact_start_date_c contact_holdover_c bill_to_contact_hidden_c enrichment_request_c meta_data_create_date_c primary_se_c unqualified_reason_c opp_handoff_ae_c marketing_connector_interest_c recent_marketing_campaign_status_c salesloft_cadence_trigger_c last_ae_activity_owner_c last_bdr_activity_owner_c last_manual_ae_activity_date_c last_manual_bdr_activity_date_c leandata_contact_owner_override_c potential_fivetran_use_case_c lean_data_router_completion_date_time_c partner_territory_c partner_company_c bizible_2_ad_campaign_name_ft_c bizible_2_ad_campaign_name_lc_c bizible_2_bizible_id_c bizible_2_landing_page_ft_c bizible_2_landing_page_lc_c bizible_2_marketing_channel_ft_c bizible_2_marketing_channel_lc_c bizible_2_touchpoint_date_ft_c bizible_2_touchpoint_date_lc_c bizible_2_touchpoint_source_ft_c bizible_2_touchpoint_source_lc_c sales_email_opt_out_c sales_email_opt_out_date_time_c celigo_sfnsio_net_suite_id_c celigo_sfnsio_net_suite_record_c celigo_sfnsio_net_suite_sync_error_c celigo_sfnsio_skip_export_to_net_suite_c celigo_sfnsio_test_mode_record_c ironclad_workflow_c last_sales_activity_date_time_c user_activity_logged_by_c first_activity_after_mql_date_c last_sdr_activity_owner_c last_sdr_activity_date_c beta_connector_interest_c first_manual_activity_after_mql_date_c user_gems_ug_past_infos_c user_gems_ug_current_infos_c user_gems_ug_created_by_ug_c free_trial_email_confirmed_date_c routed_from_manual_bdr_ae_activity_c dnboptimizer_dn_bcontact_record_c i_sell_avention_id_c persona_c last_marketing_interesting_moment_date_c verified_c salesloft_owner_c salesloft_owner_sf_c email_opt_out_date_time_c pbf_startup_primary_role_c pbf_startup_certify_eligibility_c engagio_intent_minutes_last_30_days_c engagio_engagement_minutes_last_3_months_c engagio_engagement_minutes_last_7_days_c engagio_first_engagement_date_c engagio_department_c engagio_role_c mql_date_changed_c first_activity_after_mql_changed_c birthdate legacy_hvr_id_c has_opted_out_of_fax other_latitude username_c assistant_name created_at_c partner_contact_deprecate_c other_street other_state home_phone other_city company_c opportunity_c hvr_update_c other_phone other_geocode_accuracy other_postal_code other_country assistant_phone jigsaw avatar_c other_longitude lean_data_status_info_c analytics_id_c dnb_primary_address_postal_code_c dnb_contact_phone_c dnb_email_deliverability_score_c dnb_job_title_c dnb_email_c dnb_primary_address_city_c dnb_phone_accuracy_score_c dnb_primary_address_state_province_c dnb_primary_address_state_province_abbre_c dnb_primary_address_country_region_code_c email_opt_in_double_c phone_number_catch_all_c contact_owners_manager_stamped_c fivetran_account_id_c contacts_domain_exists_c utm_id_c self_service_routing_c no_geo_data_c to_be_deleted_salesloft_backfill_c do_not_sync_reason_marketo_c _fivetran_active
0 0033700000JmrFPAA 2017-08-24 12:51:56 None None NaN None 2019-11-11 17:23:34 NaN None NaN NaN NaN None NaN NaN NaN NaN NaN NaN None 2019-11-11 17:23:34 None NaN NaN None None None NaN NaN NaN NaN None None None NaN NaN NaN None None None None NaN NaN 2019-11-11 17:23:34 None NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN None NaN NaN NaN NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN None NaN NaN NaN NaN NaN None None NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN None NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN None NaN NaN NaN NaN NaN NaN NaN None NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
1 0031G00000q9jPQAQ 2018-11-12 19:53:00 0011G00000eM9wvQAC None False 00537000004jeWMAAY 2019-11-11 17:23:34 NaN None NaN NaN NaN x NaN False NaN NaN NaN NaN 0051G000005MreQAC 2019-11-11 17:23:34 G NaN NaN None Unied Saes US NaN NaN NaN NaN None None None NaN NaN NaN Janet Yellen 0051G000005MreQAC (555) 555-5555 /services/images/phoo/0031G00000q9jPQAQ NaN NaN 2019-11-11 17:23:34 Daa Science Direcor False False NaN NaN NaN False NaN False NaN False None NaN NaN NaN NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN False NaN False NaN NaN None NaN NaN NaN NaN NaN oominfo Aemping Conac NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN convered - new accoun NaN NaN NaN NaN False NaN NaN NaN NaN NaN NaN NaN NaN NaN None NaN NaN NaN NaN NaN NaN NaN None NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
2 0031G00000rfAvuQAE 2019-04-04 17:44:47 0011G00000f8NwQAU None False 00537000004jeWMAAY 2019-11-11 17:23:34 NaN None NaN NaN NaN x NaN False NaN NaN NaN NaN 0051G000005MreQAC 2019-11-11 17:23:34 G NaN NaN None Unied Saes US NaN NaN NaN NaN None None None NaN NaN NaN Jerome Powell 0051G000005MreQAC None /services/images/phoo/0031G00000rfAvuQAE NaN NaN 2019-11-11 17:23:34 Direcor, Business Insighs & Sraegy False False NaN NaN NaN False NaN False NaN False None NaN NaN NaN NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN False NaN False NaN NaN None NaN NaN NaN NaN NaN Vendor Lis Aemping Conac NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN convered NaN NaN NaN NaN False NaN NaN NaN False False NaN NaN False False Buy our things. NaN NaN False False NaN NaN NaN ryProspec NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
3 0031G00000qAfq1QAC 2019-01-03 19:53:01 0011G00000eNyiXQAS a2G1G000000pJs8UAE NaN 00537000004jeWMAAY 2019-11-11 17:23:34 NaN hi@google.com NaN NaN NaN x NaN False NaN NaN NaN NaN 0051G000005MreQAC 2019-11-11 17:23:34 G NaN NaN Chicago Unied Saes US NaN NaN NaN 55555.0 Illinois IL 123 Ave NaN NaN NaN Jerome 0051G000005MreQAC (555) 555-5555 /services/images/phoo/0031G00000qAfq1QAC NaN NaN 2019-11-11 17:23:34 Markeing Direcor False False NaN NaN NaN False NaN False NaN False Salesforce Creaed NaN NaN NaN NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN False NaN False NaN NaN hp://pi.pardo.com/prospec/read?id=396093715 NaN NaN NaN NaN NaN oominfo Aemping Conac NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN convered NaN NaN NaN NaN False NaN NaN NaN False False NaN NaN False False Buy more. NaN NaN NaN NaN NaN NaN NaN None NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

sf_contact_history_data (first 100 rows)

_fivetran_active _fivetran_start _fivetran_end id _fivetran_synced account_id email first_name is_deleted last_activity_date last_modified_by_id last_modified_date last_name last_referenced_date last_viewed_date mailing_city mailing_country mailing_country_code mailing_postal_code mailing_state mailing_street master_record_id mobile_phone name owner_id phone reports_to_id title lead_source description individual_id home_phone
0 True 2020-07-07 12:51:56 9999-12-31 23:59:59 0033700000JmrFPAA 2017-08-24 12:51:56 None None None NaN 2020-07-07 00:00:00 None 2019-11-11 17:23:34 None NaN 2020-08-07 00:00:00 None None None NaN None None NaN NaN None None None NaN None None None NaN NaN
1 True 2018-11-12 19:53:00 9999-12-31 23:59:59 0031G00000q9jPQAQ 2018-11-12 19:53:00 0011G00000eM9wvQAC None x NaN 2018-11-12 19:53:00 0051G000005MreQAC 2019-11-11 17:23:34 G NaN 2018-11-13 19:53:00 None Unied Saes US NaN None None NaN NaN Janet Yellen 0051G000005MreQAC (555) 555-5555 NaN Daa Science Direcor oominfo None NaN NaN
2 True 2019-04-04 17:44:47 9999-12-31 23:59:59 0031G00000rfAvuQAE 2019-04-04 17:44:47 0011G00000f8NwQAU None x NaN 2019-04-04 17:44:47 0051G000005MreQAC 2019-11-11 17:23:34 G NaN 2019-04-13 17:44:47 None Unied Saes US NaN None None NaN NaN Jerome Powell 0051G000005MreQAC None NaN Direcor, Business Insighs & Sraegy Vendor Lis Buy our things. NaN NaN
3 True 2019-01-03 19:53:01 9999-12-31 23:59:59 0031G00000qAfq1QAC 2019-01-03 19:53:01 0011G00000eNyiXQAS hi@google.com x NaN 2019-01-03 19:53:01 0051G000005MreQAC 2019-11-11 17:23:34 G NaN 2019-01-13 19:53:01 Chicago Unied Saes US 55555.0 Illinois 123 Ave NaN NaN Jerome 0051G000005MreQAC (555) 555-5555 NaN Markeing Direcor oominfo Buy more. NaN NaN

sf_event_data (first 100 rows)

id _fivetran_synced account_id activity_date activity_date_time created_by_id created_date description duration_in_minutes end_date_time event_subtype group_event_type invitee_uuid_c is_child is_deleted is_group_event is_private is_recurrence is_reminder_set last_modified_by_id last_modified_date location no_show_c owner_id recurrence_activity_id recurrence_day_of_month recurrence_day_of_week_mask recurrence_end_date_only recurrence_instance recurrence_interval recurrence_month_of_year recurrence_start_date_time recurrence_time_zone_sid_key recurrence_type referral_account_c referral_contact_c reminder_date_time show_as start_date_time subject system_modstamp type what_count what_id who_count who_id first_meeting_held_c associated_sdr_c first_meeting_c call_recording_c affectlayer_chorus_call_id_c affectlayer_affect_layer_call_id_c last_rep_activity_date_c lid_url_c lid_date_sent_c sales_loft_step_id_c sales_loft_step_name_c sales_loft_step_type_c sales_loft_email_template_id_c sales_loft_external_identifier_c sales_loft_cadence_id_c sales_loft_clicked_count_c sales_loft_cadence_name_c sales_loft_reply_count_c call_disposition_c sales_loft_email_template_title_c sales_loft_step_day_new_c call_disposition_2_c sales_loft_viewed_count_c sales_loft_1_sales_loft_step_day_c sales_loft_1_sales_loft_clicked_count_c sales_loft_1_sales_loft_view_count_c sales_loft_1_call_disposition_c sales_loft_1_sales_loft_replies_count_c sales_loft_1_sales_loft_cadence_name_c sales_loft_1_call_sentiment_c sales_loft_1_sales_loft_email_template_title_c is_recurrence_2 is_recurrence_2_exception is_recurrence_2_exclusion recurrence_2_pattern_start_date recurrence_2_pattern_text recurrence_2_pattern_time_zone recurrence_2_pattern_version co_selling_activity_c is_a_co_sell_activity_c partner_contact_c description_c campaign_c event_name_c partner_account_c topic_c attendance_number_c partner_activity_type_c how_did_you_bring_value_or_create_trust_c proof_of_referral_c how_did_you_bring_value_or_earn_trust_c duration_in_minutes_c vidyard_c collections_hold_c execute_collections_plan_activity_c expected_payment_date_c end_date opportunity_c meeting_type_c meeting_name_c bizible_2_bizible_id_c bizible_2_bizible_touchpoint_date_c assigned_to_role_c assigned_to_name_c legacy_hvr_id_c is_archived _fivetran_active
0 00U1G00000DEaypUAD 2019-11-11 17:23:34 0011G00000eLwuWQAS 2019-11-11 17:23:34 2019-11-11 17:23:34 0051G000007Ez4XQAS 2019-11-11 17:23:34 description 15 2019-11-11 17:23:34 Event 1.0 NaN False False True False False False 0051G000007Ez4XQAS 2019-11-11 17:23:34 NaN False 0051G000007Ez4XQAS NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Busy 2019-11-11 17:23:34 subject 2019-11-11 17:23:34 Call 1 0011G00000eLwuWQAS 1 0031G00001Pji7ZQAR NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN False NaN
1 00U1G00000DEaxXUAT 2019-11-11 17:23:34 0011G00000gXz9HQAS 2019-11-11 17:23:34 2019-11-11 17:23:34 0051G000007EpSPQA0 2019-11-11 17:23:34 description 30 2019-11-11 17:23:34 Event 1.0 NaN False False True False False False 0051G000007EpSPQA0 2019-11-11 17:23:34 NaN False 0051G000007EpSPQA0 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Busy 2019-11-11 17:23:34 subject 2019-11-11 17:23:34 Call 0 None 1 0031G00000xRXHBQA4 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN False NaN
2 00U1G00000DEQNmUAP 2019-11-11 17:23:34 0011G00000f8MOkQAM 2019-11-11 17:23:34 2019-11-11 17:23:34 0051G0000060zsHQAQ 2019-11-11 17:23:34 description 30 2019-11-11 17:23:34 Event NaN NaN False False False False False False 0051G0000060zsHQAQ 2019-11-11 17:23:34 NaN False 0051G000007F8lCQAS NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Busy 2019-11-11 17:23:34 subject 2019-11-11 17:23:34 Meeting 0 None 1 0031G00001QY4G5QAL NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN False NaN
3 00U1G00000DEQP2UAP 2019-11-11 17:23:34 0011G00000vVDWsQAO 2019-11-11 17:23:34 2019-11-11 17:23:34 0051G0000060zsHQAQ 2019-11-11 17:23:34 description 30 2019-11-11 17:23:34 Event NaN NaN False False False False False False 0051G0000060zsHQAQ 2019-11-11 17:23:34 NaN False 0051G000007F8lCQAS NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Busy 2019-11-11 17:23:34 subject 2019-11-11 17:23:34 Meeting 0 None 1 0031G00001QXl7WQAT NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN False NaN
4 00U1G00000DEQYxUAP 2019-11-11 17:23:34 0011G00000vVSANQA4 2019-11-11 17:23:34 2019-11-11 17:23:34 0051G000007F94iQAC 2019-11-11 17:23:34 description 15 2019-11-11 17:23:34 Event 1.0 NaN False False True False False False 0051G000007F94iQAC 2019-11-11 17:23:34 NaN False 0051G000007F94iQAC NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Busy 2019-11-11 17:23:34 subject 2019-11-11 17:23:34 Call 1 0011G00000vVSANQA4 1 0031G00001QY6c0QAD NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN False NaN
5 00U1G00000DEQYEUA5 2019-11-11 17:23:34 0011G00000vVS79QAG 2019-11-11 17:23:34 2019-11-11 17:23:34 0051G000007F94iQAC 2019-11-11 17:23:34 description 15 2019-11-11 17:23:34 Event 1.0 NaN False False True False False False 0051G000007F94iQAC 2019-11-11 17:23:34 NaN False 0051G000007F94iQAC NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Busy 2019-11-11 17:23:34 subject 2019-11-11 17:23:34 Call 1 0011G00000vVS79QAG 1 0031G00001QY5TTQA1 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN False NaN
6 00U1G00000DEQL7UAP 2019-11-11 17:23:34 0013700000JwwRJAAZ 2019-11-11 17:23:34 2019-11-11 17:23:34 0051G0000060zsHQAQ 2019-11-11 17:23:34 description 30 2019-11-11 17:23:34 Event NaN NaN False False False False False False 0051G0000060zsHQAQ 2019-11-11 17:23:34 NaN False 0051G000007F8lCQAS NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Busy 2019-11-11 17:23:34 subject 2019-11-11 17:23:34 Meeting 0 None 1 0031G00001QY3kmQAD NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN False NaN
7 00U1G00000DEQM0UAP 2019-11-11 17:23:34 0011G00000gX8tDQAS 2019-11-11 17:23:34 2019-11-11 17:23:34 0051G0000060zsHQAQ 2019-11-11 17:23:34 description 15 2019-11-11 17:23:34 Event NaN NaN False False False False False False 0051G000007F2JGQA0 2019-11-11 17:23:34 NaN False 0051G000007F94iQAC NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Busy 2019-11-11 17:23:34 subject 2019-11-11 17:23:34 Meeting 0 None 1 0031G00001QXdxXQAT NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN False NaN
8 00U1G00000DEQLvUAP 2019-11-11 17:23:34 0011G00000vVPbgQAG 2019-11-11 17:23:34 2019-11-11 17:23:34 0051G000007F94iQAC 2019-11-11 17:23:34 description 15 2019-11-11 17:23:34 Event 1.0 NaN False False True False False False 0051G000007F94iQAC 2019-11-11 17:23:34 NaN False 0051G000007F94iQAC NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Busy 2019-11-11 17:23:34 subject 2019-11-11 17:23:34 Call 1 0011G00000vVPbgQAG 1 0031G00001QXbgEQAT NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN False NaN
9 00U1G00000DEQMtUAP 2019-11-11 17:23:34 0011G00000vVPhAQAW 2019-11-11 17:23:34 2019-11-11 17:23:34 0051G000007F94iQAC 2019-11-11 17:23:34 description 15 2019-11-11 17:23:34 Event 1.0 NaN False False True False False False 0051G000007F94iQAC 2019-11-11 17:23:34 NaN False 0051G000007F94iQAC NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Busy 2019-11-11 17:23:34 subject 2019-11-11 17:23:34 Call 1 0011G00000vVPhAQAW 1 0031G00001QXeBJQA1 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False False NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN False NaN

sf_lead_data (first 100 rows)

country email_bounced_reason email_bounced_date owner_id secondary_email_c lead_source converted_date last_modified_date master_record_id last_modified_by_id system_modstamp geocode_accuracy converted_contact_id up_region_c id photo_url state longitude last_referenced_date up_district_c last_activity_date country_code phone mc_4_sf_mc_subscriber_c name jigsaw_contact_id lead_source_detail_c created_by_id salutation is_converted state_code is_unread_by_owner status city latitude cbit_clearbit_c industry title _fivetran_synced last_viewed_date converted_opportunity_id is_deleted street company first_name email website last_name number_of_employees up_territory_c created_date gclid_c active_in_sequence_c postal_code cbit_clearbit_ready_c has_opted_out_of_email converted_account_id mobile_phone calendly_created_c account_c all_connectors_c all_data_warehouses_c bi_tools_c competitors_c annual_revenue connectors_products_c contact_c data_warehouse_products_c notes_c timeframe_c account_all_products_c account_bi_tools_c account_data_warehouses_c opportunity_competitors_c opportunity_products_c description referral_account_c referral_contact_c volume_in_millions_c feature_requests_c lead_number_c demo_scheduled_by_calenderly_c to_delete_c bounced_email_c email_quality_c email_quality_catchall_c old_lead_source_c email_bounced_c old_lead_source_detail_c utm_medium_c utm_source_c utm_campaign_c utm_content_c utm_term_c act_on_lead_score_c cbit_created_by_clearbit_c fivetran_user_id_c geo_state_acton_c actoncountry_c actoncity_c actoncountrycode_c actonpostalcode_c actonreferrer_c actonstate_c geo_city_c geo_country_c geo_country_code_c geo_postal_code_c geo_state_c company_type_c pi_campaign_c pi_comments_c pi_conversion_date_c pi_conversion_object_name_c pi_conversion_object_type_c pi_created_date_c pi_first_activity_c pi_first_search_term_c pi_first_search_type_c pi_first_touch_url_c pi_grade_c pi_last_activity_c pi_needs_score_synced_c pi_notes_c pi_pardot_hard_bounced_c pi_pardot_last_scored_at_c pi_score_c pi_url_c pi_utm_campaign_c pi_utm_content_c pi_utm_medium_c pi_utm_source_c pi_utm_term_c fax region_c competitor_c source_detail_c fivetran_account_stage_c fivetran_account_id_c lean_data_router_status_c lean_data_matched_lead_c lean_data_routing_action_c lean_data_search_index_c lean_data_reporting_matched_account_c lean_data_reporting_timestamp_c lean_data_ld_segment_c lean_data_marketing_sys_created_date_c lean_data_matched_account_c lean_data_a_2_b_account_c lean_data_search_c lean_data_routing_status_c lean_data_a_2_b_group_c lean_data_matched_buyer_persona_c lean_data_tag_c lean_data_status_info_c lean_data_modified_score_c do_not_route_lead_c partner_type_c allbound_id_c lid_linked_in_company_id_c lid_linked_in_member_token_c lean_data_re_route_c sales_loft_1_most_recent_cadence_next_step_due_date_c sales_loft_1_most_recent_last_completed_step_c sales_loft_1_most_recent_cadence_name_c network_c matchtype_c device_c creative_c adgroupid_c keyword_c campaignid_c partner_rep_email_c partner_rep_name_c lead_type_c contact_stage_c original_utm_campaign_c original_utm_content_c original_utm_medium_c original_utm_source_c original_utm_term_c es_app_esalexa_rank_c es_app_esaudience_names_c es_app_escity_c es_app_escompany_phone_c es_app_escountry_c es_app_escreated_timestamp_c es_app_esecid_c es_app_esemployees_c es_app_esenriched_c es_app_esenriched_timestamp_c es_app_esfacebook_c es_app_esindustry_c es_app_esintent_aggregate_score_c es_app_esintent_timestamp_c es_app_esintent_topics_c es_app_eskeywords_c es_app_eslinked_in_c es_app_esoverall_fit_score_c es_app_esrevenue_c es_app_essource_c es_app_esstate_c es_app_esstreet_c es_app_estechnologies_c es_app_estwitter_c es_app_eszipcode_c marketing_prospect_routing_rules_c individual_id marketing_process_c automation_tracking_c user_gems_has_changed_job_c user_gems_linked_in_c email_opt_in_c email_opt_in_explicit_c email_opt_in_implicit_c gdpr_opt_in_explicit_c user_gems_is_a_user_gem_c user_gems_past_account_c user_gems_past_company_c user_gems_past_contact_c user_gems_past_title_c promotion_id_c previous_customer_c referral_contact_email_c referral_firstname_c referral_last_name_c mkto_71_lead_score_c mkto_71_acquisition_date_c mkto_71_acquisition_program_id_c mkto_acquisition_program_c mkto_71_inferred_city_c mkto_71_inferred_company_c mkto_71_inferred_country_c mkto_71_inferred_metropolitan_area_c mkto_71_inferred_phone_area_code_c mkto_71_inferred_postal_code_c mkto_71_inferred_state_region_c mkto_71_original_referrer_c mkto_71_original_search_engine_c mkto_71_original_search_phrase_c mkto_71_original_source_info_c mkto_71_original_source_type_c mkto_si_hide_date_c mkto_si_last_interesting_moment_date_c mkto_si_last_interesting_moment_desc_c mkto_si_last_interesting_moment_source_c mkto_si_last_interesting_moment_type_c mkto_si_msicontact_id_c mkto_si_priority_c mkto_si_relative_score_value_c mkto_si_urgency_value_c cloudingo_agent_ar_c cloudingo_agent_ardi_c cloudingo_agent_as_c cloudingo_agent_atz_c cloudingo_agent_av_c cloudingo_agent_les_c do_not_sync_marketo_c source_every_utm_campaign_c source_every_utm_content_c source_every_utm_medium_c source_every_utm_source_c source_every_utm_term_c source_first_utm_campaign_c source_first_utm_content_c source_first_utm_medium_c source_first_utm_source_c source_first_utm_term_c source_last_utm_campaign_c source_last_utm_content_c source_last_utm_medium_c source_last_utm_source_c source_last_utm_term_c direct_office_c city_c country_c state_c source_first_lead_source_category_c source_last_lead_source_c source_last_lead_source_category_c source_last_lead_source_detail_c source_every_lead_source_c source_every_lead_source_category_c source_every_lead_source_detail_c source_first_lead_source_c source_first_lead_source_detail_c behavioral_score_c demographic_score_c drift_cql_c unique_email_c is_emea_event_routing_c csi_code_c csi_description_c converted_date_time_c lead_created_date_time_reporting_c lead_iq_country_c lead_iq_employee_count_c lead_iq_employee_range_c lead_iq_state_c lead_iq_zip_code_c zoominfo_country_c zoominfo_employee_count_c zoominfo_state_c zoominfo_technologies_c zoominfo_zip_code_c attended_event_c mql_date_c user_gems_user_gems_id_c dozisf_zoom_info_company_id_c dozisf_zoom_info_first_updated_c dozisf_zoom_info_id_c dozisf_zoom_info_last_updated_c lean_data_manual_route_trigger_c first_mql_date_c fivetran_account_association_date_c fivetran_account_user_role_s_c mql_reason_c trial_contact_start_date_c enrichment_request_c meta_data_create_date_c clarus_date_c clarus_editor_c clarus_notes_c clarus_project_c clarus_status_c marketing_connector_interest_c recent_marketing_campaign_status_c salesloft_cadence_trigger_c datawarehouse_used_c contact_status_c leandata_contact_owner_override_c potential_fivetran_use_case_c bizible_2_account_c bizible_2_ad_campaign_name_ft_c bizible_2_ad_campaign_name_lc_c bizible_2_bizible_id_c bizible_2_landing_page_ft_c bizible_2_landing_page_lc_c bizible_2_marketing_channel_ft_c bizible_2_marketing_channel_lc_c bizible_2_touchpoint_date_ft_c bizible_2_touchpoint_date_lc_c bizible_2_touchpoint_source_ft_c bizible_2_touchpoint_source_lc_c sales_email_opt_out_c sales_email_opt_out_date_time_c bombora_app_bombora_surge_record_count_c bombora_app_bombora_last_date_time_updated_c bombora_app_bombora_total_composite_score_c linked_in_url_c beta_connector_interest_c user_gems_ug_past_infos_c user_gems_ug_current_infos_c user_gems_ug_created_by_ug_c free_trial_email_confirmed_date_c dnboptimizer_dn_bcontact_record_c dnboptimizer_dn_bcompany_record_c dnboptimizer_dnb_d_u_n_s_number_c i_sell_oskey_id_c verified_c email_opt_out_date_time_c pbf_startup_c pbf_startup_certify_eligibility_c engagio_intent_minutes_last_30_days_c engagio_engagement_minutes_last_3_months_c engagio_engagement_minutes_last_7_days_c engagio_matched_account_c engagio_first_engagement_date_c engagio_match_time_c engagio_department_c engagio_role_c legacy_hvr_id_c hvr_channel_c email_opt_in_double_c phone_number_catch_all_c contacts_domain_exists_c utm_id_c source_every_utm_id_c source_last_utm_id_c source_first_utm_id_c do_not_sync_reason_marketo_c _fivetran_active
0 NaN NaN NaN 00537000003tmTnAAI NaN NaN 2019-11-11 17:23:34 2019-11-11 17:23:34 NaN 0051G000007F2JGQA0 2019-11-11 17:23:34 NaN 0031G00001QtDPlQAN NaN 00Q1G00000nDnM5UAK /services/images/photo/00Q1G00000nDnM5UAK NaN NaN NaN NaN NaN NaN NaN NaN h NaN NaN 0051G0000060XhiQAE NaN True NaN False Converted NaN NaN NaN Internet Software & Services NaN 2019-11-11 17:23:34 NaN NaN False NaN Z H h@gmail.com NaN Croc NaN NaN 2019-11-11 17:23:34 NaN False NaN False False 0011G00000tLWKnQAO NaN NaN NaN NaN NaN NaN NaN 280522000 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 0 NaN 1305025 False False NaN False NaN NaN False NaN NaN NaN NaN NaN NaN NaN False NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False NaN NaN NaN NaN NaN converted geomecyvdvhj amazon 0011G00000fV7vHQAS 2019-11-11 17:23:34 NaN NaN NaN NaN NaN converted NaN NaN NaN NaN NaN False NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Prospect NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False NaN NaN NaN NaN NaN NaN True False False False NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 2019-11-11 17:23:34 Metadata Lead Conversion - 04 ADS-2022-MetadataADS-Q1Y22-EMEA-DACH-ETLTools Lead action Milestone NaN 60 NaN 3 NaN NaN 0 NaN NaN 0 False NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Q122-EMEA-DACH-ETLTools_SFDC LinkedIn paid_social metadata Q122 EMEA_Germany-SFDC NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 0 NaN NaN NaN False NaN RAW 2019-11-11 17:23:34 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False NaN NaN NaN NaN NaN NaN False NaN NaN NaN Website NaN False 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Unknown NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False NaN NaN NaN NaN NaN NaN NaN NaN False NaN NaN NaN NaN NaN False NaN NaN False NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False NaN NaN NaN NaN NaN NaN NaN NaN

sf_opportunity_data (first 100 rows)

_fivetran_synced account_id amount campaign_id close_date created_date description expected_revenue fiscal fiscal_quarter fiscal_year forecast_category forecast_category_name has_open_activity has_opportunity_line_item has_overdue_task id is_closed is_deleted is_excluded_from_territory_2_filter is_won last_activity_date last_referenced_date last_viewed_date lead_source name next_step owner_id pricebook_2_id probability record_type_id stage_name synced_quote_id territory_2_id type _fivetran_active
0 2019-04-04 18:47:01 9CcfAt8qtZvCTwFvwOFLcg== 24120000.0 NaN 2018-12-19 00:00:00 2018-12-19 19:51:13 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 A/SkeDD5c3ejUyEFFoUHHg== A/SkeDD5c3ejUyEFFoUHHg== False True False 006q000000HddohAAB True True NaN True NaN NaN NaN TDK+SgtPSM3Vk67zX9aeRA== $1m deal NaN rQhle3uwQbFgFmLTF1WByg== lNUPfU1ue2nQimeN6QVNKQ== 1000 3QOHd+Q7F28PJtnwztV09Q== GavUFuuf4DrnQAoiRGlWpQ== NaN NaN +Gkf6SQ2fhAONAiFelNKVw== True
1 2019-04-04 18:47:01 wfQo3+JVfsNIdcz/mUkZkA== NaN NaN 2018-12-18 00:00:00 2018-12-18 21:21:17 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 A/SkeDD5c3ejUyEFFoUHHg== A/SkeDD5c3ejUyEFFoUHHg== False False False 006q000000HdPzpAAF True True NaN True NaN NaN NaN Fbu50LvyXo0peN4RaMdJ3A== Testing Opp Close NaN nqxS50kwRjtOYb9ZB4/PoQ== None 100 3QOHd+Q7F28PJtnwztV09Q== GavUFuuf4DrnQAoiRGlWpQ== NaN NaN +Gkf6SQ2fhAONAiFelNKVw== True
2 2018-12-18 18:20:30.829 wIXkC/s93lDAT+HVkwv6+A== NaN NaN 2018-12-18 00:00:00 2018-12-10 17:03:22 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 A/SkeDD5c3ejUyEFFoUHHg== A/SkeDD5c3ejUyEFFoUHHg== False False False 006q000000Hbmd1AAB True True NaN True NaN NaN NaN TDK+SgtPSM3Vk67zX9aeRA== Test NaN dVDxbGz10nJ2mKU213GZRQ== None 100 14mxIBMk0YX2Gz0r1Ktsuw== GavUFuuf4DrnQAoiRGlWpQ== NaN NaN +Gkf6SQ2fhAONAiFelNKVw== True
3 2019-04-04 18:47:01 78HpxISq4/eSw+ycDPqSwA== NaN NaN 2018-12-13 00:00:00 2018-12-13 18:02:55 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 A/SkeDD5c3ejUyEFFoUHHg== A/SkeDD5c3ejUyEFFoUHHg== False False False 006q000000HcZXrAAN True True NaN True NaN NaN NaN pOz8cFdDlJkM8XvYPfSZ9w== lu test 3 NaN 9B1r0vK1wAVGaERpMleKGg== None 100 14mxIBMk0YX2Gz0r1Ktsuw== GavUFuuf4DrnQAoiRGlWpQ== NaN NaN +Gkf6SQ2fhAONAiFelNKVw== True
4 2019-04-04 18:47:01 wfQo3+JVfsNIdcz/mUkZkA== NaN NaN 2018-12-07 00:00:00 2018-12-19 20:22:58 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 A/SkeDD5c3ejUyEFFoUHHg== A/SkeDD5c3ejUyEFFoUHHg== False False False 006q000000HddueAAB True True NaN True NaN NaN NaN dSJC2EuRkC62f+UuBPQeVg== Chewbaca NaN nqxS50kwRjtOYb9ZB4/PoQ== None 100 3QOHd+Q7F28PJtnwztV09Q== GavUFuuf4DrnQAoiRGlWpQ== NaN NaN dSJC2EuRkC62f+UuBPQeVg== True
5 2019-04-04 18:47:01 TK5MTSsiOYoDQoJiSbkugA== 200000.0 NaN 2018-11-21 00:00:00 2018-11-14 19:12:53 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 AloDHjNI+wntE4Eetriz+w== AloDHjNI+wntE4Eetriz+w== False False False 006q000000HK8jdAAD True True NaN False NaN NaN NaN MfuqnemFQBY2RwqM7YBkKA== Evergreen Test NaN QEaGoY7B8nGfro2vhOCMvA== None 0 14mxIBMk0YX2Gz0r1Ktsuw== tXi3M8u3iPxq0ggxTSxMKw== NaN NaN +Gkf6SQ2fhAONAiFelNKVw== True
6 2019-04-04 18:47:01 78HpxISq4/eSw+ycDPqSwA== NaN NaN 2018-12-13 00:00:00 2018-12-13 18:00:11 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 AloDHjNI+wntE4Eetriz+w== AloDHjNI+wntE4Eetriz+w== False False False 006q000000HcZXXAA3 True True NaN False NaN NaN NaN UN2fttk8geFc7Db/xJzQ+A== lu test 1 NaN 9B1r0vK1wAVGaERpMleKGg== None 0 14mxIBMk0YX2Gz0r1Ktsuw== tXi3M8u3iPxq0ggxTSxMKw== NaN NaN +Gkf6SQ2fhAONAiFelNKVw== False
7 2019-04-04 18:47:01 tZX+Z0iWzZHHjNvRnCJzwg== 1.0 NaN 2018-10-31 00:00:00 2018-10-31 17:43:42 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 AloDHjNI+wntE4Eetriz+w== AloDHjNI+wntE4Eetriz+w== False False False 006q000000GoP76AAF True True NaN False NaN NaN NaN None Blue Test - NaN TLZtnkcZltX8lijWYSQqRg== None 0 14mxIBMk0YX2Gz0r1Ktsuw== tXi3M8u3iPxq0ggxTSxMKw== NaN NaN +Gkf6SQ2fhAONAiFelNKVw== True
8 2019-04-04 18:47:01 78HpxISq4/eSw+ycDPqSwA== NaN NaN 2018-12-13 00:00:00 2018-12-13 18:01:22 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 AloDHjNI+wntE4Eetriz+w== AloDHjNI+wntE4Eetriz+w== False False False 006q000000HcZXcAAN True True NaN False NaN NaN NaN pOz8cFdDlJkM8XvYPfSZ9w== lu test 2 NaN AwxR76rxgr77EfSnTHH57Q== None 0 14mxIBMk0YX2Gz0r1Ktsuw== tXi3M8u3iPxq0ggxTSxMKw== NaN NaN 9Q0PuStPWLYgxG/8kpvo5g== True
9 2019-04-04 18:47:01 wIXkC/s93lDAT+HVkwv6+A== 210000.0 NaN 2018-12-19 00:00:00 2018-12-18 17:56:05 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 rq6uxRtOa4gSLxCtlqjecg== rq6uxRtOa4gSLxCtlqjecg== False True False 006q000000HdOhuAAF False True NaN False NaN NaN NaN Fbu50LvyXo0peN4RaMdJ3A== Testing Order from Process NaN dVDxbGz10nJ2mKU213GZRQ== 5x2qfGToAOo3bmSNM8fPjg== 65 3QOHd+Q7F28PJtnwztV09Q== 9RN9J3tlxr89gDctReax5w== NaN NaN +Gkf6SQ2fhAONAiFelNKVw== False

sf_opportunity_history_data (first 100 rows)

_fivetran_active _fivetran_start _fivetran_end _fivetran_synced account_id amount campaign_id close_date created_date description expected_revenue fiscal fiscal_quarter fiscal_year forecast_category forecast_category_name has_open_activity has_opportunity_line_item has_overdue_task id is_closed is_deleted is_won last_activity_date last_referenced_date last_viewed_date lead_source name next_step owner_id probability record_type_id stage_name synced_quote_id type
0 True 2019-10-17 21:10:19 9999-12-31 23:59:59 2019-04-04 18:47:01 9CcfAt8qtZvCTwFvwOFLcg== 24120000.0 NaN 2018-12-19 00:00:00 2018-12-19 19:51:13 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 A/SkeDD5c3ejUyEFFoUHHg== A/SkeDD5c3ejUyEFFoUHHg== False True False 006q000000HddohAAB True True True NaN NaN NaN TDK+SgtPSM3Vk67zX9aeRA== $1m deal NaN rQhle3uwQbFgFmLTF1WByg== 1000 3QOHd+Q7F28PJtnwztV09Q== GavUFuuf4DrnQAoiRGlWpQ== NaN +Gkf6SQ2fhAONAiFelNKVw==
1 True 2019-10-17 21:33:00 9999-12-31 23:59:59 2019-04-04 18:47:01 wfQo3+JVfsNIdcz/mUkZkA== NaN NaN 2018-12-18 00:00:00 2018-12-18 21:21:17 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 A/SkeDD5c3ejUyEFFoUHHg== A/SkeDD5c3ejUyEFFoUHHg== False False False 006q000000HdPzpAAF True True True NaN NaN NaN Fbu50LvyXo0peN4RaMdJ3A== Testing Opp Close NaN nqxS50kwRjtOYb9ZB4/PoQ== 100 3QOHd+Q7F28PJtnwztV09Q== GavUFuuf4DrnQAoiRGlWpQ== NaN +Gkf6SQ2fhAONAiFelNKVw==
2 True 2019-04-04 18:36:08 9999-12-31 23:59:59 2018-12-18 18:20:30.829 wIXkC/s93lDAT+HVkwv6+A== NaN NaN 2018-12-18 00:00:00 2018-12-10 17:03:22 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 A/SkeDD5c3ejUyEFFoUHHg== A/SkeDD5c3ejUyEFFoUHHg== False False False 006q000000Hbmd1AAB True True True NaN NaN NaN TDK+SgtPSM3Vk67zX9aeRA== Test NaN dVDxbGz10nJ2mKU213GZRQ== 100 14mxIBMk0YX2Gz0r1Ktsuw== GavUFuuf4DrnQAoiRGlWpQ== NaN +Gkf6SQ2fhAONAiFelNKVw==
3 True 2019-04-04 18:36:08 9999-12-31 23:59:59 2019-04-04 18:47:01 78HpxISq4/eSw+ycDPqSwA== NaN NaN 2018-12-13 00:00:00 2018-12-13 18:02:55 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 A/SkeDD5c3ejUyEFFoUHHg== A/SkeDD5c3ejUyEFFoUHHg== False False False 006q000000HcZXrAAN True True True NaN NaN NaN pOz8cFdDlJkM8XvYPfSZ9w== lu test 3 NaN 9B1r0vK1wAVGaERpMleKGg== 100 14mxIBMk0YX2Gz0r1Ktsuw== GavUFuuf4DrnQAoiRGlWpQ== NaN +Gkf6SQ2fhAONAiFelNKVw==
4 True 2019-04-04 18:36:08 9999-12-31 23:59:59 2019-04-04 18:47:01 wfQo3+JVfsNIdcz/mUkZkA== NaN NaN 2018-12-07 00:00:00 2018-12-19 20:22:58 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 A/SkeDD5c3ejUyEFFoUHHg== A/SkeDD5c3ejUyEFFoUHHg== False False False 006q000000HddueAAB True True True NaN NaN NaN dSJC2EuRkC62f+UuBPQeVg== Chewbaca NaN nqxS50kwRjtOYb9ZB4/PoQ== 100 3QOHd+Q7F28PJtnwztV09Q== GavUFuuf4DrnQAoiRGlWpQ== NaN dSJC2EuRkC62f+UuBPQeVg==
5 True 2019-04-04 18:36:08 9999-12-31 23:59:59 2019-04-04 18:47:01 TK5MTSsiOYoDQoJiSbkugA== 200000.0 NaN 2018-11-21 00:00:00 2018-11-14 19:12:53 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 AloDHjNI+wntE4Eetriz+w== AloDHjNI+wntE4Eetriz+w== False False False 006q000000HK8jdAAD True True False NaN NaN NaN MfuqnemFQBY2RwqM7YBkKA== Evergreen Test NaN QEaGoY7B8nGfro2vhOCMvA== 0 14mxIBMk0YX2Gz0r1Ktsuw== tXi3M8u3iPxq0ggxTSxMKw== NaN +Gkf6SQ2fhAONAiFelNKVw==
6 False 2019-04-03 18:36:06 2019-04-04 18:36:07 2019-04-04 18:47:01 78HpxISq4/eSw+ycDPqSwA== NaN NaN 2018-12-13 00:00:00 2018-12-13 18:00:11 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 AloDHjNI+wntE4Eetriz+w== AloDHjNI+wntE4Eetriz+w== False False False 006q000000HcZXXAA3 True True False NaN NaN NaN UN2fttk8geFc7Db/xJzQ+A== lu test 1 NaN 9B1r0vK1wAVGaERpMleKGg== 0 14mxIBMk0YX2Gz0r1Ktsuw== tXi3M8u3iPxq0ggxTSxMKw== NaN +Gkf6SQ2fhAONAiFelNKVw==
7 True 2019-04-04 18:36:08 9999-12-31 23:59:59 2019-04-04 18:47:01 tZX+Z0iWzZHHjNvRnCJzwg== 1.0 NaN 2018-10-31 00:00:00 2018-10-31 17:43:42 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 AloDHjNI+wntE4Eetriz+w== AloDHjNI+wntE4Eetriz+w== False False False 006q000000GoP76AAF True True False NaN NaN NaN None Blue Test - NaN TLZtnkcZltX8lijWYSQqRg== 0 14mxIBMk0YX2Gz0r1Ktsuw== tXi3M8u3iPxq0ggxTSxMKw== NaN +Gkf6SQ2fhAONAiFelNKVw==
8 True 2019-04-04 18:36:08 9999-12-31 23:59:59 2019-04-04 18:47:01 78HpxISq4/eSw+ycDPqSwA== NaN NaN 2018-12-13 00:00:00 2018-12-13 18:01:22 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 AloDHjNI+wntE4Eetriz+w== AloDHjNI+wntE4Eetriz+w== False False False 006q000000HcZXcAAN True True False NaN NaN NaN pOz8cFdDlJkM8XvYPfSZ9w== lu test 2 NaN AwxR76rxgr77EfSnTHH57Q== 0 14mxIBMk0YX2Gz0r1Ktsuw== tXi3M8u3iPxq0ggxTSxMKw== NaN 9Q0PuStPWLYgxG/8kpvo5g==
9 False 2019-04-03 18:36:06 2019-04-04 18:36:07 2019-04-04 18:47:01 wIXkC/s93lDAT+HVkwv6+A== 210000.0 NaN 2018-12-19 00:00:00 2018-12-18 17:56:05 NaN NaN JxJ3Au0JjyhOOUE/UvIeOw== 4 2018 rq6uxRtOa4gSLxCtlqjecg== rq6uxRtOa4gSLxCtlqjecg== False True False 006q000000HdOhuAAF False True False NaN NaN NaN Fbu50LvyXo0peN4RaMdJ3A== Testing Order from Process NaN dVDxbGz10nJ2mKU213GZRQ== 65 3QOHd+Q7F28PJtnwztV09Q== 9RN9J3tlxr89gDctReax5w== NaN +Gkf6SQ2fhAONAiFelNKVw==

sf_opportunity_line_item_data (first 100 rows)

product_2_id quantity total_price description discount last_modified_date list_price product_code unit_price _fivetran_synced is_deleted opportunity_id last_modified_by_id service_date system_modstamp name id created_by_id created_date sort_order pricebook_entry_id one_saas_app_included_c one_saas_app_quantity_invoiced_c one_saas_app_quantity_not_invoiced_c has_quantity_schedule has_revenue_schedule has_schedule event_volume_c roadmap_connections_c row_volume_c months_c netsuite_conn_term_contract_pricing_type_c netsuite_conn_discount_item_c netsuite_conn_user_entered_sales_price_c netsuite_conn_item_category_c netsuite_conn_terms_c netsuite_conn_net_suite_item_key_id_c netsuite_conn_pushed_from_net_suite_c netsuite_conn_end_date_c netsuite_conn_list_rate_c netsuite_conn_from_contract_item_id_c netsuite_conn_start_date_c netsuite_conn_net_suite_item_id_import_c sbqq_parent_id_c sbqq_quote_line_c sbqq_subscription_type_c product_family_c last_referenced_date last_viewed_date celigo_sfnsio_contract_item_id_c celigo_sfnsio_contract_term_c celigo_sfnsio_end_date_c celigo_sfnsio_list_rate_c celigo_sfnsio_net_suite_line_id_c celigo_sfnsio_start_date_c product_code_stamped_c hvr_use_case_c _fivetran_active
0 01 1G000000bUE8QAM 1 0.00 NaN NaN 2019-11-11 17:23:34 0 a 0.00 2019-11-11 17:23:34 False 0061G00000Ja7B6QAJ 0051G000005MumpQAC NaN 2019-11-11 17:23:34 plan a 00k1G00000A3iyqQAB 0051G0000060rqhQAA 2019-11-11 17:23:34 NaN 01u1G000002Ks75QAC NaN NaN NaN NaN NaN NaN NaN NaN NaN 12 NaN NaN NaN NaN NaN NaN False NaN NaN NaN NaN NaN None a4R1G000000S2a6UAC X Usage NaN NaN NaN NaN NaN NaN NaN NaN NaN False NaN
1 01 1G000000bH0WQAU 6 5100.00 NaN NaN 2019-11-11 17:23:34 1000 b 850.00 2019-11-11 17:23:34 NaN 0061G00000HhviAQAR 0051G000005MumuQAC NaN 2019-11-11 17:23:34 plan b 00k1G000009ar5IQAQ 0051G000005MumuQAC 2019-11-11 17:23:34 NaN 01u1G000002Kbu5QAC NaN NaN NaN NaN NaN NaN NaN NaN NaN 12 NaN NaN NaN NaN NaN NaN False NaN NaN NaN NaN NaN None a4R1G000000XqhrUAC X None NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
2 01 1G000000bH0bQAE 50 38093.00 NaN NaN 2019-11-11 17:23:34 1500 d 761.86 2019-11-11 17:23:34 NaN 0061G00000HhviAQAR 0051G000005MumuQAC NaN 2019-11-11 17:23:34 self serve 00k1G000009a jwQAA 0051G000005MumuQAC 2019-11-11 17:23:34 NaN 01u1G000002KbuAQAS NaN NaN NaN NaN NaN NaN NaN NaN NaN 12 NaN NaN NaN NaN NaN NaN False NaN NaN NaN NaN NaN None a4R1G000000XsCJUA0 Renewable None NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
3 01 1G000000bH0bQAE 66 84250.32 NaN NaN 2019-11-11 17:23:34 1500 e 1276.52 2019-11-11 17:23:34 NaN 0061G00000HhviAQAR 0051G000005MumuQAC NaN 2019-11-11 17:23:34 sof serve 00k1G000009ar5JQAQ 0051G000005MumuQAC 2019-11-11 17:23:34 NaN 01u1G000002KbuAQAS NaN NaN NaN NaN NaN NaN NaN NaN NaN 12 NaN NaN NaN NaN NaN NaN False NaN NaN NaN NaN NaN None a4R1G000000XqhsUAC Renewable None NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
4 01 1G000000bH1NQAU 4 4000.00 NaN NaN 2019-11-11 17:23:34 1000 f 1000.00 2019-11-11 17:23:34 NaN 0061G00000HhviAQAR 0051G000005MumuQAC NaN 2019-11-11 17:23:34 sof ware 00k1G000009ar5GQAQ 0051G000005MumuQAC 2019-11-11 17:23:34 NaN 01u1G000002KbuwQAC NaN NaN NaN NaN NaN NaN NaN NaN NaN 12 NaN NaN NaN NaN NaN NaN False NaN NaN NaN NaN NaN None a4R1G000000XqhoUAC Renewable None NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
5 01 1G000000bH05QAE 18 162000.00 NaN NaN 2019-11-11 17:23:34 12000 p 9000.00 2019-11-11 17:23:34 NaN 0061G00000HhviAQAR 0051G000005MumuQAC NaN 2019-11-11 17:23:34 plan d 00k1G000009ar5HQAQ 0051G000005MumuQAC 2019-11-11 17:23:34 NaN 01u1G000002KbvfQAC NaN NaN NaN NaN NaN NaN NaN NaN NaN 12 NaN NaN NaN NaN NaN NaN False NaN NaN NaN NaN NaN None a4R1G000000XqhqUAC Renewable None NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
6 01 1G000000bH pQAE 1 0.00 NaN NaN 2019-11-11 17:23:34 0 l 0.00 2019-11-11 17:23:34 NaN 0061G00000Is1 QAJ 0051G000005MumuQAC NaN 2019-11-11 17:23:34 plan e 00k1G000009al6CQAQ 0051G000005MumuQAC 2019-11-11 17:23:34 NaN 01u1G000002Kc PQAS NaN NaN NaN NaN NaN NaN NaN NaN NaN 12 NaN NaN NaN NaN NaN NaN False NaN NaN NaN NaN NaN None a4R1G000000Xr kUAK Renewable None NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
7 01 1G000000bH pQAE 1 0.00 NaN NaN 2019-11-11 17:23:34 0 m 0.00 2019-11-11 17:23:34 NaN 0061G00000HhviAQAR 0051G000005MumuQAC NaN 2019-11-11 17:23:34 plan f 00k1G000009aYhMQAU 0051G000005MumuQAC 2019-11-11 17:23:34 NaN 01u1G000002Kc PQAS NaN NaN NaN NaN NaN NaN NaN NaN NaN 12 NaN NaN NaN NaN NaN NaN False NaN NaN NaN NaN NaN None a4R1G000000XqhmUAC Renewable None NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
8 01 1G000000bH pQAE 1 0.00 NaN NaN 2019-11-11 17:23:34 0 n 0.00 2019-11-11 17:23:34 NaN 0061G00000IsgqwQAB 0051G000005MumuQAC NaN 2019-11-11 17:23:34 plan g 00k1G000009auVBQAY 0051G000005MumuQAC 2019-11-11 17:23:34 NaN 01u1G000002Kc PQAS NaN NaN NaN NaN NaN NaN NaN NaN NaN 12 NaN NaN NaN NaN NaN NaN False NaN NaN NaN NaN NaN None a4R1G000000XsYWUA0 Renewable None NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
9 01 1G000000bH0yQAE 1 2045.45 NaN NaN 2019-11-11 17:23:34 2000 s 2045.45 2019-11-11 17:23:34 NaN 0061G00000I L0vQAF 0051G000005MumuQAC NaN 2019-11-11 17:23:34 plan h 00k1G000009b6cCQAQ 0051G000005MumuQAC 2019-11-11 17:23:34 NaN 01u1G000002Kc qQAC NaN NaN NaN NaN NaN NaN NaN NaN NaN 12 NaN NaN NaN NaN NaN NaN False NaN NaN NaN NaN NaN 00k1G000009b6cAQAQ a4R1G000000X xmUAC Renewable None NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

sf_order_data (first 100 rows)

id _fivetran_synced account_id activated_by_id activated_date billing_city billing_country billing_country_code billing_geocode_accuracy billing_latitude billing_longitude billing_postal_code billing_state billing_state_code billing_street company_authorized_by_id contract_id created_by_id created_date customer_authorized_by_id description effective_date end_date is_deleted is_reduction_order last_modified_by_id last_modified_date last_referenced_date last_viewed_date order_number original_order_id owner_id pricebook_2_id shipping_city shipping_country shipping_country_code shipping_geocode_accuracy shipping_latitude shipping_longitude shipping_postal_code shipping_state shipping_state_code shipping_street status status_code system_modstamp total_amount type netsuite_conn_celigo_update_c netsuite_conn_net_suite_id_c netsuite_conn_net_suite_sync_err_c netsuite_conn_pushed_from_net_suite_c netsuite_conn_opportunity_c netsuite_conn_net_suite_order_status_c netsuite_conn_sync_in_progress_c netsuite_conn_tax_total_c netsuite_conn_tracking_numbers_c netsuite_conn_push_to_net_suite_c netsuite_conn_document_id_c netsuite_conn_subtotal_c netsuite_conn_discount_total_c netsuite_conn_total_c netsuite_conn_net_suite_order_date_c netsuite_conn_ship_date_c netsuite_conn_quote_c netsuite_conn_net_suite_order_number_c sbqq_contracted_c sbqq_contracting_method_c sbqq_payment_term_c sbqq_price_calc_status_c sbqq_price_calc_status_message_c sbqq_quote_c sbqq_renewal_term_c sbqq_renewal_uplift_rate_c ava_sfcpq_ava_tax_message_c ava_sfcpq_entity_use_code_c ava_sfcpq_invoice_message_c ava_sfcpq_is_seller_importer_of_record_c ava_sfcpq_order_calculate_tax_c ava_sfcpq_sales_tax_amount_c blng_bill_now_c blng_billing_account_c blng_billing_day_of_month_c blng_invoice_batch_c amendment_type_c credit_summary_c evergreen_c invoicing_type_c legal_entity_c prepaid_billing_frequency_c prepaid_order_c update_subscriptions_only_c order_auto_activated_c synced_to_net_suite_c purchase_order_number_c celigo_sfnsio_discount_total_net_suite_c celigo_sfnsio_net_suite_id_c celigo_sfnsio_net_suite_order_number_c celigo_sfnsio_net_suite_order_status_c celigo_sfnsio_net_suite_record_c celigo_sfnsio_ship_date_c celigo_sfnsio_skip_export_to_net_suite_c celigo_sfnsio_sub_total_net_suite_c celigo_sfnsio_tax_total_net_suite_c celigo_sfnsio_test_mode_record_c celigo_sfnsio_total_net_suite_c amend_with_rollover_spend_type_c customer_spend_type_c order_spend_type_c opportunity_id purchase_summary_c is_hvr_legacy_order_c ironclad_workflow_c _fivetran_active
0 8011G000000XFeOQAW 2019-11-11 17:23:34 0011G00000gY0y4QAC 0051G000005MumuQAC 2019-11-11 17:23:34 New York, NY United States NaN NaN NaN NaN USA 55555-1502 NaN 123 Ave NaN NaN 0051G000005MumuQAC 2019-11-11 17:23:34 NaN NaN 2019-11-11 17:23:34 NaN False False 0051G000005MunnQAC 2019-11-11 17:23:34 NaN NaN 5392 NaN 0051G000005MumuQAC 01s1G000001N7EKQA0 New York United States NaN NaN NaN NaN 55555 New York NaN 123 Ave Activated Activated 2019-11-11 17:23:34 0.0 New False 934887.0 NaN False NaN None False NaN NaN False NaN NaN NaN NaN 2019-11-11 17:23:34 NaN NaN SO4866 True By Subscription End Date Net 30 Not Needed NaN a4V1G000000TpflUAC NaN NaN Tax Amount Is Up To Date NaN NaN False False NaN False 0011G00000gY0y4QAC 1 Domestic (US) NaN None False Other a8k1G000000k9d4QAA None False False False False NaN NaN NaN None NaN None NaN False NaN NaN False NaN False NaN NaN NaN NaN NaN NaN NaN
1 8011G000000XFePQAW 2019-11-11 17:23:34 0011G00000gY0y4QAC 0051G000005MumuQAC 2019-11-11 17:23:34 New York, NY United States NaN NaN NaN NaN USA 55555-1502 NaN 123 Ave NaN NaN 0051G000005MumuQAC 2019-11-11 17:23:34 NaN NaN 2019-11-11 17:23:34 NaN False False 0051G000005MunnQAC 2019-11-11 17:23:34 NaN NaN 5393 NaN 0051G000005MumuQAC 01s1G000001N7EKQA0 New York United States NaN NaN NaN NaN 55555 New York NaN 123 Ave Activated Activated 2019-11-11 17:23:34 27998.6 New False 1058073.0 NaN False NaN Pending Approval False 2000.0 NaN False NaN 10.0 NaN 10.0 2019-11-11 17:23:34 NaN NaN SO4871 True By Subscription End Date Net 30 Not Needed NaN a4V1G000000TpflUAC NaN NaN Tax Amount Is Up To Date NaN NaN False False NaN False 0011G00000gY0y4QAC 30 Daily NaN a9e1G000000KztBQAS False Prepaid Credits a8k1G000000k9d4QAA Annual False False False False NaN NaN 1058073.0 None NaN None NaN False NaN NaN False NaN False NaN NaN NaN NaN NaN NaN NaN
2 8011G000000XDsxQAG 2019-11-11 17:23:34 0011G00000f8IrIQAU 0051G000005MumuQAC 2019-11-11 17:23:34 New York United States NaN NaN NaN NaN 55555 New York NaN 123 Ave NaN NaN 0051G000005MumuQAC 2019-11-11 17:23:34 NaN NaN 2019-11-11 17:23:34 NaN False False 0051G000005MunnQAC 2019-11-11 17:23:34 NaN NaN 2597 NaN 0051G000005MumuQAC 01s1G000001N7EKQA0 New York United States NaN NaN NaN NaN 55555 New York NaN 123 Ave Activated Activated 2019-11-11 17:23:34 0.0 New False 934740.0 NaN False NaN None False NaN NaN False NaN NaN NaN NaN 2019-11-11 17:23:34 NaN NaN SO4746 True By Subscription End Date Net 30 Not Needed NaN a4V1G000000TpGCUA0 NaN NaN Tax Amount Is Up To Date NaN NaN False False NaN False 0011G00000f8IrIQAU 1 Domestic (US) NaN None False Other a8k1G000000k9d4QAA None False False False False NaN NaN NaN None NaN None NaN False NaN NaN False NaN False NaN NaN NaN NaN NaN NaN NaN
3 8011G000000XDsyQAG 2019-11-11 17:23:34 0011G00000f8IrIQAU 0051G000005MumuQAC 2019-11-11 17:23:34 New York United States NaN NaN NaN NaN 55555 New York NaN 123 Ave NaN NaN 0051G000005MumuQAC 2019-11-11 17:23:34 NaN NaN 2019-11-11 17:23:34 NaN False False 0051G000005MunnQAC 2019-11-11 17:23:34 NaN NaN 2598 NaN 0051G000005MumuQAC 01s1G000001N7EKQA0 New York United States NaN NaN NaN NaN 55555 New York NaN 123 Ave Activated Activated 2019-11-11 17:23:34 1200.0 New False 1057821.0 NaN False NaN Pending Billing False 0.0 NaN False NaN 10.0 NaN 10.0 2019-11-11 17:23:34 NaN NaN SO3983 True By Subscription End Date Net 30 Not Needed NaN a4V1G000000TpGCUA0 NaN NaN Tax Amount Is Up To Date NaN NaN False False NaN False 0011G00000f8IrIQAU 30 Daily NaN a9e1G000000TNSGQA4 False Prepaid Credits a8k1G000000k9d4QAA Annual False False False False NaN NaN 1057821.0 None NaN None NaN False NaN NaN False NaN False NaN NaN NaN NaN NaN NaN NaN
4 8011G000000XDseQAG 2019-11-11 17:23:34 0011G00000fIPsfQAG 0051G000005MumuQAC 2019-11-11 17:23:34 Baltimore United States NaN NaN NaN NaN 55555 MD NaN 123 Ave NaN NaN 0051G000005MumuQAC 2019-11-11 17:23:34 NaN NaN 2019-11-11 17:23:34 NaN False False 0051G000005MunnQAC 2019-11-11 17:23:34 NaN NaN 2591 NaN 0051G000005MumuQAC 01s1G000001N7EKQA0 Baltimore United States NaN NaN NaN NaN 55555 Maryland NaN 123 Ave Activated Activated 2019-11-11 17:23:34 20400.0 New False 1057817.0 NaN False NaN Pending Approval False 0.0 NaN False NaN 10.0 NaN 10.0 2019-11-11 17:23:34 NaN NaN SO3978 True By Subscription End Date Net 30 Not Needed NaN a4V1G000000TpCtUAK NaN NaN No Tax Required NaN NaN False False NaN False 0011G00000fIPsfQAG 30 Daily NaN a9e1G000000KzojQAC False Prepaid Credits a8k1G000000k9d4QAA Annual False False False False NaN NaN 1057817.0 None NaN None NaN False NaN NaN False NaN False NaN NaN NaN NaN NaN NaN NaN
5 8011G000000XDsdQAG 2019-11-11 17:23:34 0011G00000fIPsfQAG 0051G000005MumuQAC 2019-11-11 17:23:34 Baltimore United States NaN NaN NaN NaN 55555 MD NaN 123 Ave NaN NaN 0051G000005MumuQAC 2019-11-11 17:23:34 NaN NaN 2019-11-11 17:23:34 NaN False False 0051G000005MunnQAC 2019-11-11 17:23:34 NaN NaN 2590 NaN 0051G000005MumuQAC 01s1G000001N7EKQA0 Baltimore United States NaN NaN NaN NaN 55555 Maryland NaN 123 Ave Activated Activated 2019-11-11 17:23:34 0.0 New False 934761.0 NaN False NaN None False NaN NaN False NaN NaN NaN NaN 2019-11-11 17:23:34 NaN NaN SO4763 True By Subscription End Date Net 30 Not Needed NaN a4V1G000000TpCtUAK NaN NaN No Tax Required NaN NaN False False NaN False 0011G00000fIPsfQAG 1 Domestic (US) NaN None False Other a8k1G000000k9d4QAA None False False False False NaN NaN NaN None NaN None NaN False NaN NaN False NaN False NaN NaN NaN NaN NaN NaN NaN
6 8011G000000XIK8QAO 2019-11-11 17:23:34 0011G00000nKDIvQAO 0051G000005MumuQAC 2019-11-11 17:23:34 Fort Lauderdale United States NaN NaN NaN NaN 55555 Florida NaN 123 Ave NaN NaN 0051G000005MumuQAC 2019-11-11 17:23:34 NaN NaN 2019-11-11 17:23:34 NaN False False 0051G000005MunnQAC 2019-11-11 17:23:34 NaN NaN 8359 NaN 0051G000005MumuQAC 01s1G000001N7EKQA0 Fort Lauderdale United States NaN NaN NaN NaN 55555 Florida NaN 123 Ave Activated Activated 2019-11-11 17:23:34 4500.0 New False 1058653.0 NaN False NaN None False 0.0 NaN False NaN 10.0 NaN 10.0 2019-11-11 17:23:34 NaN NaN SO6556 True By Subscription End Date Net 30 Not Needed NaN a4V1G000000Tv9vUAC NaN NaN No Tax Required NaN NaN False False NaN False 0011G00000nKDIvQAO 25 Daily NaN a9e1G000000L1n3QAC False Prepaid Credits a8k1G000000k9d4QAA None False False False False NaN NaN 1058653.0 SO6556 NaN google.com NaN False NaN NaN True NaN False NaN NaN NaN NaN NaN NaN NaN
7 8011G000000XIK7QAO 2019-11-11 17:23:34 0011G00000nKDIvQAO 0051G000005MumuQAC 2019-11-11 17:23:34 Fort Lauderdale United States NaN NaN NaN NaN 55555 Florida NaN 123 Ave NaN NaN 0051G000005MumuQAC 2019-11-11 17:23:34 NaN NaN 2019-11-11 17:23:34 NaN False False 0051G000005MumuQAC 2019-11-11 17:23:34 NaN NaN 8358 NaN 0051G000005MumuQAC 01s1G000001N7EKQA0 Fort Lauderdale United States NaN NaN NaN NaN 55555 Florida NaN 123 Ave Activated Activated 2019-11-11 17:23:34 0.0 New False NaN NaN False NaN None False NaN NaN False NaN NaN NaN NaN 2019-11-11 17:23:34 NaN NaN None True By Subscription End Date Net 30 Not Needed NaN a4V1G000000Tv9vUAC NaN NaN No Tax Required NaN NaN False False NaN False 0011G00000nKDIvQAO 1 Domestic (US) NaN None False Other a8k1G000000k9d4QAA None False False False False NaN NaN NaN None NaN None NaN False NaN NaN False NaN False NaN NaN NaN NaN NaN NaN NaN
8 8011G000000XChLQAW 2019-11-11 17:23:34 0011G00000gZNEkQAO 0051G000005MumuQAC 2019-11-11 17:23:34 Tampa United States NaN NaN NaN NaN 55555 Florida NaN 123 Ave NaN NaN 0051G000005MumuQAC 2019-11-11 17:23:34 NaN NaN 2019-11-11 17:23:34 NaN False False 0051G000005MunnQAC 2019-11-11 17:23:34 NaN NaN 1354 NaN 0051G000005MumuQAC 01s1G000001N7EKQA0 Tampa United States NaN NaN NaN NaN 55555 Florida NaN 123 Ave Activated Activated 2019-11-11 17:23:34 702.0 New False 1057423.0 NaN False NaN Pending Approval False 0.0 NaN False NaN 10.0 NaN 10.0 2019-11-11 17:23:34 NaN NaN SO4466 True By Subscription End Date Net 30 Not Needed NaN a4V1G000000TnQAUA0 NaN NaN No Tax Required NaN NaN False False NaN False 0011G00000gZNEkQAO 28 Daily NaN a9e1G000000TNOiQAO False Prepaid Credits a8k1G000000k9d4QAA Annual False False False False NaN NaN 1057423.0 None NaN None NaN False NaN NaN False NaN False NaN NaN NaN NaN NaN NaN NaN
9 8011G000000XChKQAW 2019-11-11 17:23:34 0011G00000gZNEkQAO 0051G000005MumuQAC 2019-11-11 17:23:34 Tampa United States NaN NaN NaN NaN 55555 Florida NaN 123 Ave NaN NaN 0051G000005MumuQAC 2019-11-11 17:23:34 NaN NaN 2019-11-11 17:23:34 NaN False False 0051G000005MunnQAC 2019-11-11 17:23:34 NaN NaN 1353 NaN 0051G000005MumuQAC 01s1G000001N7EKQA0 Tampa United States NaN NaN NaN NaN 55555 Florida NaN 123 Ave Activated Activated 2019-11-11 17:23:34 0.0 New False 934394.0 NaN False NaN None False NaN NaN False NaN NaN NaN NaN 2019-11-11 17:23:34 NaN NaN SO4465 True By Subscription End Date Net 30 Not Needed NaN a4V1G000000TnQAUA0 NaN NaN No Tax Required NaN NaN False False NaN False 0011G00000gZNEkQAO 1 Domestic (US) NaN None False Other a8k1G000000k9d4QAA None False False False False NaN NaN NaN None NaN None NaN False NaN NaN False NaN False NaN NaN NaN NaN NaN NaN NaN

sf_product_2_data (first 100 rows)

last_referenced_date is_active description last_modified_date record_type_id product_code _fivetran_synced last_viewed_date is_deleted last_modified_by_id system_modstamp name id created_by_id created_date family max_volume_c min_volume_c request_name_c default_quantity_c account_c related_product_c picklist_value_c as_input_c as_output_c status_c number_of_quantity_installments number_of_revenue_installments quantity_installment_period quantity_schedule_type revenue_installment_period revenue_schedule_type connections_c event_volume_c roadmap_connections_c row_volume_c display_url external_data_source_id external_id quantity_unit_of_measure stock_keeping_unit features_c tier_3_price_c tier_2_price_c tier_4_price_c tier_1_price_c netsuite_conn_sync_in_progress_c netsuite_conn_celigo_update_c netsuite_conn_term_contract_pricing_type_c netsuite_conn_net_suite_id_c netsuite_conn_net_suite_sync_err_c netsuite_conn_push_to_net_suite_c netsuite_conn_item_category_c netsuite_conn_net_suite_item_type_c netsuite_conn_sub_type_c is_new_c product_metadata_c product_metadata_del_c sbqq_asset_amendment_behavior_c sbqq_asset_conversion_c sbqq_batch_quantity_c sbqq_billing_frequency_c sbqq_billing_type_c sbqq_block_pricing_field_c sbqq_charge_type_c sbqq_component_c sbqq_compound_discount_rate_c sbqq_configuration_event_c sbqq_configuration_field_set_c sbqq_configuration_fields_c sbqq_configuration_form_title_c sbqq_configuration_type_c sbqq_configuration_validator_c sbqq_configured_code_pattern_c sbqq_configured_description_pattern_c sbqq_cost_editable_c sbqq_cost_schedule_c sbqq_custom_configuration_page_c sbqq_custom_configuration_required_c sbqq_customer_community_availability_c sbqq_default_pricing_table_c sbqq_default_quantity_c sbqq_description_locked_c sbqq_discount_category_c sbqq_discount_schedule_c sbqq_dynamic_pricing_constraint_c sbqq_exclude_from_maintenance_c sbqq_exclude_from_opportunity_c sbqq_externally_configurable_c sbqq_generate_contracted_price_c sbqq_has_configuration_attributes_c sbqq_has_consumption_schedule_c sbqq_hidden_c sbqq_hide_price_in_search_results_c sbqq_include_in_maintenance_c sbqq_new_quote_group_c sbqq_non_discountable_c sbqq_non_partner_discountable_c sbqq_option_layout_c sbqq_option_selection_method_c sbqq_optional_c sbqq_price_editable_c sbqq_pricing_method_c sbqq_pricing_method_editable_c sbqq_product_picture_id_c sbqq_quantity_editable_c sbqq_quantity_scale_c sbqq_reconfiguration_disabled_c sbqq_renewal_product_c sbqq_sort_order_c sbqq_specifications_c sbqq_subscription_base_c sbqq_subscription_category_c sbqq_subscription_percent_c sbqq_subscription_pricing_c sbqq_subscription_target_c sbqq_subscription_term_c sbqq_subscription_type_c sbqq_tax_code_c sbqq_taxable_c sbqq_term_discount_level_c sbqq_term_discount_schedule_c sbqq_upgrade_credit_c sbqq_upgrade_ratio_c sbqq_upgrade_source_c sbqq_upgrade_target_c connector_type_c pbf_pro_type_discount_c dimension_c connector_status_c dimension_definition_c ava_sfcpq_tax_code_c paid_consumption_c is_complimentary_c product_external_id_c blng_billing_rule_c blng_revenue_recognition_rule_c blng_tax_rule_c deployment_date_c do_not_prorate_c celigo_sfnsio_netsuite_id_c sbqq_enable_large_configuration_c sbqq_pricing_guidance_c celigo_sfnsio_item_pricing_type_c celigo_sfnsio_test_mode_record_c celigo_sfnsio_celigo_last_modified_date_c celigo_sfnsio_net_suite_record_c celigo_sfnsio_skip_export_to_net_suite_c celigo_sfnsio_net_suite_item_type_c celigo_sfnsio_net_suite_id_c promo_code_c product_category_c product_source_c non_recurring_c is_archived _fivetran_active
0 NaN True NaN 2019-11-11 17:23:34 012370000005lzhAAA 1 2019-11-11 17:23:34 NaN False 0051G0000060rE7QAI 2019-11-11 17:23:34 X 01t1G000002Uf3MQAS 0051G0000060rE7QAI 2019-11-11 17:23:34 X NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False NaN NaN X False NaN Non Inventory Sale noninventory-Sale False NaN NaN Default One per quote line NaN Annual Advance Quantity Recurring False NaN NaN NaN NaN NaN NaN NaN NaN NaN False NaN NaN False NaN NaN 1 False NaN NaN NaN False False False NaN False False False False False False False False NaN Click False False List False NaN True NaN False NaN NaN NaN List NaN NaN Fixed Price NaN 1.0 Renewable NaN False NaN NaN NaN NaN NaN NaN chat False Function Alpha NaN NaN NaN False 12345.0 a1L1G000002t4LAUAY a951G000000TQsMQAW a9D1G000000TefyUAC NaN False NaN NaN NaN NaN False 2019-11-11 17:23:34 NaN False NaN NaN NaN NaN NaN True False NaN
1 NaN False NaN 2019-11-11 17:23:34 012370000005lzhAAA 2 2019-11-11 17:23:34 NaN False 00537000004EpGKAA0 2019-11-11 17:23:34 X 01t1G000000bOtkQAE 0051G000005MzwaQAC 2019-11-11 17:23:34 None NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False False NaN NaN None False NaN Non Inventory Sale noninventory-Sale False NaN NaN Default One per quote line NaN None None Quantity None False NaN NaN NaN NaN NaN NaN NaN NaN NaN False NaN NaN False NaN NaN 1 False NaN NaN NaN False False False NaN False False False False False False False False NaN Click False True List False NaN True NaN False NaN NaN NaN List NaN NaN None NaN NaN Renewable NaN False NaN NaN NaN NaN NaN NaN finance False Connector General Availability NaN NaN NaN False NaN None None None NaN False NaN False NaN NaN False 2019-11-11 17:23:34 NaN False NaN NaN NaN NaN NaN NaN NaN NaN

sf_task_data (first 100 rows)

referral_account_c who_id call_disposition recurrence_day_of_month owner_id recurrence_end_date_only subject description last_modified_date recurrence_time_zone_sid_key is_recurrence what_count _fivetran_synced call_object is_deleted recurrence_day_of_week_mask last_modified_by_id system_modstamp recurrence_regenerated_type id recurrence_type reminder_date_time call_type is_high_priority is_closed recurrence_month_of_year is_reminder_set activity_date recurrence_instance priority recurrence_interval who_count recurrence_start_date_only account_id referral_contact_c call_duration_in_seconds created_by_id created_date recurrence_activity_id what_id task_subtype status invitee_uuid_c type no_show_c first_meeting_held_c associated_sdr_c first_meeting_c call_recording_c affectlayer_chorus_call_id_c affectlayer_affect_layer_call_id_c last_rep_activity_date_c lid_url_c lid_date_sent_c record_type_id sales_loft_step_id_c sales_loft_step_name_c sales_loft_step_type_c sales_loft_email_template_id_c sales_loft_external_identifier_c sales_loft_cadence_id_c sales_loft_clicked_count_c sales_loft_cadence_name_c sales_loft_reply_count_c call_disposition_c sales_loft_email_template_title_c sales_loft_step_day_new_c call_disposition_2_c sales_loft_viewed_count_c sales_loft_1_sales_loft_step_day_c sales_loft_1_sales_loft_clicked_count_c sales_loft_1_sales_loft_view_count_c sales_loft_1_call_disposition_c sales_loft_1_sales_loft_replies_count_c sales_loft_1_sales_loft_cadence_name_c sales_loft_1_call_sentiment_c sales_loft_1_sales_loft_email_template_title_c completed_date_time is_a_co_sell_activity_c partner_contact_c co_selling_activity_c description_c co_sell_partner_account_c campaign_c partner_account_c topic_c event_name_c attendance_number_c partner_activity_type_c proof_of_referral_c how_did_you_bring_value_or_create_trust_c how_did_you_bring_value_or_earn_trust_c duration_in_minutes_c vidyard_c expected_payment_date_c execute_collections_plan_activity_c collections_hold_c opportunity_c meeting_type_c meeting_name_c bizible_2_bizible_id_c bizible_2_bizible_touchpoint_date_c assigned_to_role_c assigned_to_name_c legacy_hvr_id_c is_archived _fivetran_active
0 NaN 0031G00001S3ckZQAR NaN NaN 0051G000005Mun4QAC NaN subject 0051G000005Mun4QAC description 2019-11-11 17:23:34 NaN False 1 2019-11-11 17:23:34 NaN False NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN 00T1G00003Ufap9UAB NaN NaN NaN False True NaN False 2019-11-11 17:23:34 NaN Normal NaN 1 NaN 0011G00000jWVWoQAO NaN NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN 0061G00000N38JZQAZ Task Completed NaN X False NaN NaN NaN NaN NaN NaN NaN NaN NaN 0121G000000g1SFQAY NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False NaN False False NaN None None NaN NaN X fivetran ae NaN False NaN
1 NaN 0031G00001S3JniQAF NaN NaN 0051G000005Mun4QAC NaN subject 0051G000005Mun4QAC description 2019-11-11 17:23:34 NaN False 1 2019-11-11 17:23:34 NaN False NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN 00T1G00003UfepsUAB NaN NaN NaN False True NaN False 2019-11-11 17:23:34 NaN Normal NaN 1 NaN 0011G00000ugZ6HQAU NaN NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN 0061G00000N31HAQAZ Task Completed NaN X False NaN NaN NaN NaN NaN NaN NaN NaN NaN 0121G000000g1SFQAY NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False NaN False False NaN None None NaN NaN X fivetran ae NaN False NaN
2 NaN 0031G00000xOrznQAC NaN NaN 0051G000005Mun4QAC NaN subject 0051G000005Mun4QAC description 2019-11-11 17:23:34 NaN False 1 2019-11-11 17:23:34 NaN False NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN 00T1G00003UfRU9UAN NaN NaN NaN False True NaN False 2019-11-11 17:23:34 NaN Normal NaN 1 NaN 0011G00000hC8aMQAS NaN NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN 0061G00000N32AHQAZ Task Completed NaN None False NaN NaN NaN NaN NaN NaN NaN NaN NaN 0121G000000g1SFQAY NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False NaN False False NaN Default Personal Meeting sync NaN NaN X fivetran ae NaN False NaN
3 NaN 00Q1G00000nOMcPUAW NaN NaN 0051G000005Mun4QAC NaN subject 0051G000005Mun4QAC description 2019-11-11 17:23:34 NaN False 0 2019-11-11 17:23:34 NaN False NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN 00T1G00003UffGjUAJ NaN NaN NaN False True NaN False 2019-11-11 17:23:34 NaN Normal NaN 1 NaN None NaN NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN None Task Completed NaN None False NaN NaN NaN NaN NaN NaN NaN NaN NaN 0121G000000g1SFQAY NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False NaN False False NaN None None NaN NaN X fivetran ae NaN False NaN
4 NaN 0031G00001S3oefQAB NaN NaN 0051G000005Mun4QAC NaN subject 0051G000005Mun4QAC description 2019-11-11 17:23:34 NaN False 1 2019-11-11 17:23:34 NaN False NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN 00T1G00003UfZPYUA3 NaN NaN NaN False True NaN False 2019-11-11 17:23:34 NaN Normal NaN 1 NaN 0011G00000qFChkQAG NaN NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN 0061G00000N3DTUQA3 Task Completed NaN X False NaN NaN NaN NaN NaN NaN NaN NaN NaN 0121G000000g1SFQAY NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 1.0 NaN NaN NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False NaN False False NaN None None NaN NaN X fivetran ae NaN False NaN
5 NaN 0031G00001S3oefQAB NaN NaN 0051G000005Mun4QAC NaN subject 0051G000005Mun4QAC description 2019-11-11 17:23:34 NaN False 1 2019-11-11 17:23:34 NaN False NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN 00T1G00003UfZQ7UAN NaN NaN NaN False True NaN False 2019-11-11 17:23:34 NaN Normal NaN 1 NaN 0011G00000qFChkQAG NaN NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN 0061G00000N3DTUQA3 Task Completed NaN X False NaN NaN NaN NaN NaN NaN NaN NaN NaN 0121G000000g1SFQAY NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False NaN False False NaN None None NaN NaN X fivetran ae NaN False NaN
6 NaN 0031G00001NTqhqQAD NaN NaN 0051G000005Mun4QAC NaN subject 0051G000005Mun4QAC description 2019-11-11 17:23:34 NaN False 0 2019-11-11 17:23:34 NaN False NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN 00T1G00003UfFY2UAN NaN NaN NaN False True NaN False 2019-11-11 17:23:34 NaN Normal NaN 1 NaN 0011G00000tM0pgQAC NaN NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN None Task Completed NaN X False NaN NaN NaN NaN NaN NaN NaN NaN NaN 0121G000000g1SFQAY NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 85.0 NaN 1.0 NaN NaN NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False NaN False False NaN None None NaN NaN X fivetran ae NaN False NaN
7 NaN 0031G00001A2cSSQAZ NaN NaN 0051G000005Mun4QAC NaN subject 0051G000005Mun4QAC description 2019-11-11 17:23:34 NaN False 1 2019-11-11 17:23:34 NaN False NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN 00T1G00003UffAmUAJ NaN NaN NaN False True NaN False 2019-11-11 17:23:34 NaN Normal NaN 1 NaN 0011G00000gY18CQAS NaN NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN 0061G00000O1zGuQAJ Task Completed NaN None False NaN NaN NaN NaN NaN NaN NaN NaN NaN 0121G000000g1SFQAY NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False NaN False False NaN Default Personal Meeting reconnect NaN NaN X fivetran ae NaN False NaN
8 NaN 0031G00001S3oefQAB NaN NaN 0051G000005Mun4QAC NaN subject 0051G000005Mun4QAC description 2019-11-11 17:23:34 NaN False 1 2019-11-11 17:23:34 NaN False NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN 00T1G00003UfFP8UAN NaN NaN NaN False True NaN False 2019-11-11 17:23:34 NaN Normal NaN 1 NaN 0011G00000qFChkQAG NaN NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN 0061G00000N3D9UQAV Task Completed NaN X False NaN NaN NaN NaN NaN NaN NaN NaN NaN 0121G000000g1SFQAY NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False NaN False False NaN None None NaN NaN X fivetran ae NaN False NaN
9 NaN 0031G00001NTqhqQAD NaN NaN 0051G000005Mun4QAC NaN subject 0051G000005Mun4QAC description 2019-11-11 17:23:34 NaN False 0 2019-11-11 17:23:34 NaN False NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN 00T1G00003UfFl8UAF NaN NaN NaN False True NaN False 2019-11-11 17:23:34 NaN Normal NaN 1 NaN 0011G00000tM0pgQAC NaN NaN 0051G000005Mun4QAC 2019-11-11 17:23:34 NaN None Task Completed NaN X False NaN NaN NaN NaN NaN NaN NaN NaN NaN 0121G000000g1SFQAY NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 2019-11-11 17:23:34 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN False NaN False False NaN None None NaN NaN X fivetran ae NaN False NaN

sf_user_data (first 100 rows)

_fivetran_deleted _fivetran_synced about_me account_id alias badge_text banner_photo_url call_center_id city community_nickname company_name contact_id country country_code default_group_notification_frequency delegated_approver_id department digest_frequency division email email_encoding_key email_preferences_auto_bcc employee_number extension fax federation_identifier first_name forecast_enabled full_photo_url geocode_accuracy id individual_id is_active is_profile_photo_active language_locale_key last_login_date last_name last_referenced_date last_viewed_date latitude locale_sid_key longitude manager_id medium_banner_photo_url mobile_phone name offline_trial_expiration_date phone postal_code profile_id receives_admin_info_emails receives_info_emails sender_email sender_name signature small_banner_photo_url small_photo_url state state_code street time_zone_sid_key title user_role_id user_type username _fivetran_active
0 False 2019-11-26 20:18:23 NaN NaN D4b1Qin+gQP3CpRZBVVTzw== 1B2M2Y8AsgTpgAmY7PhCfg== +ZTO2mf2LuH+iHMMN5CTbA== NaN NaN zYOn49YYBw9z+c1AbjrzcA== NaN NaN 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== jZwwfLfzxKMoIqUZItHOqg== None NaN 9iPnWvMOYrvXPW31tQu3tQ== NaN G5JZeErb0oYU8jQrAJylYw== Dku078MOwSnlADoY6iEDzw== True NaN NaN NaN NaN VL0FVo9TB+culjkuqg52bQ== True fm397Qb0Cp93iLEx/qKV2g== NaN 0051G00000600MlQAI NaN True False cQlcVsZB8sSk8Ym53816OA== 2019-08-05 18:13:35 1NZWXYLqo5CiFyFOT2EBJA== None None NaN cQlcVsZB8sSk8Ym53816OA== NaN tfjEwBIFrT7IKUXp/ObBNA== Aah0gJhzMf8W4MSufRJi5w== NaN Brandon Zinn NaN None NaN q+POjJLmN0AEkFmTx/DVmg== False False NaN NaN NaN 2ERJSzi6mHg8kR1RS4zqig== +Rxw9GW0v2EzZhKzJjofjA== NaN NaN NaN c8PRyKwR7IqEd0+3VZY6gQ== None BK8ye8s2vCtRuIzk3Iy7Og== 622K5vICg3VbM5wNwnOYiw== xv6xgJYOh/ZMPRNDPbzueQ== True
1 False 2019-11-26 20:18:23 NaN NaN gpl2aeOp9ql5nOAs+5gF9A== 1B2M2Y8AsgTpgAmY7PhCfg== +ZTO2mf2LuH+iHMMN5CTbA== NaN NaN busRLQgm3BlE5gft7AXW5Q== NaN NaN 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== jZwwfLfzxKMoIqUZItHOqg== TLZtnkcZltX8lijWYSQqRg== NaN 9iPnWvMOYrvXPW31tQu3tQ== NaN cwB0dYdfvqwxMf4ilgNByw== Dku078MOwSnlADoY6iEDzw== True NaN NaN NaN NaN d9zVVfOLll0iChOjuwgCYA== True fm397Qb0Cp93iLEx/qKV2g== NaN 0051G000005Mx8dQAC NaN True False cQlcVsZB8sSk8Ym53816OA== 2019-11-26 19:46:44 u7D6SbUlxCZPStegatw+Bw== None None NaN cQlcVsZB8sSk8Ym53816OA== NaN TLZtnkcZltX8lijWYSQqRg== Aah0gJhzMf8W4MSufRJi5w== NaN Eric Welsh NaN None NaN 0XwCP3LN1EcBDVvCIK3NCw== False False NaN NaN NaN 2ERJSzi6mHg8kR1RS4zqig== +Rxw9GW0v2EzZhKzJjofjA== NaN NaN NaN eobciA3TwKWJw+xVP4bGaQ== ieakxsZwGEBdpS1879Gv/Q== aDWPUItc1uc9iqJvMkP82Q== 622K5vICg3VbM5wNwnOYiw== Iqqj3G/cliOsvvTCAdP+TA== True
2 False 2019-11-18 21:13:39 NaN NaN decEUNZtz8K0/rVaHGGx6w== 1B2M2Y8AsgTpgAmY7PhCfg== +ZTO2mf2LuH+iHMMN5CTbA== NaN NaN j74RDGGp6qpCT9+y75BpbQ== NaN NaN None None jZwwfLfzxKMoIqUZItHOqg== None NaN 9iPnWvMOYrvXPW31tQu3tQ== NaN aJCyq0bMBmwFIa7BYuGaqg== Dku078MOwSnlADoY6iEDzw== True NaN NaN NaN NaN JMGykJnIdJGUeW3++LUKQA== False fm397Qb0Cp93iLEx/qKV2g== NaN 00555000003F3Q6AAK NaN True False cQlcVsZB8sSk8Ym53816OA== 2019-11-16 00:13:23 89+z/rKPszB4G/pKIw1fAw== None None NaN cQlcVsZB8sSk8Ym53816OA== NaN TLZtnkcZltX8lijWYSQqRg== Aah0gJhzMf8W4MSufRJi5w== NaN Saurabh Kapadia NaN None NaN QvzqVksmGmwST2MANzS9Nw== False False NaN NaN NaN 2ERJSzi6mHg8kR1RS4zqig== +Rxw9GW0v2EzZhKzJjofjA== NaN NaN NaN eobciA3TwKWJw+xVP4bGaQ== None aDWPUItc1uc9iqJvMkP82Q== 622K5vICg3VbM5wNwnOYiw== yFjyN6ai5qiWqyS6fBWBkw== True
3 False 2019-11-15 21:08:40 NaN NaN prRu04oqXV0uNf6Lo1Va6w== 1B2M2Y8AsgTpgAmY7PhCfg== +ZTO2mf2LuH+iHMMN5CTbA== NaN NaN io7DTej1IHP8rPTJdKfOoA== NaN NaN 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== jZwwfLfzxKMoIqUZItHOqg== None NaN 9iPnWvMOYrvXPW31tQu3tQ== NaN ZLYqq+RDyk6Te7xVdheciA== Dku078MOwSnlADoY6iEDzw== True NaN NaN NaN NaN prRu04oqXV0uNf6Lo1Va6w== True fm397Qb0Cp93iLEx/qKV2g== NaN 00537000004EpGKAA0 NaN True False cQlcVsZB8sSk8Ym53816OA== 2019-11-12 16:48:38 HqQOq8TX4AO/sIuPSgR2Ug== None None NaN cQlcVsZB8sSk8Ym53816OA== NaN TLZtnkcZltX8lijWYSQqRg== Aah0gJhzMf8W4MSufRJi5w== NaN Jodie Navarre NaN GiIWsKPHcUq7qMJlqOKAWQ== NaN QvzqVksmGmwST2MANzS9Nw== True True NaN NaN NaN 2ERJSzi6mHg8kR1RS4zqig== +Rxw9GW0v2EzZhKzJjofjA== NaN NaN NaN c8PRyKwR7IqEd0+3VZY6gQ== None aDWPUItc1uc9iqJvMkP82Q== 622K5vICg3VbM5wNwnOYiw== veeuTX4ZgDX/1UVD/ZGfpA== False
4 False 2019-11-15 21:13:33 NaN NaN RghnQ3IiPoK6c2tbUocbPw== 1B2M2Y8AsgTpgAmY7PhCfg== +ZTO2mf2LuH+iHMMN5CTbA== NaN NaN abkaAGpuJILYJ9hOA4Be0g== NaN NaN 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== jZwwfLfzxKMoIqUZItHOqg== None NaN 9iPnWvMOYrvXPW31tQu3tQ== NaN 7Q1bgZpigij+8LTy229aww== Dku078MOwSnlADoY6iEDzw== True NaN NaN NaN NaN /gHwN0rApZymtoP6fxl3XA== True fm397Qb0Cp93iLEx/qKV2g== NaN 00537000004jJQPAA2 NaN True False cQlcVsZB8sSk8Ym53816OA== 2019-11-12 20:09:24 /gHwN0rApZymtoP6fxl3XA== None None NaN cQlcVsZB8sSk8Ym53816OA== NaN TLZtnkcZltX8lijWYSQqRg== Aah0gJhzMf8W4MSufRJi5w== NaN Nomadmktg Nomadmktg NaN None NaN QvzqVksmGmwST2MANzS9Nw== True True NaN NaN NaN 2ERJSzi6mHg8kR1RS4zqig== +Rxw9GW0v2EzZhKzJjofjA== NaN NaN NaN eobciA3TwKWJw+xVP4bGaQ== None a21b1bWPBhKAAug5Jxk73g== 622K5vICg3VbM5wNwnOYiw== A/y3WQRrjTc0Q6xbsGmujA== True
5 True 2019-04-04 18:48:20 NaN NaN hzoNezv89sMonh/jHBrCNg== 1B2M2Y8AsgTpgAmY7PhCfg== +ZTO2mf2LuH+iHMMN5CTbA== NaN NaN tkqLcoeCxxgs6yI4gT/9yw== NaN NaN 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== jZwwfLfzxKMoIqUZItHOqg== None NaN 9iPnWvMOYrvXPW31tQu3tQ== NaN 46l0uz6Yx0/A9LYo0WpgXg== Dku078MOwSnlADoY6iEDzw== True NaN NaN NaN NaN tkqLcoeCxxgs6yI4gT/9yw== False M3gnKLhZJGDc/r8mEFKtKA== NaN 005q0000004XRtzAAG NaN True False cQlcVsZB8sSk8Ym53816OA== 2019-03-14 19:00:29 lmOrvYek51oJsBc+3v9rSA== None None NaN cQlcVsZB8sSk8Ym53816OA== NaN None Aah0gJhzMf8W4MSufRJi5w== NaN Artyom Vasilyev NaN None NaN b/9XvWwwuZ6GthzYSc/fmg== False False NaN NaN NaN 2ERJSzi6mHg8kR1RS4zqig== 2+OnpJlgo7jyGDcvqrluzA== NaN NaN NaN eobciA3TwKWJw+xVP4bGaQ== None None 622K5vICg3VbM5wNwnOYiw== sfr1qhkoa01jph0cN406sA== True
6 True 2019-04-04 18:48:20 NaN NaN 6OrI2Np3L4GCar2dFYxWZQ== 1B2M2Y8AsgTpgAmY7PhCfg== +ZTO2mf2LuH+iHMMN5CTbA== NaN NaN otDd6eocvI7CTXTEE6iX8Q== NaN NaN 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== jZwwfLfzxKMoIqUZItHOqg== None NaN 9iPnWvMOYrvXPW31tQu3tQ== NaN 6rfEElWza4sHeeyzP0TXBQ== Dku078MOwSnlADoY6iEDzw== True NaN NaN NaN NaN ouSCKpgzcoPjn3tgrPheyQ== False M3gnKLhZJGDc/r8mEFKtKA== NaN 005q0000004k6QEAAY NaN False False cQlcVsZB8sSk8Ym53816OA== None 4mhEPkPZPat+vvMDu+lkLw== None None NaN cQlcVsZB8sSk8Ym53816OA== NaN None Aah0gJhzMf8W4MSufRJi5w== NaN empty account NaN None NaN U4E6aqzPODD0RiUPm3B8rA== False False NaN NaN NaN 2ERJSzi6mHg8kR1RS4zqig== 2+OnpJlgo7jyGDcvqrluzA== NaN NaN NaN c8PRyKwR7IqEd0+3VZY6gQ== None None 622K5vICg3VbM5wNwnOYiw== BrgwJpKXta8Zj4di1C7DFQ== True
7 True 2019-04-04 18:48:20 NaN NaN Xax7nNae5oQ3kWF4QHq/rQ== 1B2M2Y8AsgTpgAmY7PhCfg== +ZTO2mf2LuH+iHMMN5CTbA== NaN NaN U92cYAXzzfxaacXAc4gBbQ== NaN NaN 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== jZwwfLfzxKMoIqUZItHOqg== None NaN 9iPnWvMOYrvXPW31tQu3tQ== NaN scEwenaKqevd6yTLT1ltpw== Dku078MOwSnlADoY6iEDzw== True NaN NaN NaN NaN BkdRdNki59y7PtNMAjbb3w== False M3gnKLhZJGDc/r8mEFKtKA== NaN 005q0000004k6NjAAI NaN True False cQlcVsZB8sSk8Ym53816OA== None qX/tvOMOz7xfd/I3ibDuAA== None None NaN cQlcVsZB8sSk8Ym53816OA== NaN None Aah0gJhzMf8W4MSufRJi5w== NaN Justin Clark NaN None NaN U4E6aqzPODD0RiUPm3B8rA== False False NaN NaN NaN 2ERJSzi6mHg8kR1RS4zqig== 2+OnpJlgo7jyGDcvqrluzA== NaN NaN NaN c8PRyKwR7IqEd0+3VZY6gQ== None 7IHceHBUAWjctCBt2VZXiA== 622K5vICg3VbM5wNwnOYiw== rzM8hF45+JLWxiSDOYlwUQ== False
8 True 2019-04-04 18:48:20 NaN NaN HWRtNym1u++RiSIY/YATyg== 1B2M2Y8AsgTpgAmY7PhCfg== +ZTO2mf2LuH+iHMMN5CTbA== NaN NaN lG3Ke8bREpt0SeoDgN/3+g== NaN NaN 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== jZwwfLfzxKMoIqUZItHOqg== None NaN 9iPnWvMOYrvXPW31tQu3tQ== NaN AMmh7ibU+xNFUG7Q5Fc2Tw== Dku078MOwSnlADoY6iEDzw== True NaN NaN NaN NaN 22AXvR8nEY1ECDoXKoJAnw== False M3gnKLhZJGDc/r8mEFKtKA== NaN 005q00000053KTAAA2 NaN True False cQlcVsZB8sSk8Ym53816OA== 2019-04-01 22:38:13 E15NIN/JJbyu6RY90uJ5NQ== 2019-03-11 22:30:18 2019-03-11 22:30:18 NaN cQlcVsZB8sSk8Ym53816OA== NaN TLZtnkcZltX8lijWYSQqRg== Aah0gJhzMf8W4MSufRJi5w== NaN Christian Kletzl NaN None NaN QvzqVksmGmwST2MANzS9Nw== False False NaN NaN NaN 2ERJSzi6mHg8kR1RS4zqig== 2+OnpJlgo7jyGDcvqrluzA== NaN NaN NaN eobciA3TwKWJw+xVP4bGaQ== None aDWPUItc1uc9iqJvMkP82Q== 622K5vICg3VbM5wNwnOYiw== AMmh7ibU+xNFUG7Q5Fc2Tw== True
9 True 2019-04-04 18:48:20 NaN NaN +PsAbGnYCR23KLQiekSsJQ== 1B2M2Y8AsgTpgAmY7PhCfg== +ZTO2mf2LuH+iHMMN5CTbA== NaN NaN cpjVy4nqrYDiBsDMqUD08g== NaN NaN 8lPv4wLTKrJkp24M5lvnaQ== dRb9Q62qXguKZaZyw5hF0g== jZwwfLfzxKMoIqUZItHOqg== None NaN 9iPnWvMOYrvXPW31tQu3tQ== NaN nU9FSqobhYTBGN9rJR2Khw== Dku078MOwSnlADoY6iEDzw== True NaN NaN NaN NaN vWwLXUQeD7u9IvmI79ThcQ== False M3gnKLhZJGDc/r8mEFKtKA== NaN 005q00000053uuWAAQ NaN True False cQlcVsZB8sSk8Ym53816OA== 2019-03-29 18:46:02 qwtVcSBsz2/Q9KWmP9i1jA== None None NaN cQlcVsZB8sSk8Ym53816OA== NaN None Aah0gJhzMf8W4MSufRJi5w== NaN Andrey Lukyanov NaN None NaN QvzqVksmGmwST2MANzS9Nw== False False NaN NaN NaN 2ERJSzi6mHg8kR1RS4zqig== 2+OnpJlgo7jyGDcvqrluzA== NaN NaN NaN eobciA3TwKWJw+xVP4bGaQ== None aDWPUItc1uc9iqJvMkP82Q== 622K5vICg3VbM5wNwnOYiw== c7ZgbZS/+xi/ESP1ey4+eA== True

sf_user_role_data (first 100 rows)

_fivetran_deleted _fivetran_synced case_access_for_account_owner contact_access_for_account_owner developer_name forecast_user_id id may_forecast_manager_share name opportunity_access_for_account_owner parent_role_id portal_type rollup_description _fivetran_active
0 False 2019-04-04 18:48:27 fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== gjEPJnSSl2rmO0PmZT0r/A== NaN StB7ADpIfsOKUVMS9KkJWw== False ev8AzWxVDGisAlHLhbswRw== fc4SIASWnVauLgJFy3VNNQ== p7fMKkVg9kprXiWdBNBwqg== at+X+DrPZFPUpqSxBw83VA== ev8AzWxVDGisAlHLhbswRw== True
1 False 2019-04-04 18:48:27 fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== kgb2Y/pX2KDN31aThxXgHg== NaN Pb7q3GyRtA1b+mjhRsCisw== False stoIWxwAppBt1wOf0ZrEXw== fc4SIASWnVauLgJFy3VNNQ== p7fMKkVg9kprXiWdBNBwqg== at+X+DrPZFPUpqSxBw83VA== stoIWxwAppBt1wOf0ZrEXw== True
2 False 2019-04-04 18:48:27 fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== DW8qGW+liKrQFN672JebZQ== NaN M2E7lAPWS91Qs5fLzFxciQ== False DpYNTT8JrVEsoGY/4jQu4A== fc4SIASWnVauLgJFy3VNNQ== p7fMKkVg9kprXiWdBNBwqg== at+X+DrPZFPUpqSxBw83VA== DpYNTT8JrVEsoGY/4jQu4A== True
3 False 2019-04-04 18:48:27 fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== iuNkhc167Xlxl98P3iZgAw== NaN /UCbUKKXllVd2xJJlKrNSw== False F2ZX+UKPrvm19As4fX6CeQ== fc4SIASWnVauLgJFy3VNNQ== p7fMKkVg9kprXiWdBNBwqg== at+X+DrPZFPUpqSxBw83VA== F2ZX+UKPrvm19As4fX6CeQ== True
4 False 2019-04-04 18:48:27 fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== n4VWekp/jNT2t6w9lNiAZw== NaN xp0Oq/pisjhX72tBE4KOAA== False +my2KWVrmQnbKPv+YhiwVQ== fc4SIASWnVauLgJFy3VNNQ== p7fMKkVg9kprXiWdBNBwqg== at+X+DrPZFPUpqSxBw83VA== +my2KWVrmQnbKPv+YhiwVQ== False
5 False 2019-04-04 18:48:27 fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== fAEAoSTZ7wrrU27I5qf2cQ== NaN ymq/lUMQgqZHw/9y2pM7Cg== False tpCgPeRuZXAwk5cHws8dPg== fc4SIASWnVauLgJFy3VNNQ== M2E7lAPWS91Qs5fLzFxciQ== at+X+DrPZFPUpqSxBw83VA== tpCgPeRuZXAwk5cHws8dPg== True
6 False 2019-04-04 18:48:27 fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== Z0Mk929e09pi7cgzdIz9Yw== NaN wFbcjrjZKNwzPncwnz82xg== False zEtr4yiL7ZjlvxI8zM5sYg== fc4SIASWnVauLgJFy3VNNQ== Pb7q3GyRtA1b+mjhRsCisw== at+X+DrPZFPUpqSxBw83VA== zEtr4yiL7ZjlvxI8zM5sYg== True
7 False 2019-04-04 18:48:27 fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== hYkEw+Jm9WQL+ojxbS7VCg== NaN 3xphSR7VKJYclzXoEfA1AA== False hYkEw+Jm9WQL+ojxbS7VCg== fc4SIASWnVauLgJFy3VNNQ== aDWPUItc1uc9iqJvMkP82Q== at+X+DrPZFPUpqSxBw83VA== hYkEw+Jm9WQL+ojxbS7VCg== True
8 False 2019-04-04 18:48:27 fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== 7TSN2+DRJ/0CXrS7htzhVQ== NaN BUKMwDbqRIBsdYfaEti1VQ== False j+MFtw9z6uGsU88K1p90qA== fc4SIASWnVauLgJFy3VNNQ== StB7ADpIfsOKUVMS9KkJWw== at+X+DrPZFPUpqSxBw83VA== j+MFtw9z6uGsU88K1p90qA== True
9 False 2019-04-04 18:48:27 fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== y8Us3rZt0z6bUo0S/+JAgw== NaN SdtcfRp1CirkHIEFxtA2/Q== False qwT73r52PFdwFtgbRdOD0A== fc4SIASWnVauLgJFy3VNNQ== StB7ADpIfsOKUVMS9KkJWw== at+X+DrPZFPUpqSxBw83VA== qwT73r52PFdwFtgbRdOD0A== False
Source tables may have typos, unclear names, incorrect column types, etc. We clean these tables.

stg_sf_account_data (first 100 rows)

billing_city billing_country billing_country_code billing_state account_name shipping_country shipping_country_code account_source shipping_longitude shipping_latitude billing_longitude is_deleted account_description record_type_id account_type account_photo_url account_id industry billing_state_code billing_latitude master_record_id owner_id billing_street billing_postal_code phone_number is_active account_website billing_geocode_accuracy employee_count fax_number parent_account_id shipping_city shipping_geocode_accuracy shipping_postal_code shipping_state shipping_state_code shipping_street
0 None None None None None None None None NaN NaN NaN False None ulhLv5btm8B/N7JURh1/+w== ziZgHawN6hOLcpXwK3Ygpw== cHWjfsf2Ht8rqw1PfJJQAw== 0015500000Xyy06AAB None None NaN None tqs6UXPA/Lm7W+0dX0+syw== None None None True None None NaN None None None None None None None None
1 None None None None Seinfeld Company None None TDK+SgtPSM3Vk67zX9aeRA== NaN NaN NaN True None ulhLv5btm8B/N7JURh1/+w== ziZgHawN6hOLcpXwK3Ygpw== UYCWM7QeZFg3GdlAkhe9fg== 0015500000Ygpq1AAB None None NaN L4izOo4yZpLq5io5YM8pvA== soS8gWpPTwLhsepmOnEc0w== None None None True None None NaN None None None None None None None None
2 None None None None None None None None NaN NaN NaN True None ulhLv5btm8B/N7JURh1/+w== iFbCAfBS66w7LWV2PbAhCg== uiHRGP2vPD84LdjD3hMTrw== 001q000000wW9BeAAK None uOqY3hqD9h0ZdgJ3QaRYvg== NaN None Air1Prg9Tsiw3UANemom6g== 2YEqg12uvpIXyu6aR9mQlg== gnzLDuqKcGxMNKFokfhOew== WIDCNIeVb5iHBWziEBitQw== True ye4O0TtPzpTBUyS5TfSNig== None NaN None None None None None None None None
3 None None None None None None None 4sUcAmMzCJTMD0K4Qnsiog== NaN NaN NaN True None ulhLv5btm8B/N7JURh1/+w== iFbCAfBS66w7LWV2PbAhCg== 5KRYOy6rMW5wXVulkbNi1w== 001q000000wW9BZAA0 None uOqY3hqD9h0ZdgJ3QaRYvg== NaN None Air1Prg9Tsiw3UANemom6g== 2YEqg12uvpIXyu6aR9mQlg== gnzLDuqKcGxMNKFokfhOew== WIDCNIeVb5iHBWziEBitQw== True ye4O0TtPzpTBUyS5TfSNig== None NaN None None None None None None None None
4 None None None None Rick Thomas Company None None MfuqnemFQBY2RwqM7YBkKA== NaN NaN NaN True wf9VogLxiOoQJExQ13q6Vw== ulhLv5btm8B/N7JURh1/+w== iFbCAfBS66w7LWV2PbAhCg== GweXup29BdjkT9BjcSkzPQ== 001q0000010PXTEAA4 None Qpg7BeLyzCKCLjC+t73WaA== NaN None Air1Prg9Tsiw3UANemom6g== qvC68WCtjj4ClzOUWJSkCw== bnxaENqWaHK61C0CuTdesA== pixghWKhHJrqHD4kBeM6Gw== False +6N+ddY6amrzExJicFCd3w== None NaN None None None None None None None None
5 None None None None None None None Fbu50LvyXo0peN4RaMdJ3A== NaN NaN NaN True None ulhLv5btm8B/N7JURh1/+w== ziZgHawN6hOLcpXwK3Ygpw== J/YOmfl+qwv6i4jsHY+ujQ== 001q0000013WMSUAA4 yCBcdjbnKNRIwndOakqUSw== Po0RXrSzK56UefOH2+FO4Q== NaN None nqxS50kwRjtOYb9ZB4/PoQ== UisBzX5S+vz7B0xHE4v4bg== auObPzjeIkCwKijyu7QQCw== None True HVkg9LRLJ6gCvXfE8FNvWg== None 120210.0 None None None None None None None None
6 None None None None None None None MfuqnemFQBY2RwqM7YBkKA== NaN NaN NaN True None ulhLv5btm8B/N7JURh1/+w== iFbCAfBS66w7LWV2PbAhCg== 1fQ7foJAfJKZX7Ndu+Celg== 001q0000010Pe9xAAC None Qpg7BeLyzCKCLjC+t73WaA== NaN None AwxR76rxgr77EfSnTHH57Q== None None zYXs9P+yNjgg8uwZvFV8PQ== True jcDRlq9Jxi7l0+tk1aTTdg== None NaN None None None None None None None None
7 None None None None None None None 4sUcAmMzCJTMD0K4Qnsiog== NaN NaN NaN True None ulhLv5btm8B/N7JURh1/+w== iFbCAfBS66w7LWV2PbAhCg== gbEQmTQh/HHUsuesIq+NFw== 001q0000010QZZ7AAO None None NaN None AwxR76rxgr77EfSnTHH57Q== None None None False None None NaN None None None None None None None None
8 None None None None None None None 4sUcAmMzCJTMD0K4Qnsiog== NaN NaN NaN True None ulhLv5btm8B/N7JURh1/+w== iFbCAfBS66w7LWV2PbAhCg== 3RgfHUrW6KCagqoD/sdXyA== 001q0000010PiFMAA0 None None NaN None AwxR76rxgr77EfSnTHH57Q== None None None False None None NaN None None None None None None None None
9 None None None None Balto Dog Company None None MfuqnemFQBY2RwqM7YBkKA== NaN NaN NaN True None ulhLv5btm8B/N7JURh1/+w== iFbCAfBS66w7LWV2PbAhCg== sibCUUkOHR2dqeGf+xov+A== 001q0000010kZLuAAM yCBcdjbnKNRIwndOakqUSw== Qpg7BeLyzCKCLjC+t73WaA== NaN None AwxR76rxgr77EfSnTHH57Q== XBbaBQNtkym1SAcPiKF1UA== bnxaENqWaHK61C0CuTdesA== pixghWKhHJrqHD4kBeM6Gw== True +Z00MuxehkeqPQlcxh/nBA== None NaN None None None None None None None None

stg_sf_account_data.sql (clean the table)

-- COCOON BLOCK START: PLEASE DO NOT MODIFY THIS BLOCK FOR SELF-MAINTENANCE
WITH 
"sf_account_data_projected" AS (
    -- Projection: Selecting 49 out of 50 columns
    -- Columns projected out: ['_fivetran_synced']
    SELECT 
        "account_number",
        "account_source",
        "annual_revenue",
        "billing_city",
        "billing_country",
        "billing_country_code",
        "billing_geocode_accuracy",
        "billing_latitude",
        "billing_longitude",
        "billing_postal_code",
        "billing_state",
        "billing_state_code",
        "billing_street",
        "description",
        "fax",
        "id",
        "industry",
        "is_deleted",
        "jigsaw_company_id",
        "last_activity_date",
        "last_referenced_date",
        "last_viewed_date",
        "master_record_id",
        "name",
        "number_of_employees",
        "owner_id",
        "ownership",
        "parent_id",
        "phone",
        "photo_url",
        "rating",
        "record_type_id",
        "shipping_city",
        "shipping_country",
        "shipping_country_code",
        "shipping_geocode_accuracy",
        "shipping_latitude",
        "shipping_longitude",
        "shipping_postal_code",
        "shipping_state",
        "shipping_state_code",
        "shipping_street",
        "sic",
        "sic_desc",
        "site",
        "ticker_symbol",
        "type",
        "website",
        "_fivetran_active"
    FROM "sf_account_data"
),

"sf_account_data_projected_renamed" AS (
    -- Rename: Renaming columns
    -- description -> account_description
    -- fax -> fax_number
    -- id -> account_id
    -- name -> account_name
    -- number_of_employees -> employee_count
    -- ownership -> ownership_type
    -- parent_id -> parent_account_id
    -- phone -> phone_number
    -- photo_url -> account_photo_url
    -- rating -> account_rating
    -- sic -> sic_code
    -- sic_desc -> sic_description
    -- site -> account_site
    -- type -> account_type
    -- website -> account_website
    -- _fivetran_active -> is_active
    SELECT 
        "account_number",
        "account_source",
        "annual_revenue",
        "billing_city",
        "billing_country",
        "billing_country_code",
        "billing_geocode_accuracy",
        "billing_latitude",
        "billing_longitude",
        "billing_postal_code",
        "billing_state",
        "billing_state_code",
        "billing_street",
        "description" AS "account_description",
        "fax" AS "fax_number",
        "id" AS "account_id",
        "industry",
        "is_deleted",
        "jigsaw_company_id",
        "last_activity_date",
        "last_referenced_date",
        "last_viewed_date",
        "master_record_id",
        "name" AS "account_name",
        "number_of_employees" AS "employee_count",
        "owner_id",
        "ownership" AS "ownership_type",
        "parent_id" AS "parent_account_id",
        "phone" AS "phone_number",
        "photo_url" AS "account_photo_url",
        "rating" AS "account_rating",
        "record_type_id",
        "shipping_city",
        "shipping_country",
        "shipping_country_code",
        "shipping_geocode_accuracy",
        "shipping_latitude",
        "shipping_longitude",
        "shipping_postal_code",
        "shipping_state",
        "shipping_state_code",
        "shipping_street",
        "sic" AS "sic_code",
        "sic_desc" AS "sic_description",
        "site" AS "account_site",
        "ticker_symbol",
        "type" AS "account_type",
        "website" AS "account_website",
        "_fivetran_active" AS "is_active"
    FROM "sf_account_data_projected"
),

"sf_account_data_projected_renamed_cleaned" AS (
    -- Clean unusual string values: 
    -- billing_city: The problem is that all values in the billing_city column are encrypted or encoded strings instead of readable city names. This makes the data unusable for analysis or display purposes. The correct values should be decrypted city names, but without access to the decryption key or method, it's impossible to determine the actual city names these represent. 
    -- billing_country: The problem is that the billing_country column contains an encoded string '8lPv4wLTKrJkp24M5lvnaQ==' instead of clear country names. This encoded string appears to be the only value in the column and doesn't represent any recognizable country information. The correct values should be actual country names or codes, but without additional information or a decryption key, it's impossible to determine what this encoded string represents. 
    -- billing_country_code: The problem is that the value 'dRb9Q62qXguKZaZyw5hF0g==' appears to be an encoded string, likely in Base64 format. This is unusual for a country code field, which typically contains 2-3 letter ISO country codes (e.g., 'US', 'CA', 'GB'). Without additional information to decode this string or map it to actual country codes, it's impossible to determine the correct values. The encoded string may be masking the actual country codes for privacy or security reasons. 
    -- billing_state: The problem is that all values in the billing_state column are encoded strings, likely using base64 encoding, instead of readable state names. These encoded values do not provide any meaningful information about the actual billing states. The correct values should be the actual state names or abbreviations. 
    -- account_name: The problem is that there are multiple test accounts ('Blue Test', 'Test 123', 'Test 1234', "Eric's Test", 'Testins Opp Close', 'allbound ID test') which are likely not real accounts and should be removed. There's also inconsistency in naming formats, with some using possessive forms ("Eric's Test") and others using company names ('Rick Thomas Company'). The correct values should be real account names in a consistent format, preferably company names where applicable. 
    -- shipping_country: The problem is that the shipping_country column contains an encoded or encrypted value '8lPv4wLTKrJkp24M5lvnaQ==' instead of a recognizable country name. This value appears to be a Base64 encoded string, which is not a valid representation for a country. The correct values should be actual country names or codes. Without additional information to decode this value, it's impossible to determine the intended country. Therefore, the safest approach is to map this unusual value to an empty string to indicate missing data. 
    -- shipping_country_code: The problem is that the value 'dRb9Q62qXguKZaZyw5hF0g==' is not a standard country code. It appears to be an encrypted or encoded string, possibly due to data anonymization or a processing error. Standard country codes are typically 2 or 3 letter codes (like 'US' for United States or 'GBR' for Great Britain). Without additional information or a decryption key, it's impossible to determine what country this code represents.  
    SELECT
        "account_number",
        "account_source",
        "annual_revenue",
        CASE
            WHEN "billing_city" = 'ZxAK+LCOBzw7p/TeJwdYSw==' THEN ''
            WHEN "billing_city" = 'n9oradGMpYOT/QxsY/psmw==' THEN ''
            WHEN "billing_city" = 'W08cDivYvBunJs1R3XDBpg==' THEN ''
            ELSE "billing_city"
        END AS "billing_city",
        CASE
            WHEN "billing_country" = '8lPv4wLTKrJkp24M5lvnaQ==' THEN ''
            ELSE "billing_country"
        END AS "billing_country",
        CASE
            WHEN "billing_country_code" = 'dRb9Q62qXguKZaZyw5hF0g==' THEN ''
            ELSE "billing_country_code"
        END AS "billing_country_code",
        "billing_geocode_accuracy",
        "billing_latitude",
        "billing_longitude",
        "billing_postal_code",
        CASE
            WHEN "billing_state" = 'FeSUdeQlOf7tk/xcziXTyw==' THEN ''
            WHEN "billing_state" = 'mAzuwdui02wrqGf2g7R4OA==' THEN ''
            WHEN "billing_state" = 'NWd5qaFpZxRID1f6P7ZtTA==' THEN ''
            ELSE "billing_state"
        END AS "billing_state",
        "billing_state_code",
        "billing_street",
        "account_description",
        "fax_number",
        "account_id",
        "industry",
        "is_deleted",
        "jigsaw_company_id",
        "last_activity_date",
        "last_referenced_date",
        "last_viewed_date",
        "master_record_id",
        CASE
            WHEN "account_name" = 'Blue Test' THEN ''
            WHEN "account_name" = 'Test 123' THEN ''
            WHEN "account_name" = 'Test 1234' THEN ''
            WHEN "account_name" = 'Eric''s Test' THEN ''
            WHEN "account_name" = 'Testins Opp Close' THEN ''
            WHEN "account_name" = 'allbound ID test' THEN ''
            WHEN "account_name" = 'Balto Dog' THEN 'Balto Dog Company'
            WHEN "account_name" = 'Seinfeld' THEN 'Seinfeld Company'
            ELSE "account_name"
        END AS "account_name",
        "employee_count",
        "owner_id",
        "ownership_type",
        "parent_account_id",
        "phone_number",
        "account_photo_url",
        "account_rating",
        "record_type_id",
        "shipping_city",
        CASE
            WHEN "shipping_country" = '8lPv4wLTKrJkp24M5lvnaQ==' THEN ''
            ELSE "shipping_country"
        END AS "shipping_country",
        CASE
            WHEN "shipping_country_code" = 'dRb9Q62qXguKZaZyw5hF0g==' THEN ''
            ELSE "shipping_country_code"
        END AS "shipping_country_code",
        "shipping_geocode_accuracy",
        "shipping_latitude",
        "shipping_longitude",
        "shipping_postal_code",
        "shipping_state",
        "shipping_state_code",
        "shipping_street",
        "sic_code",
        "sic_description",
        "account_site",
        "ticker_symbol",
        "account_type",
        "account_website",
        "is_active"
    FROM "sf_account_data_projected_renamed"
),

"sf_account_data_projected_renamed_cleaned_null" AS (
    -- NULL Imputation: Impute Null to Disguised Missing Values
    -- billing_city: ['']
    -- billing_country: ['']
    -- billing_country_code: ['']
    -- billing_state: ['']
    -- account_name: ['']
    -- shipping_country: ['']
    -- shipping_country_code: ['']
    SELECT 
        CASE
            WHEN "billing_city" = '' THEN NULL
            ELSE "billing_city"
        END AS "billing_city",
        CASE
            WHEN "billing_country" = '' THEN NULL
            ELSE "billing_country"
        END AS "billing_country",
        CASE
            WHEN "billing_country_code" = '' THEN NULL
            ELSE "billing_country_code"
        END AS "billing_country_code",
        CASE
            WHEN "billing_state" = '' THEN NULL
            ELSE "billing_state"
        END AS "billing_state",
        CASE
            WHEN "account_name" = '' THEN NULL
            ELSE "account_name"
        END AS "account_name",
        CASE
            WHEN "shipping_country" = '' THEN NULL
            ELSE "shipping_country"
        END AS "shipping_country",
        CASE
            WHEN "shipping_country_code" = '' THEN NULL
            ELSE "shipping_country_code"
        END AS "shipping_country_code",
        "account_source",
        "shipping_postal_code",
        "shipping_longitude",
        "shipping_city",
        "shipping_state_code",
        "shipping_latitude",
        "annual_revenue",
        "employee_count",
        "parent_account_id",
        "billing_longitude",
        "is_deleted",
        "account_description",
        "record_type_id",
        "account_type",
        "account_photo_url",
        "account_id",
        "jigsaw_company_id",
        "ticker_symbol",
        "industry",
        "sic_description",
        "shipping_street",
        "billing_state_code",
        "last_viewed_date",
        "billing_latitude",
        "account_number",
        "last_referenced_date",
        "ownership_type",
        "master_record_id",
        "shipping_geocode_accuracy",
        "fax_number",
        "owner_id",
        "account_rating",
        "account_site",
        "shipping_state",
        "billing_street",
        "billing_postal_code",
        "billing_geocode_accuracy",
        "sic_code",
        "phone_number",
        "is_active",
        "account_website",
        "last_activity_date"
    FROM "sf_account_data_projected_renamed_cleaned"
),

"sf_account_data_projected_renamed_cleaned_null_casted" AS (
    -- Column Type Casting: 
    -- account_number: from DECIMAL to VARCHAR
    -- account_rating: from DECIMAL to VARCHAR
    -- account_site: from DECIMAL to VARCHAR
    -- annual_revenue: from DECIMAL to VARCHAR
    -- billing_geocode_accuracy: from DECIMAL to VARCHAR
    -- employee_count: from DECIMAL to INT
    -- fax_number: from DECIMAL to VARCHAR
    -- jigsaw_company_id: from DECIMAL to VARCHAR
    -- last_activity_date: from DECIMAL to DATE
    -- last_referenced_date: from DECIMAL to DATE
    -- last_viewed_date: from DECIMAL to DATE
    -- ownership_type: from DECIMAL to VARCHAR
    -- parent_account_id: from DECIMAL to VARCHAR
    -- shipping_city: from DECIMAL to VARCHAR
    -- shipping_geocode_accuracy: from DECIMAL to VARCHAR
    -- shipping_postal_code: from DECIMAL to VARCHAR
    -- shipping_state: from DECIMAL to VARCHAR
    -- shipping_state_code: from DECIMAL to VARCHAR
    -- shipping_street: from DECIMAL to VARCHAR
    -- sic_code: from DECIMAL to VARCHAR
    -- sic_description: from DECIMAL to VARCHAR
    -- ticker_symbol: from DECIMAL to VARCHAR
    SELECT
        "billing_city",
        "billing_country",
        "billing_country_code",
        "billing_state",
        "account_name",
        "shipping_country",
        "shipping_country_code",
        "account_source",
        "shipping_longitude",
        "shipping_latitude",
        "billing_longitude",
        "is_deleted",
        "account_description",
        "record_type_id",
        "account_type",
        "account_photo_url",
        "account_id",
        "industry",
        "billing_state_code",
        "billing_latitude",
        "master_record_id",
        "owner_id",
        "billing_street",
        "billing_postal_code",
        "phone_number",
        "is_active",
        "account_website",
        CAST("account_number" AS VARCHAR) AS "account_number",
        CAST("account_rating" AS VARCHAR) AS "account_rating",
        CAST("account_site" AS VARCHAR) AS "account_site",
        CAST("annual_revenue" AS VARCHAR) AS "annual_revenue",
        CAST("billing_geocode_accuracy" AS VARCHAR) AS "billing_geocode_accuracy",
        CAST("employee_count" AS INT) AS "employee_count",
        CAST("fax_number" AS VARCHAR) AS "fax_number",
        CAST("jigsaw_company_id" AS VARCHAR) AS "jigsaw_company_id",
        CAST("last_activity_date" AS DATE) AS "last_activity_date",
        CAST("last_referenced_date" AS DATE) AS "last_referenced_date",
        CAST("last_viewed_date" AS DATE) AS "last_viewed_date",
        CAST("ownership_type" AS VARCHAR) AS "ownership_type",
        CAST("parent_account_id" AS VARCHAR) AS "parent_account_id",
        CAST("shipping_city" AS VARCHAR) AS "shipping_city",
        CAST("shipping_geocode_accuracy" AS VARCHAR) AS "shipping_geocode_accuracy",
        CAST("shipping_postal_code" AS VARCHAR) AS "shipping_postal_code",
        CAST("shipping_state" AS VARCHAR) AS "shipping_state",
        CAST("shipping_state_code" AS VARCHAR) AS "shipping_state_code",
        CAST("shipping_street" AS VARCHAR) AS "shipping_street",
        CAST("sic_code" AS VARCHAR) AS "sic_code",
        CAST("sic_description" AS VARCHAR) AS "sic_description",
        CAST("ticker_symbol" AS VARCHAR) AS "ticker_symbol"
    FROM "sf_account_data_projected_renamed_cleaned_null"
),

"sf_account_data_projected_renamed_cleaned_null_casted_missing_handled" AS (
    -- Handling missing values: There are 20 columns with unacceptable missing values
    -- account_description has 90.0 percent missing. Strategy: 🔄 Unchanged
    -- account_name has 70.0 percent missing. Strategy: 🔄 Unchanged
    -- account_number has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- account_rating has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- account_site has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- account_source has 20.0 percent missing. Strategy: 🔄 Unchanged
    -- account_website has 40.0 percent missing. Strategy: 🔄 Unchanged
    -- annual_revenue has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- employee_count has 90.0 percent missing. Strategy: 🔄 Unchanged
    -- industry has 80.0 percent missing. Strategy: 🔄 Unchanged
    -- jigsaw_company_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_activity_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_referenced_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_viewed_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- master_record_id has 90.0 percent missing. Strategy: 🔄 Unchanged
    -- ownership_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- phone_number has 50.0 percent missing. Strategy: 🔄 Unchanged
    -- sic_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- sic_description has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- ticker_symbol has 100.0 percent missing. Strategy: 🗑️ Drop Column
    SELECT
        "billing_city",
        "billing_country",
        "billing_country_code",
        "billing_state",
        "account_name",
        "shipping_country",
        "shipping_country_code",
        "account_source",
        "shipping_longitude",
        "shipping_latitude",
        "billing_longitude",
        "is_deleted",
        "account_description",
        "record_type_id",
        "account_type",
        "account_photo_url",
        "account_id",
        "industry",
        "billing_state_code",
        "billing_latitude",
        "master_record_id",
        "owner_id",
        "billing_street",
        "billing_postal_code",
        "phone_number",
        "is_active",
        "account_website",
        "billing_geocode_accuracy",
        "employee_count",
        "fax_number",
        "parent_account_id",
        "shipping_city",
        "shipping_geocode_accuracy",
        "shipping_postal_code",
        "shipping_state",
        "shipping_state_code",
        "shipping_street"
    FROM "sf_account_data_projected_renamed_cleaned_null_casted"
)

-- COCOON BLOCK END
SELECT * FROM "sf_account_data_projected_renamed_cleaned_null_casted_missing_handled"

stg_sf_account_data.yml (Document the table)

version: 2
models:
- name: stg_sf_account_data
  description: The table is about account data. It contains details like account number,
    source, revenue, billing/shipping address, industry, employees, ownership, and
    contact information. Some fields are encrypted. The table includes both active
    and deleted accounts. Each row represents a unique account with an ID and various
    associated attributes.
  columns:
  - name: billing_city
    description: City for billing address
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical billing address.
  - name: billing_country
    description: Country for billing address
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical billing address.
  - name: billing_country_code
    description: Country code for billing address
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical billing address.
  - name: billing_state
    description: State for billing address
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical billing address.
  - name: account_name
    description: Name of the account
    tests:
    - not_null
  - name: shipping_country
    description: Country for shipping address
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical shipping address.
  - name: shipping_country_code
    description: Country code for shipping address
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical shipping address.
  - name: account_source
    description: Origin or channel of the account
    tests:
    - not_null
  - name: shipping_longitude
    description: Longitude of shipping address
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical shipping address.
  - name: shipping_latitude
    description: Latitude of shipping address
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical shipping address.
  - name: billing_longitude
    description: Longitude coordinate of billing address
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical billing address.
  - name: is_deleted
    description: Indicates if the account has been deleted
    tests:
    - not_null
  - name: account_description
    description: Additional details about the account
    tests:
    - not_null
  - name: record_type_id
    description: Identifier for the record type
    tests:
    - not_null
  - name: account_type
    description: Type of account
    tests:
    - not_null
  - name: account_photo_url
    description: URL of the account's photo or logo
    tests:
    - not_null
  - name: account_id
    description: Unique identifier for the account record
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column is described as a unique identifier for the account
        record. In database design, such fields are typically used as primary keys
        to ensure each row can be uniquely identified. For this table, where each
        row represents a unique account, the account_id should be unique across all
        rows.
  - name: industry
    description: Industry sector of the account
    tests:
    - not_null
  - name: billing_state_code
    description: State code for billing address
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical billing address.
  - name: billing_latitude
    description: Latitude coordinate of billing address
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical billing address.
  - name: master_record_id
    description: ID of the master record if duplicates exist
    tests:
    - not_null
  - name: owner_id
    description: ID of the account owner
    tests:
    - not_null
  - name: billing_street
    description: Street address for billing
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical billing address.
  - name: billing_postal_code
    description: Postal code for billing address
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical billing address.
  - name: phone_number
    description: Phone number of the account
    tests:
    - not_null
  - name: is_active
    description: Indicates if the account is currently active
    tests:
    - not_null
  - name: account_website
    description: Website URL of the account
    tests:
    - not_null
  - name: billing_geocode_accuracy
    description: Accuracy of billing address geocoding
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical billing address.
  - name: employee_count
    description: Total number of employees in the company
    tests:
    - not_null
  - name: fax_number
    description: Fax number of the account
    cocoon_meta:
      missing_acceptable: Not applicable for companies not using fax communications.
  - name: parent_account_id
    description: ID of the parent account if applicable
    cocoon_meta:
      missing_acceptable: Not applicable for companies without a parent company.
  - name: shipping_city
    description: City for shipping address
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical shipping address.
  - name: shipping_geocode_accuracy
    description: Accuracy of shipping address geocoding
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical shipping address.
  - name: shipping_postal_code
    description: Postal code for shipping address
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical shipping address.
  - name: shipping_state
    description: State for shipping address
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical shipping address.
  - name: shipping_state_code
    description: State code for shipping address
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical shipping address.
  - name: shipping_street
    description: Street address for shipping
    cocoon_meta:
      missing_acceptable: Not applicable for companies without physical shipping address.

stg_sf_user_role_data (first 100 rows)

is_deleted case_access_level contact_access_level developer_name role_id can_manager_share_forecast role_name opportunity_access_level parent_role_id portal_type rollup_description is_active forecast_user_id
0 False fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== gjEPJnSSl2rmO0PmZT0r/A== StB7ADpIfsOKUVMS9KkJWw== False ev8AzWxVDGisAlHLhbswRw== fc4SIASWnVauLgJFy3VNNQ== p7fMKkVg9kprXiWdBNBwqg== at+X+DrPZFPUpqSxBw83VA== ev8AzWxVDGisAlHLhbswRw== True None
1 False fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== kgb2Y/pX2KDN31aThxXgHg== Pb7q3GyRtA1b+mjhRsCisw== False stoIWxwAppBt1wOf0ZrEXw== fc4SIASWnVauLgJFy3VNNQ== p7fMKkVg9kprXiWdBNBwqg== at+X+DrPZFPUpqSxBw83VA== stoIWxwAppBt1wOf0ZrEXw== True None
2 False fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== DW8qGW+liKrQFN672JebZQ== M2E7lAPWS91Qs5fLzFxciQ== False DpYNTT8JrVEsoGY/4jQu4A== fc4SIASWnVauLgJFy3VNNQ== p7fMKkVg9kprXiWdBNBwqg== at+X+DrPZFPUpqSxBw83VA== DpYNTT8JrVEsoGY/4jQu4A== True None
3 False fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== iuNkhc167Xlxl98P3iZgAw== /UCbUKKXllVd2xJJlKrNSw== False F2ZX+UKPrvm19As4fX6CeQ== fc4SIASWnVauLgJFy3VNNQ== p7fMKkVg9kprXiWdBNBwqg== at+X+DrPZFPUpqSxBw83VA== F2ZX+UKPrvm19As4fX6CeQ== True None
4 False fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== n4VWekp/jNT2t6w9lNiAZw== xp0Oq/pisjhX72tBE4KOAA== False +my2KWVrmQnbKPv+YhiwVQ== fc4SIASWnVauLgJFy3VNNQ== p7fMKkVg9kprXiWdBNBwqg== at+X+DrPZFPUpqSxBw83VA== +my2KWVrmQnbKPv+YhiwVQ== False None
5 False fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== fAEAoSTZ7wrrU27I5qf2cQ== ymq/lUMQgqZHw/9y2pM7Cg== False tpCgPeRuZXAwk5cHws8dPg== fc4SIASWnVauLgJFy3VNNQ== M2E7lAPWS91Qs5fLzFxciQ== at+X+DrPZFPUpqSxBw83VA== tpCgPeRuZXAwk5cHws8dPg== True None
6 False fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== Z0Mk929e09pi7cgzdIz9Yw== wFbcjrjZKNwzPncwnz82xg== False zEtr4yiL7ZjlvxI8zM5sYg== fc4SIASWnVauLgJFy3VNNQ== Pb7q3GyRtA1b+mjhRsCisw== at+X+DrPZFPUpqSxBw83VA== zEtr4yiL7ZjlvxI8zM5sYg== True None
7 False fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== hYkEw+Jm9WQL+ojxbS7VCg== 3xphSR7VKJYclzXoEfA1AA== False hYkEw+Jm9WQL+ojxbS7VCg== fc4SIASWnVauLgJFy3VNNQ== aDWPUItc1uc9iqJvMkP82Q== at+X+DrPZFPUpqSxBw83VA== hYkEw+Jm9WQL+ojxbS7VCg== True None
8 False fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== 7TSN2+DRJ/0CXrS7htzhVQ== BUKMwDbqRIBsdYfaEti1VQ== False j+MFtw9z6uGsU88K1p90qA== fc4SIASWnVauLgJFy3VNNQ== StB7ADpIfsOKUVMS9KkJWw== at+X+DrPZFPUpqSxBw83VA== j+MFtw9z6uGsU88K1p90qA== True None
9 False fc4SIASWnVauLgJFy3VNNQ== fc4SIASWnVauLgJFy3VNNQ== y8Us3rZt0z6bUo0S/+JAgw== SdtcfRp1CirkHIEFxtA2/Q== False qwT73r52PFdwFtgbRdOD0A== fc4SIASWnVauLgJFy3VNNQ== StB7ADpIfsOKUVMS9KkJWw== at+X+DrPZFPUpqSxBw83VA== qwT73r52PFdwFtgbRdOD0A== False None

stg_sf_user_role_data.sql (clean the table)

-- COCOON BLOCK START: PLEASE DO NOT MODIFY THIS BLOCK FOR SELF-MAINTENANCE
WITH 
"sf_user_role_data_projected" AS (
    -- Projection: Selecting 13 out of 14 columns
    -- Columns projected out: ['_fivetran_synced']
    SELECT 
        "_fivetran_deleted",
        "case_access_for_account_owner",
        "contact_access_for_account_owner",
        "developer_name",
        "forecast_user_id",
        "id",
        "may_forecast_manager_share",
        "name",
        "opportunity_access_for_account_owner",
        "parent_role_id",
        "portal_type",
        "rollup_description",
        "_fivetran_active"
    FROM "sf_user_role_data"
),

"sf_user_role_data_projected_renamed" AS (
    -- Rename: Renaming columns
    -- _fivetran_deleted -> is_deleted
    -- case_access_for_account_owner -> case_access_level
    -- contact_access_for_account_owner -> contact_access_level
    -- id -> role_id
    -- may_forecast_manager_share -> can_manager_share_forecast
    -- name -> role_name
    -- opportunity_access_for_account_owner -> opportunity_access_level
    -- _fivetran_active -> is_active
    SELECT 
        "_fivetran_deleted" AS "is_deleted",
        "case_access_for_account_owner" AS "case_access_level",
        "contact_access_for_account_owner" AS "contact_access_level",
        "developer_name",
        "forecast_user_id",
        "id" AS "role_id",
        "may_forecast_manager_share" AS "can_manager_share_forecast",
        "name" AS "role_name",
        "opportunity_access_for_account_owner" AS "opportunity_access_level",
        "parent_role_id",
        "portal_type",
        "rollup_description",
        "_fivetran_active" AS "is_active"
    FROM "sf_user_role_data_projected"
),

"sf_user_role_data_projected_renamed_casted" AS (
    -- Column Type Casting: 
    -- forecast_user_id: from DECIMAL to VARCHAR
    SELECT
        "is_deleted",
        "case_access_level",
        "contact_access_level",
        "developer_name",
        "role_id",
        "can_manager_share_forecast",
        "role_name",
        "opportunity_access_level",
        "parent_role_id",
        "portal_type",
        "rollup_description",
        "is_active",
        CAST("forecast_user_id" AS VARCHAR) AS "forecast_user_id"
    FROM "sf_user_role_data_projected_renamed"
)

-- COCOON BLOCK END
SELECT * FROM "sf_user_role_data_projected_renamed_casted"

stg_sf_user_role_data.yml (Document the table)

version: 2
models:
- name: stg_sf_user_role_data
  description: The table is about user roles in a system. It contains details like
    role name, developer name, access levels for different objects (case, contact,
    opportunity), forecast permissions, parent role, and portal type. Each role has
    a unique ID and additional flags for deletion and activity status. The table likely
    represents a hierarchical structure of user roles with varying permissions.
  columns:
  - name: is_deleted
    description: Indicates if the role has been deleted
    tests:
    - not_null
  - name: case_access_level
    description: Access level for case objects for account owners
    tests:
    - not_null
    - accepted_values:
        values:
        - No Access
        - Read Only
        - Read/Write
        - Full Access
        - fc4SIASWnVauLgJFy3VNNQ==
  - name: contact_access_level
    description: Access level for contact objects for account owners
    tests:
    - not_null
    - accepted_values:
        values:
        - No Access
        - Read Only
        - Read/Write
        - Full Access
        - Custom
        - fc4SIASWnVauLgJFy3VNNQ==
  - name: developer_name
    description: Unique identifier for developers to reference the role
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column represents a unique identifier for developers to reference
        the role. For this table, each row represents a unique user role. The developer_name
        appears to be unique across rows in the sample data.
  - name: role_id
    description: Unique identifier for the role
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column represents a unique identifier for the role. For this
        table, each row represents a unique user role. The role_id appears to be unique
        across rows in the sample data and is likely intended to be the primary key
        for this table.
  - name: can_manager_share_forecast
    description: Indicates if manager can share forecasts
    tests:
    - not_null
  - name: role_name
    description: Name of the role
    tests:
    - not_null
  - name: opportunity_access_level
    description: Access level for opportunity objects for account owners
    tests:
    - not_null
    - accepted_values:
        values:
        - No Access
        - Read Only
        - Read/Write
        - Full Access
        - fc4SIASWnVauLgJFy3VNNQ==
  - name: parent_role_id
    description: ID of the parent role in hierarchy
    tests:
    - not_null
  - name: portal_type
    description: Type of portal associated with the role
    tests:
    - not_null
    - accepted_values:
        values:
        - Customer
        - Employee
        - Partner
        - Vendor
        - Supplier
        - Investor
        - Public
        - Internal
        - External
        - Admin
        - Member
        - Guest
        - at+X+DrPZFPUpqSxBw83VA==
  - name: rollup_description
    description: Description for roll-up summary calculations
    tests:
    - not_null
  - name: is_active
    description: Indicates if the role is currently active
    tests:
    - not_null
  - name: forecast_user_id
    description: ID of the user responsible for forecasts
    cocoon_meta:
      missing_acceptable: Not applicable for users who aren't forecast users.

stg_sf_account_history_data (first 100 rows)

account_name shipping_country account_source record_id is_deleted record_type_id industry master_record_id encrypted_website owner_id billing_street description billing_postal_code encrypted_account_type is_active employee_count parent_account_id shipping_city shipping_postal_code shipping_state shipping_street valid_from valid_until
0 None None None 0015500000Xyy06AAB False ulhLv5btm8B/N7JURh1/+w== None None None tqs6UXPA/Lm7W+0dX0+syw== None None None ziZgHawN6hOLcpXwK3Ygpw== True None None None None None None 2019-10-17 21:10:19 NaT
1 Seinfeld Company None TDK+SgtPSM3Vk67zX9aeRA== 0015500000Ygpq1AAB True ulhLv5btm8B/N7JURh1/+w== None L4izOo4yZpLq5io5YM8pvA== None soS8gWpPTwLhsepmOnEc0w== None None None ziZgHawN6hOLcpXwK3Ygpw== True None None None None None None 2019-10-17 21:33:00 NaT
2 None None None 001q000000wW9BeAAK True ulhLv5btm8B/N7JURh1/+w== None None ye4O0TtPzpTBUyS5TfSNig== Air1Prg9Tsiw3UANemom6g== 2YEqg12uvpIXyu6aR9mQlg== None gnzLDuqKcGxMNKFokfhOew== iFbCAfBS66w7LWV2PbAhCg== True None None None None None None 2019-04-04 18:36:06 NaT
3 None None 4sUcAmMzCJTMD0K4Qnsiog== 001q000000wW9BZAA0 True ulhLv5btm8B/N7JURh1/+w== None None ye4O0TtPzpTBUyS5TfSNig== Air1Prg9Tsiw3UANemom6g== 2YEqg12uvpIXyu6aR9mQlg== None gnzLDuqKcGxMNKFokfhOew== iFbCAfBS66w7LWV2PbAhCg== True None None None None None None 2019-04-04 18:36:06 NaT
4 Rick Thomas Company None MfuqnemFQBY2RwqM7YBkKA== 001q0000010PXTEAA4 True ulhLv5btm8B/N7JURh1/+w== None None +6N+ddY6amrzExJicFCd3w== Air1Prg9Tsiw3UANemom6g== qvC68WCtjj4ClzOUWJSkCw== wf9VogLxiOoQJExQ13q6Vw== bnxaENqWaHK61C0CuTdesA== iFbCAfBS66w7LWV2PbAhCg== False None None None None None None 2019-04-04 18:36:06 2019-04-04 18:36:07
5 None None Fbu50LvyXo0peN4RaMdJ3A== 001q0000013WMSUAA4 True ulhLv5btm8B/N7JURh1/+w== yCBcdjbnKNRIwndOakqUSw== None HVkg9LRLJ6gCvXfE8FNvWg== nqxS50kwRjtOYb9ZB4/PoQ== UisBzX5S+vz7B0xHE4v4bg== None auObPzjeIkCwKijyu7QQCw== ziZgHawN6hOLcpXwK3Ygpw== True 120210.0 None None None None None 2019-04-04 18:36:06 NaT
6 None None MfuqnemFQBY2RwqM7YBkKA== 001q0000010Pe9xAAC True ulhLv5btm8B/N7JURh1/+w== None None jcDRlq9Jxi7l0+tk1aTTdg== AwxR76rxgr77EfSnTHH57Q== None None None iFbCAfBS66w7LWV2PbAhCg== True None None None None None None 2019-04-04 18:36:06 NaT
7 None None 4sUcAmMzCJTMD0K4Qnsiog== 001q0000010QZZ7AAO True ulhLv5btm8B/N7JURh1/+w== None None None AwxR76rxgr77EfSnTHH57Q== None None None iFbCAfBS66w7LWV2PbAhCg== False None None None None None None 2019-04-04 18:36:06 2019-04-04 18:36:07
8 None None 4sUcAmMzCJTMD0K4Qnsiog== 001q0000010PiFMAA0 True ulhLv5btm8B/N7JURh1/+w== None None None AwxR76rxgr77EfSnTHH57Q== None None None iFbCAfBS66w7LWV2PbAhCg== False None None None None None None 2019-04-04 18:36:06 2019-04-04 18:36:07
9 Balto Dog Company None MfuqnemFQBY2RwqM7YBkKA== 001q0000010kZLuAAM True ulhLv5btm8B/N7JURh1/+w== yCBcdjbnKNRIwndOakqUSw== None +Z00MuxehkeqPQlcxh/nBA== AwxR76rxgr77EfSnTHH57Q== XBbaBQNtkym1SAcPiKF1UA== None bnxaENqWaHK61C0CuTdesA== iFbCAfBS66w7LWV2PbAhCg== True None None None None None None 2019-04-04 18:36:06 NaT

stg_sf_account_history_data.sql (clean the table)

-- COCOON BLOCK START: PLEASE DO NOT MODIFY THIS BLOCK FOR SELF-MAINTENANCE
WITH 
"sf_account_history_data_projected" AS (
    -- Projection: Selecting 33 out of 34 columns
    -- Columns projected out: ['_fivetran_synced']
    SELECT 
        "_fivetran_active",
        "_fivetran_start",
        "_fivetran_end",
        "account_number",
        "account_source",
        "annual_revenue",
        "billing_city",
        "billing_country",
        "billing_postal_code",
        "billing_state",
        "billing_street",
        "description",
        "id",
        "industry",
        "is_deleted",
        "last_activity_date",
        "last_referenced_date",
        "last_viewed_date",
        "master_record_id",
        "name",
        "number_of_employees",
        "owner_id",
        "ownership",
        "parent_id",
        "rating",
        "record_type_id",
        "shipping_city",
        "shipping_country",
        "shipping_postal_code",
        "shipping_state",
        "shipping_street",
        "type",
        "website"
    FROM "sf_account_history_data"
),

"sf_account_history_data_projected_renamed" AS (
    -- Rename: Renaming columns
    -- _fivetran_active -> is_active
    -- _fivetran_start -> valid_from
    -- _fivetran_end -> valid_until
    -- id -> record_id
    -- name -> account_name
    -- number_of_employees -> employee_count
    -- ownership -> ownership_type
    -- parent_id -> parent_account_id
    -- rating -> account_rating
    -- type -> encrypted_account_type
    -- website -> encrypted_website
    SELECT 
        "_fivetran_active" AS "is_active",
        "_fivetran_start" AS "valid_from",
        "_fivetran_end" AS "valid_until",
        "account_number",
        "account_source",
        "annual_revenue",
        "billing_city",
        "billing_country",
        "billing_postal_code",
        "billing_state",
        "billing_street",
        "description",
        "id" AS "record_id",
        "industry",
        "is_deleted",
        "last_activity_date",
        "last_referenced_date",
        "last_viewed_date",
        "master_record_id",
        "name" AS "account_name",
        "number_of_employees" AS "employee_count",
        "owner_id",
        "ownership" AS "ownership_type",
        "parent_id" AS "parent_account_id",
        "rating" AS "account_rating",
        "record_type_id",
        "shipping_city",
        "shipping_country",
        "shipping_postal_code",
        "shipping_state",
        "shipping_street",
        "type" AS "encrypted_account_type",
        "website" AS "encrypted_website"
    FROM "sf_account_history_data_projected"
),

"sf_account_history_data_projected_renamed_cleaned" AS (
    -- Clean unusual string values: 
    -- billing_city: The problem is that all values in the billing_city column are encrypted or encoded strings instead of readable city names. This makes the data unusable for analysis or display purposes. The correct values should be decrypted city names, but without access to the decryption key or method, it's impossible to determine the actual city names these represent. 
    -- billing_country: The problem is that the billing_country column contains an encoded string '8lPv4wLTKrJkp24M5lvnaQ==' instead of clear country names. This encoded string appears to be the only value in the column and doesn't represent any recognizable country information. The correct values should be actual country names or codes, but without additional information or a decryption key, it's impossible to determine what this encoded string represents. 
    -- billing_state: The problem is that all values in the billing_state column are encoded strings, likely using base64 encoding, instead of readable state names. These encoded values do not provide any meaningful information about the actual billing states. The correct values should be the actual state names or abbreviations. 
    -- account_name: The problem is that there are multiple test accounts ('Blue Test', 'Test 123', 'Test 1234', "Eric's Test", 'Testins Opp Close', 'allbound ID test') which are likely not real accounts and should be removed. There's also inconsistency in naming formats, with some using possessive forms ("Eric's Test") and others using company names ('Rick Thomas Company'). The correct values should be real account names in a consistent format, preferably company names where applicable. 
    -- shipping_country: The problem is that the shipping_country column contains an encoded or encrypted value '8lPv4wLTKrJkp24M5lvnaQ==' instead of a recognizable country name. This value appears to be a Base64 encoded string, which is not a valid representation for a country. The correct values should be actual country names or codes. Without additional information to decode this value, it's impossible to determine the intended country. Therefore, the safest approach is to map this unusual value to an empty string to indicate missing data. 
    SELECT
        "is_active",
        "valid_from",
        "valid_until",
        "account_number",
        "account_source",
        "annual_revenue",
        CASE
            WHEN "billing_city" = 'ZxAK+LCOBzw7p/TeJwdYSw==' THEN ''
            WHEN "billing_city" = 'n9oradGMpYOT/QxsY/psmw==' THEN ''
            WHEN "billing_city" = 'W08cDivYvBunJs1R3XDBpg==' THEN ''
            ELSE "billing_city"
        END AS "billing_city",
        CASE
            WHEN "billing_country" = '8lPv4wLTKrJkp24M5lvnaQ==' THEN ''
            ELSE "billing_country"
        END AS "billing_country",
        "billing_postal_code",
        CASE
            WHEN "billing_state" = 'FeSUdeQlOf7tk/xcziXTyw==' THEN ''
            WHEN "billing_state" = 'mAzuwdui02wrqGf2g7R4OA==' THEN ''
            WHEN "billing_state" = 'NWd5qaFpZxRID1f6P7ZtTA==' THEN ''
            ELSE "billing_state"
        END AS "billing_state",
        "billing_street",
        "description",
        "record_id",
        "industry",
        "is_deleted",
        "last_activity_date",
        "last_referenced_date",
        "last_viewed_date",
        "master_record_id",
        CASE
            WHEN "account_name" = 'Blue Test' THEN ''
            WHEN "account_name" = 'Test 123' THEN ''
            WHEN "account_name" = 'Test 1234' THEN ''
            WHEN "account_name" = 'Eric''s Test' THEN ''
            WHEN "account_name" = 'Testins Opp Close' THEN ''
            WHEN "account_name" = 'allbound ID test' THEN ''
            WHEN "account_name" = 'Balto Dog' THEN 'Balto Dog Company'
            WHEN "account_name" = 'Seinfeld' THEN 'Seinfeld Company'
            ELSE "account_name"
        END AS "account_name",
        "employee_count",
        "owner_id",
        "ownership_type",
        "parent_account_id",
        "account_rating",
        "record_type_id",
        "shipping_city",
        CASE
            WHEN "shipping_country" = '8lPv4wLTKrJkp24M5lvnaQ==' THEN ''
            ELSE "shipping_country"
        END AS "shipping_country",
        "shipping_postal_code",
        "shipping_state",
        "shipping_street",
        "encrypted_account_type",
        "encrypted_website"
    FROM "sf_account_history_data_projected_renamed"
),

"sf_account_history_data_projected_renamed_cleaned_null" AS (
    -- NULL Imputation: Impute Null to Disguised Missing Values
    -- valid_until: ['9999-12-31 23:59:59']
    -- billing_city: ['']
    -- billing_country: ['']
    -- billing_state: ['']
    -- account_name: ['']
    -- shipping_country: ['']
    SELECT 
        CASE
            WHEN "valid_until" = '9999-12-31 23:59:59' THEN NULL
            ELSE "valid_until"
        END AS "valid_until",
        CASE
            WHEN "billing_city" = '' THEN NULL
            ELSE "billing_city"
        END AS "billing_city",
        CASE
            WHEN "billing_country" = '' THEN NULL
            ELSE "billing_country"
        END AS "billing_country",
        CASE
            WHEN "billing_state" = '' THEN NULL
            ELSE "billing_state"
        END AS "billing_state",
        CASE
            WHEN "account_name" = '' THEN NULL
            ELSE "account_name"
        END AS "account_name",
        CASE
            WHEN "shipping_country" = '' THEN NULL
            ELSE "shipping_country"
        END AS "shipping_country",
        "account_source",
        "record_id",
        "shipping_postal_code",
        "shipping_city",
        "annual_revenue",
        "employee_count",
        "parent_account_id",
        "is_deleted",
        "record_type_id",
        "industry",
        "shipping_street",
        "last_viewed_date",
        "account_number",
        "last_referenced_date",
        "ownership_type",
        "master_record_id",
        "encrypted_website",
        "owner_id",
        "account_rating",
        "shipping_state",
        "billing_street",
        "description",
        "billing_postal_code",
        "valid_from",
        "encrypted_account_type",
        "is_active",
        "last_activity_date"
    FROM "sf_account_history_data_projected_renamed_cleaned"
),

"sf_account_history_data_projected_renamed_cleaned_null_casted" AS (
    -- Column Type Casting: 
    -- account_number: from DECIMAL to VARCHAR
    -- account_rating: from DECIMAL to VARCHAR
    -- annual_revenue: from DECIMAL to VARCHAR
    -- employee_count: from DECIMAL to VARCHAR
    -- last_activity_date: from DECIMAL to DATE
    -- last_referenced_date: from DECIMAL to DATE
    -- last_viewed_date: from DECIMAL to DATE
    -- ownership_type: from DECIMAL to VARCHAR
    -- parent_account_id: from DECIMAL to VARCHAR
    -- shipping_city: from DECIMAL to VARCHAR
    -- shipping_postal_code: from DECIMAL to VARCHAR
    -- shipping_state: from DECIMAL to VARCHAR
    -- shipping_street: from DECIMAL to VARCHAR
    -- valid_from: from VARCHAR to TIMESTAMP
    -- valid_until: from VARCHAR to TIMESTAMP
    SELECT
        "billing_city",
        "billing_country",
        "billing_state",
        "account_name",
        "shipping_country",
        "account_source",
        "record_id",
        "is_deleted",
        "record_type_id",
        "industry",
        "master_record_id",
        "encrypted_website",
        "owner_id",
        "billing_street",
        "description",
        "billing_postal_code",
        "encrypted_account_type",
        "is_active",
        CAST("account_number" AS VARCHAR) AS "account_number",
        CAST("account_rating" AS VARCHAR) AS "account_rating",
        CAST("annual_revenue" AS VARCHAR) AS "annual_revenue",
        CAST("employee_count" AS VARCHAR) AS "employee_count",
        CAST("last_activity_date" AS DATE) AS "last_activity_date",
        CAST("last_referenced_date" AS DATE) AS "last_referenced_date",
        CAST("last_viewed_date" AS DATE) AS "last_viewed_date",
        CAST("ownership_type" AS VARCHAR) AS "ownership_type",
        CAST("parent_account_id" AS VARCHAR) AS "parent_account_id",
        CAST("shipping_city" AS VARCHAR) AS "shipping_city",
        CAST("shipping_postal_code" AS VARCHAR) AS "shipping_postal_code",
        CAST("shipping_state" AS VARCHAR) AS "shipping_state",
        CAST("shipping_street" AS VARCHAR) AS "shipping_street",
        CAST("valid_from" AS TIMESTAMP) AS "valid_from",
        CAST("valid_until" AS TIMESTAMP) AS "valid_until"
    FROM "sf_account_history_data_projected_renamed_cleaned_null"
),

"sf_account_history_data_projected_renamed_cleaned_null_casted_missing_handled" AS (
    -- Handling missing values: There are 20 columns with unacceptable missing values
    -- account_name has 70.0 percent missing. Strategy: 🔄 Unchanged
    -- account_number has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- account_rating has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- account_source has 20.0 percent missing. Strategy: 🔄 Unchanged
    -- annual_revenue has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- billing_city has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- billing_country has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- billing_postal_code has 50.0 percent missing. Strategy: 🔄 Unchanged
    -- billing_state has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- billing_street has 50.0 percent missing. Strategy: 🔄 Unchanged
    -- description has 90.0 percent missing. Strategy: 🔄 Unchanged
    -- employee_count has 90.0 percent missing. Strategy: 🔄 Unchanged
    -- encrypted_website has 40.0 percent missing. Strategy: 🔄 Unchanged
    -- industry has 80.0 percent missing. Strategy: 🔄 Unchanged
    -- last_activity_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_referenced_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_viewed_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- master_record_id has 90.0 percent missing. Strategy: 🔄 Unchanged
    -- ownership_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- valid_until has 70.0 percent missing. Strategy: 🔄 Unchanged
    SELECT
        "account_name",
        "shipping_country",
        "account_source",
        "record_id",
        "is_deleted",
        "record_type_id",
        "industry",
        "master_record_id",
        "encrypted_website",
        "owner_id",
        "billing_street",
        "description",
        "billing_postal_code",
        "encrypted_account_type",
        "is_active",
        "employee_count",
        "parent_account_id",
        "shipping_city",
        "shipping_postal_code",
        "shipping_state",
        "shipping_street",
        "valid_from",
        "valid_until"
    FROM "sf_account_history_data_projected_renamed_cleaned_null_casted"
)

-- COCOON BLOCK END
SELECT * FROM "sf_account_history_data_projected_renamed_cleaned_null_casted_missing_handled"

stg_sf_account_history_data.yml (Document the table)

version: 2
models:
- name: stg_sf_account_history_data
  description: The table is about Salesforce account data. It contains account details
    like name, billing/shipping address, industry, and other metadata. Some fields
    are encrypted. The table tracks changes over time with _fivetran columns for data
    pipeline management. Each row represents an account record at a specific point
    in time.
  columns:
  - name: account_name
    description: Name of the account
    tests:
    - not_null
  - name: shipping_country
    description: Country for shipping address
    cocoon_meta:
      missing_acceptable: Not applicable if the account has no shipping address.
  - name: account_source
    description: Origin or source of the account
    tests:
    - not_null
  - name: record_id
    description: Unique identifier for the record
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column is a unique identifier for each record. For this table,
        each row represents a distinct account record, and the record_id appears to
        be a unique identifier for each row.
  - name: is_deleted
    description: Indicates if the record is deleted
    tests:
    - not_null
  - name: record_type_id
    description: ID of the record type
    tests:
    - not_null
  - name: industry
    description: Industry sector of the account
    tests:
    - not_null
  - name: master_record_id
    description: ID of the master record if merged
    tests:
    - not_null
  - name: encrypted_website
    description: Encrypted website URL of the account
    tests:
    - not_null
  - name: owner_id
    description: ID of the account owner
    tests:
    - not_null
  - name: billing_street
    description: Street address for billing
    tests:
    - not_null
  - name: description
    description: Additional details about the account
    tests:
    - not_null
  - name: billing_postal_code
    description: Postal code for billing address
    tests:
    - not_null
  - name: encrypted_account_type
    description: Encrypted account type or category
    tests:
    - not_null
  - name: is_active
    description: Indicates if the record is currently active
    tests:
    - not_null
  - name: employee_count
    description: Total number of employees in the company
    tests:
    - not_null
  - name: parent_account_id
    description: ID of the parent account if exists
    cocoon_meta:
      missing_acceptable: Not applicable if the account is not a subsidiary.
  - name: shipping_city
    description: City for shipping address
    cocoon_meta:
      missing_acceptable: Not applicable if the account has no shipping address.
  - name: shipping_postal_code
    description: Postal code for shipping address
    cocoon_meta:
      missing_acceptable: Not applicable if the account has no shipping address.
  - name: shipping_state
    description: State for shipping address
    cocoon_meta:
      missing_acceptable: Not applicable if the account has no shipping address.
  - name: shipping_street
    description: Shipping street address of the account
    cocoon_meta:
      missing_acceptable: Not applicable if the account has no shipping address.
  - name: valid_from
    description: Start timestamp for record validity
    tests:
    - not_null
  - name: valid_until
    description: End timestamp for record validity
    tests:
    - not_null

stg_sf_contact_data (first 100 rows)

associated_url secondary_latitude mailing_country account_id pushed_from_opportunity mailing_street is_eu_resident last_name mailing_country_code created_by_id photo_url clearbit_id source_detail email_quality_unknown email_bounced email last_modified_by_id lean_data_routing_action no_longer_at_company push_to_netsuite mailing_city description is_email_bounced needs_score_sync do_not_route_lead lead_source clearbit_data_ready phone email_hard_bounced secondary_longitude job_title email_opt_out created_by_clearbit name mailing_state mailing_state_code netsuite_celigo_update owner_id netsuite_sync_in_progress contact_status do_not_call marketing_campaign contact_id clearbit_role clearbit_seniority clearbit_sub_role created_date email_bounce_date email_bounce_reason email_opt_out_timestamp fax_opt_out first_activity_post_mql first_activity_post_mql_date first_manual_activity_post_mql_date first_mql_date free_trial_confirmation_date has_attended_event has_changed_job has_referral is_billing_contact_hidden is_competitor is_hot_contact is_technical_contact last_contact_attempt last_customer_request_date last_customer_update_date last_modified_date last_modified_timestamp last_sdr_activity_date last_sdr_activity_owner lead_grade lead_score mailing_postal_code mql_date mql_date_changed mql_reason phone_extension pi_created_date_c secondary_city secondary_country secondary_email secondary_geocode_accuracy secondary_phone secondary_postal_code secondary_state secondary_street stripe_customer_level stripe_default_gateway stripe_default_payment_method stripe_encrypted_personal_id stripe_encrypted_ssn_last_4 stripe_gender stripe_languages stripe_maiden_name stripe_personal_id_number stripe_personal_id_type stripe_ssn_last_4
0 None NaN None None NaN None NaN None None None None None None NaN NaN None None None NaN NaN None None NaN NaN NaN None NaN None NaN NaN None NaN NaN None None None NaN None NaN None NaN None 0033700000JmrFPAA None None None 2019-11-11 17:23:34 NaT None NaT NaN NaT NaT NaT NaT NaT NaN NaN NaN NaN NaN NaN NaN NaT NaT NaT 2019-11-11 17:23:34 2019-11-11 17:23:34 NaT None None NaN None NaT NaT None None 2019-11-11 17:23:34 None None None None None None None None None None None None None None None None None None None
1 None NaN United States 0011G00000eM9wvQAC NaN None NaN G US 00537000004jeWMAAY /services/images/photo/0031G00000q9jPQAQ None None False False None 0051G000005MreQAC converted - new account False NaN None None False False False ZoomInfo False (555) 555-5555 False NaN Data Science Director False False Janet Yellen None None NaN 0051G000005MreQAC NaN Attempting Contact NaN None 0031G00000q9jPQAQ None None None 2019-11-11 17:23:34 NaT None NaT NaN NaT NaT NaT NaT NaT NaN NaN NaN NaN NaN NaN NaN NaT NaT NaT 2019-11-11 17:23:34 2019-11-11 17:23:34 NaT None None NaN None NaT NaT None None 2019-11-11 17:23:34 None None None None None None None None None None None None None None None None None None None
2 None NaN United States 0011G00000f8NwQAU False None False G US 00537000004jeWMAAY /services/images/photo/0031G00000rfAvuQAE None RyProspec False False None 0051G000005MreQAC converted False False None Buy our things. False False False Vendor List False None False NaN Director, Business Insights & Strategy False False Jerome Powell None None False 0051G000005MreQAC False Attempting Contact False None 0031G00000rfAvuQAE None None None 2019-11-11 17:23:34 NaT None NaT NaN NaT NaT NaT NaT NaT NaN NaN NaN NaN NaN NaN NaN NaT NaT NaT 2019-11-11 17:23:34 2019-11-11 17:23:34 NaT None None NaN None NaT NaT None None 2019-11-11 17:23:34 None None None None None None None None None None None None None None None None None None None
3 http://pi.pardo.com/prospec/read?id=396093715 NaN United States 0011G00000eNyiXQAS False 123 Ave NaN G US 00537000004jeWMAAY /services/images/photo/0031G00000qAfq1QAC a2G1G000000pJs8UAE None False False hi@google.com 0051G000005MreQAC converted False False Chicago Buy more. False False False ZoomInfo NaN (555) 555-5555 False NaN Marketing Director False False Jerome Powell Illinois IL False 0051G000005MreQAC False Attempting Contact NaN Salesforce Created 0031G00000qAfq1QAC None None None 2019-11-11 17:23:34 NaT None NaT NaN NaT NaT NaT NaT NaT NaN NaN NaN NaN NaN NaN NaN NaT NaT NaT 2019-11-11 17:23:34 2019-11-11 17:23:34 NaT None None NaN 55555.0 NaT NaT None None 2019-11-11 17:23:34 None None None None None None None None None None None None None None None None None None None

stg_sf_contact_data.sql (clean the table)

-- COCOON BLOCK START: PLEASE DO NOT MODIFY THIS BLOCK FOR SELF-MAINTENANCE
WITH 
"sf_contact_data_removeWideColumns" AS (
    -- Remove wide columns with pattern. The regex and columns are:
    -- ^bizible_\d+_.*_(ft|lc)_c$: bizible_2_ad_campaign_name_ft_c, bizible_2_ad_campaign_name_lc_c, bizible_2_landing_page_ft_c, bizible_2_landing_page_lc_c, bizible_2_marketing_channel_ft_c, bizible_2_marketing_channel_lc_c, bizible_2_touchpoint_date_ft_c, bizible_2_touchpoint_date_lc_c, bizible_2_touchpoint_source_ft_c, bizible_2_touchpoint_source_lc_c
    -- ^cloudingo_agent_\w+_c$: cloudingo_agent_ces_c, cloudingo_agent_mar_c, cloudingo_agent_mas_c, cloudingo_agent_mav_c, cloudingo_agent_mrdi_c, cloudingo_agent_mtz_c, cloudingo_agent_oar_c, cloudingo_agent_oas_c, cloudingo_agent_oav_c, cloudingo_agent_ordi_c ...
    -- ^engagio_.*_c$: engagio_department_c, engagio_engagement_minutes_last_3_months_c, engagio_engagement_minutes_last_7_days_c, engagio_first_engagement_date_c, engagio_intent_minutes_last_30_days_c, engagio_role_c
    -- ^es_app_es.*_c$: es_app_escreated_timestamp_c, es_app_esecid_c, es_app_esenriched_c, es_app_esenriched_timestamp_c, es_app_esintent_aggregate_score_c, es_app_esintent_timestamp_c, es_app_esintent_topics_c, es_app_esoverall_fit_score_c, es_app_essource_c
    -- ^fivetran_.*_c$: fivetran_account_association_date_c, fivetran_account_id_c, fivetran_account_user_role_s_c, fivetran_user_id_c
    -- ^mkto_71_contact_.*$: mkto_71_contact_acquisition_date_c, mkto_71_contact_acquisition_program_c, mkto_71_contact_acquisition_program_id_c, mkto_71_contact_inferred_city_c, mkto_71_contact_inferred_company_c, mkto_71_contact_inferred_country_c, mkto_71_contact_inferred_metropolitan_a_c, mkto_71_contact_inferred_phone_area_cod_c, mkto_71_contact_inferred_postal_code_c, mkto_71_contact_inferred_state_region_c ...
    -- ^mkto_si_.*$: mkto_si_hide_date_c, mkto_si_last_interesting_moment_date_c, mkto_si_last_interesting_moment_desc_c, mkto_si_last_interesting_moment_source_c, mkto_si_last_interesting_moment_type_c, mkto_si_mkto_lead_score_c, mkto_si_priority_c, mkto_si_relative_score_value_c, mkto_si_urgency_value_c
    -- ^rh_2_\w+_test_c$: rh_2_currency_test_c, rh_2_integer_test_c
    -- ^sales_loft_1_most_recent_.*$: sales_loft_1_most_recent_cadence_name_c, sales_loft_1_most_recent_cadence_next_step_due_date_c, sales_loft_1_most_recent_last_completed_step_c
    -- ^utm_.*_c$: utm_campaign_c, utm_content_c, utm_id_c, utm_medium_c, utm_source_c, utm_term_c
    SELECT 
        "_fivetran_active",
        "_fivetran_synced",
        "account_id",
        "act_on_lead_score_c",
        "active_relationship_c",
        "adgroupid_c",
        "allbound_id_c",
        "analytics_id_c",
        "assistant_name",
        "assistant_phone",
        "attempting_contact_date_time_c",
        "attended_event_c",
        "automation_tracking_c",
        "avatar_c",
        "behavioral_score_c",
        "beta_connector_interest_c",
        "bill_to_contact_hidden_c",
        "birthdate",
        "bizible_2_bizible_id_c",
        "bt_stripe_default_payment_gateway_c",
        "bt_stripe_default_payment_method_c",
        "bt_stripe_gender_c",
        "bt_stripe_languages_c",
        "bt_stripe_level_c",
        "bt_stripe_maiden_name_c",
        "bt_stripe_personal_id_number_c",
        "bt_stripe_personal_id_number_encrypted_c",
        "bt_stripe_personal_id_type_c",
        "bt_stripe_ssn_last_4_c",
        "bt_stripe_ssn_last_4_encrypted_c",
        "campaignid_c",
        "cbit_clearbit_c",
        "cbit_clearbit_ready_c",
        "cbit_created_by_clearbit_c",
        "celigo_sfnsio_net_suite_id_c",
        "celigo_sfnsio_net_suite_record_c",
        "celigo_sfnsio_net_suite_sync_error_c",
        "celigo_sfnsio_skip_export_to_net_suite_c",
        "celigo_sfnsio_test_mode_record_c",
        "city_c",
        "clarus_date_c",
        "clarus_editor_c",
        "clarus_notes_c",
        "clarus_project_c",
        "clarus_status_c",
        "clearbit_role_c",
        "clearbit_seniority_c",
        "clearbit_sub_role_c",
        "company_c",
        "competitor_c",
        "contact_holdover_c",
        "contact_owners_manager_stamped_c",
        "contact_stage_c",
        "contact_status_c",
        "contact_type_c",
        "contacts_domain_exists_c",
        "country_c",
        "country_code_c",
        "created_at_c",
        "created_by_id",
        "created_by_role_c",
        "created_date",
        "creative_c",
        "csi_code_c",
        "demographic_score_c",
        "department",
        "description",
        "device_c",
        "direct_office_c",
        "dnb_contact_phone_c",
        "dnb_email_c",
        "dnb_email_deliverability_score_c",
        "dnb_job_title_c",
        "dnb_phone_accuracy_score_c",
        "dnb_primary_address_city_c",
        "dnb_primary_address_country_region_code_c",
        "dnb_primary_address_postal_code_c",
        "dnb_primary_address_state_province_abbre_c",
        "dnb_primary_address_state_province_c",
        "dnboptimizer_dn_bcontact_record_c",
        "do_not_call",
        "do_not_route_lead_c",
        "do_not_sync_marketo_c",
        "do_not_sync_reason_marketo_c",
        "dozisf_zoom_info_company_id_c",
        "dozisf_zoom_info_first_updated_c",
        "dozisf_zoom_info_id_c",
        "dozisf_zoom_info_last_updated_c",
        "drift_cql_c",
        "email",
        "email_bounced_c",
        "email_bounced_date",
        "email_bounced_reason",
        "email_opt_in_double_c",
        "email_opt_in_explicit_c",
        "email_opt_in_implicit_c",
        "email_opt_out_date_time_c",
        "email_quality_unknown_c",
        "enrichment_request_c",
        "es_seniority_c",
        "fax",
        "first_activity_after_mql_changed_c",
        "first_activity_after_mql_date_c",
        "first_manual_activity_after_mql_date_c",
        "first_mql_date_c",
        "first_name",
        "free_trial_email_confirmed_date_c",
        "gclid_c",
        "gdpr_opt_in_explicit_c",
        "has_opted_out_of_email",
        "has_opted_out_of_fax",
        "historical_contact_status_c",
        "home_phone",
        "hot_contact_c",
        "hvr_update_c",
        "i_sell_avention_id_c",
        "id",
        "individual_id",
        "ironclad_workflow_c",
        "is_deleted",
        "is_email_bounced",
        "is_emea_event_routing_c",
        "is_eu_resident_c",
        "jigsaw",
        "jigsaw_contact_id",
        "job_function_c",
        "job_level_c",
        "keyword_c",
        "last_activity_date",
        "last_ae_activity_owner_c",
        "last_bdr_activity_owner_c",
        "last_curequest_date",
        "last_cuupdate_date",
        "last_manual_ae_activity_date_c",
        "last_manual_bdr_activity_date_c",
        "last_marketing_interesting_moment_date_c",
        "last_modified_by_id",
        "last_modified_date",
        "last_name",
        "last_referenced_date",
        "last_sales_activity_date_time_c",
        "last_sdr_activity_date_c",
        "last_sdr_activity_owner_c",
        "last_viewed_date",
        "lead_source",
        "lean_data_ld_segment_c",
        "lean_data_manual_route_trigger_c",
        "lean_data_matched_buyer_persona_c",
        "lean_data_modified_score_c",
        "lean_data_router_completion_date_time_c",
        "lean_data_routing_action_c",
        "lean_data_status_info_c",
        "lean_data_tag_c",
        "leandata_contact_owner_override_c",
        "legacy_hvr_id_c",
        "lid_linked_in_company_id_c",
        "lid_linked_in_member_token_c",
        "linked_in_url_c",
        "mailing_city",
        "mailing_country",
        "mailing_country_code",
        "mailing_geocode_accuracy",
        "mailing_latitude",
        "mailing_longitude",
        "mailing_postal_code",
        "mailing_state",
        "mailing_state_code",
        "mailing_street",
        "marketing_connector_interest_c",
        "marketing_process_c",
        "master_record_id",
        "matchtype_c",
        "mc_4_sf_mc_subscriber_c",
        "meta_data_create_date_c",
        "mobile_phone",
        "mql_date_c",
        "mql_date_changed_c",
        "mql_reason_c",
        "name",
        "netsuite_conn_celigo_update_c",
        "netsuite_conn_net_suite_id_c",
        "netsuite_conn_net_suite_sync_err_c",
        "netsuite_conn_push_to_net_suite_c",
        "netsuite_conn_pushed_from_opportunity_c",
        "netsuite_conn_sync_in_progress_c",
        "network_c",
        "no_geo_data_c",
        "no_longer_at_company_c",
        "notes_c",
        "old_lead_source_c",
        "old_lead_source_detail_c",
        "opp_handoff_ae_c",
        "opportunity_c",
        "original_utm_campaign_c",
        "original_utm_content_c",
        "original_utm_medium_c",
        "original_utm_source_c",
        "original_utm_term_c",
        "other_city",
        "other_country",
        "other_geocode_accuracy",
        "other_latitude",
        "other_longitude",
        "other_phone",
        "other_postal_code",
        "other_state",
        "other_street",
        "owner_id",
        "partner_company_c",
        "partner_contact_c",
        "partner_contact_deprecate_c",
        "partner_rep_email_c",
        "partner_rep_name_c",
        "partner_territory_c",
        "pbf_startup_certify_eligibility_c",
        "pbf_startup_primary_role_c",
        "persona_c",
        "phone",
        "phone_extension_c",
        "phone_number_catch_all_c",
        "photo_url",
        "pi_campaign_c",
        "pi_comments_c",
        "pi_conversion_date_c",
        "pi_conversion_object_name_c",
        "pi_conversion_object_type_c",
        "pi_created_date_c",
        "pi_first_activity_c",
        "pi_first_search_term_c",
        "pi_first_search_type_c",
        "pi_first_touch_url_c",
        "pi_grade_c",
        "pi_last_activity_c",
        "pi_needs_score_synced_c",
        "pi_notes_c",
        "pi_pardot_hard_bounced_c",
        "pi_pardot_last_scored_at_c",
        "pi_score_c",
        "pi_url_c",
        "pi_utm_campaign_c",
        "pi_utm_content_c",
        "pi_utm_medium_c",
        "pi_utm_source_c",
        "pi_utm_term_c",
        "potential_fivetran_use_case_c",
        "primary_se_c",
        "promotion_id_c",
        "recent_marketing_campaign_status_c",
        "referral_account_c",
        "referral_contact_c",
        "referral_exists_c",
        "referral_first_name_c",
        "referral_last_name_c",
        "region_c",
        "reports_to_id",
        "rh_2_describe_c",
        "routed_from_manual_bdr_ae_activity_c",
        "sales_email_opt_out_c",
        "sales_email_opt_out_date_time_c",
        "salesloft_cadence_trigger_c",
        "salesloft_owner_c",
        "salesloft_owner_sf_c",
        "salutation",
        "secondary_email_c",
        "self_service_routing_c",
        "source_detail_c",
        "source_last_lead_source_c",
        "source_last_lead_source_category_c",
        "source_last_lead_source_detail_c",
        "state_c",
        "state_code_c",
        "system_modstamp",
        "technical_contact_c",
        "title",
        "to_be_deleted_salesloft_backfill_c",
        "trial_contact_start_date_c",
        "unique_email_c",
        "unqualified_reason_c",
        "user_activity_logged_by_c",
        "user_gems_has_changed_job_c",
        "user_gems_is_a_user_gem_c",
        "user_gems_past_account_c",
        "user_gems_past_company_c",
        "user_gems_past_contact_c",
        "user_gems_past_title_c",
        "user_gems_ug_created_by_ug_c",
        "user_gems_ug_current_infos_c",
        "user_gems_ug_past_infos_c",
        "user_gems_user_gems_id_c",
        "username_c",
        "verified_c",
        "zoominfo_technologies_c"
    FROM "sf_contact_data"
),

"sf_contact_data_removeWideColumns_projected" AS (
    -- Projection: Selecting 291 out of 292 columns
    -- Columns projected out: ['_fivetran_synced']
    SELECT 
        "_fivetran_active",
        "account_id",
        "act_on_lead_score_c",
        "active_relationship_c",
        "adgroupid_c",
        "allbound_id_c",
        "analytics_id_c",
        "assistant_name",
        "assistant_phone",
        "attempting_contact_date_time_c",
        "attended_event_c",
        "automation_tracking_c",
        "avatar_c",
        "behavioral_score_c",
        "beta_connector_interest_c",
        "bill_to_contact_hidden_c",
        "birthdate",
        "bizible_2_bizible_id_c",
        "bt_stripe_default_payment_gateway_c",
        "bt_stripe_default_payment_method_c",
        "bt_stripe_gender_c",
        "bt_stripe_languages_c",
        "bt_stripe_level_c",
        "bt_stripe_maiden_name_c",
        "bt_stripe_personal_id_number_c",
        "bt_stripe_personal_id_number_encrypted_c",
        "bt_stripe_personal_id_type_c",
        "bt_stripe_ssn_last_4_c",
        "bt_stripe_ssn_last_4_encrypted_c",
        "campaignid_c",
        "cbit_clearbit_c",
        "cbit_clearbit_ready_c",
        "cbit_created_by_clearbit_c",
        "celigo_sfnsio_net_suite_id_c",
        "celigo_sfnsio_net_suite_record_c",
        "celigo_sfnsio_net_suite_sync_error_c",
        "celigo_sfnsio_skip_export_to_net_suite_c",
        "celigo_sfnsio_test_mode_record_c",
        "city_c",
        "clarus_date_c",
        "clarus_editor_c",
        "clarus_notes_c",
        "clarus_project_c",
        "clarus_status_c",
        "clearbit_role_c",
        "clearbit_seniority_c",
        "clearbit_sub_role_c",
        "company_c",
        "competitor_c",
        "contact_holdover_c",
        "contact_owners_manager_stamped_c",
        "contact_stage_c",
        "contact_status_c",
        "contact_type_c",
        "contacts_domain_exists_c",
        "country_c",
        "country_code_c",
        "created_at_c",
        "created_by_id",
        "created_by_role_c",
        "created_date",
        "creative_c",
        "csi_code_c",
        "demographic_score_c",
        "department",
        "description",
        "device_c",
        "direct_office_c",
        "dnb_contact_phone_c",
        "dnb_email_c",
        "dnb_email_deliverability_score_c",
        "dnb_job_title_c",
        "dnb_phone_accuracy_score_c",
        "dnb_primary_address_city_c",
        "dnb_primary_address_country_region_code_c",
        "dnb_primary_address_postal_code_c",
        "dnb_primary_address_state_province_abbre_c",
        "dnb_primary_address_state_province_c",
        "dnboptimizer_dn_bcontact_record_c",
        "do_not_call",
        "do_not_route_lead_c",
        "do_not_sync_marketo_c",
        "do_not_sync_reason_marketo_c",
        "dozisf_zoom_info_company_id_c",
        "dozisf_zoom_info_first_updated_c",
        "dozisf_zoom_info_id_c",
        "dozisf_zoom_info_last_updated_c",
        "drift_cql_c",
        "email",
        "email_bounced_c",
        "email_bounced_date",
        "email_bounced_reason",
        "email_opt_in_double_c",
        "email_opt_in_explicit_c",
        "email_opt_in_implicit_c",
        "email_opt_out_date_time_c",
        "email_quality_unknown_c",
        "enrichment_request_c",
        "es_seniority_c",
        "fax",
        "first_activity_after_mql_changed_c",
        "first_activity_after_mql_date_c",
        "first_manual_activity_after_mql_date_c",
        "first_mql_date_c",
        "first_name",
        "free_trial_email_confirmed_date_c",
        "gclid_c",
        "gdpr_opt_in_explicit_c",
        "has_opted_out_of_email",
        "has_opted_out_of_fax",
        "historical_contact_status_c",
        "home_phone",
        "hot_contact_c",
        "hvr_update_c",
        "i_sell_avention_id_c",
        "id",
        "individual_id",
        "ironclad_workflow_c",
        "is_deleted",
        "is_email_bounced",
        "is_emea_event_routing_c",
        "is_eu_resident_c",
        "jigsaw",
        "jigsaw_contact_id",
        "job_function_c",
        "job_level_c",
        "keyword_c",
        "last_activity_date",
        "last_ae_activity_owner_c",
        "last_bdr_activity_owner_c",
        "last_curequest_date",
        "last_cuupdate_date",
        "last_manual_ae_activity_date_c",
        "last_manual_bdr_activity_date_c",
        "last_marketing_interesting_moment_date_c",
        "last_modified_by_id",
        "last_modified_date",
        "last_name",
        "last_referenced_date",
        "last_sales_activity_date_time_c",
        "last_sdr_activity_date_c",
        "last_sdr_activity_owner_c",
        "last_viewed_date",
        "lead_source",
        "lean_data_ld_segment_c",
        "lean_data_manual_route_trigger_c",
        "lean_data_matched_buyer_persona_c",
        "lean_data_modified_score_c",
        "lean_data_router_completion_date_time_c",
        "lean_data_routing_action_c",
        "lean_data_status_info_c",
        "lean_data_tag_c",
        "leandata_contact_owner_override_c",
        "legacy_hvr_id_c",
        "lid_linked_in_company_id_c",
        "lid_linked_in_member_token_c",
        "linked_in_url_c",
        "mailing_city",
        "mailing_country",
        "mailing_country_code",
        "mailing_geocode_accuracy",
        "mailing_latitude",
        "mailing_longitude",
        "mailing_postal_code",
        "mailing_state",
        "mailing_state_code",
        "mailing_street",
        "marketing_connector_interest_c",
        "marketing_process_c",
        "master_record_id",
        "matchtype_c",
        "mc_4_sf_mc_subscriber_c",
        "meta_data_create_date_c",
        "mobile_phone",
        "mql_date_c",
        "mql_date_changed_c",
        "mql_reason_c",
        "name",
        "netsuite_conn_celigo_update_c",
        "netsuite_conn_net_suite_id_c",
        "netsuite_conn_net_suite_sync_err_c",
        "netsuite_conn_push_to_net_suite_c",
        "netsuite_conn_pushed_from_opportunity_c",
        "netsuite_conn_sync_in_progress_c",
        "network_c",
        "no_geo_data_c",
        "no_longer_at_company_c",
        "notes_c",
        "old_lead_source_c",
        "old_lead_source_detail_c",
        "opp_handoff_ae_c",
        "opportunity_c",
        "original_utm_campaign_c",
        "original_utm_content_c",
        "original_utm_medium_c",
        "original_utm_source_c",
        "original_utm_term_c",
        "other_city",
        "other_country",
        "other_geocode_accuracy",
        "other_latitude",
        "other_longitude",
        "other_phone",
        "other_postal_code",
        "other_state",
        "other_street",
        "owner_id",
        "partner_company_c",
        "partner_contact_c",
        "partner_contact_deprecate_c",
        "partner_rep_email_c",
        "partner_rep_name_c",
        "partner_territory_c",
        "pbf_startup_certify_eligibility_c",
        "pbf_startup_primary_role_c",
        "persona_c",
        "phone",
        "phone_extension_c",
        "phone_number_catch_all_c",
        "photo_url",
        "pi_campaign_c",
        "pi_comments_c",
        "pi_conversion_date_c",
        "pi_conversion_object_name_c",
        "pi_conversion_object_type_c",
        "pi_created_date_c",
        "pi_first_activity_c",
        "pi_first_search_term_c",
        "pi_first_search_type_c",
        "pi_first_touch_url_c",
        "pi_grade_c",
        "pi_last_activity_c",
        "pi_needs_score_synced_c",
        "pi_notes_c",
        "pi_pardot_hard_bounced_c",
        "pi_pardot_last_scored_at_c",
        "pi_score_c",
        "pi_url_c",
        "pi_utm_campaign_c",
        "pi_utm_content_c",
        "pi_utm_medium_c",
        "pi_utm_source_c",
        "pi_utm_term_c",
        "potential_fivetran_use_case_c",
        "primary_se_c",
        "promotion_id_c",
        "recent_marketing_campaign_status_c",
        "referral_account_c",
        "referral_contact_c",
        "referral_exists_c",
        "referral_first_name_c",
        "referral_last_name_c",
        "region_c",
        "reports_to_id",
        "rh_2_describe_c",
        "routed_from_manual_bdr_ae_activity_c",
        "sales_email_opt_out_c",
        "sales_email_opt_out_date_time_c",
        "salesloft_cadence_trigger_c",
        "salesloft_owner_c",
        "salesloft_owner_sf_c",
        "salutation",
        "secondary_email_c",
        "self_service_routing_c",
        "source_detail_c",
        "source_last_lead_source_c",
        "source_last_lead_source_category_c",
        "source_last_lead_source_detail_c",
        "state_c",
        "state_code_c",
        "system_modstamp",
        "technical_contact_c",
        "title",
        "to_be_deleted_salesloft_backfill_c",
        "trial_contact_start_date_c",
        "unique_email_c",
        "unqualified_reason_c",
        "user_activity_logged_by_c",
        "user_gems_has_changed_job_c",
        "user_gems_is_a_user_gem_c",
        "user_gems_past_account_c",
        "user_gems_past_company_c",
        "user_gems_past_contact_c",
        "user_gems_past_title_c",
        "user_gems_ug_created_by_ug_c",
        "user_gems_ug_current_infos_c",
        "user_gems_ug_past_infos_c",
        "user_gems_user_gems_id_c",
        "username_c",
        "verified_c",
        "zoominfo_technologies_c"
    FROM "sf_contact_data_removeWideColumns"
),

"sf_contact_data_removeWideColumns_projected_renamed" AS (
    -- Rename: Renaming columns
    -- _fivetran_active -> is_active
    -- act_on_lead_score_c -> act_on_lead_score
    -- active_relationship_c -> is_relationship_active
    -- adgroupid_c -> ad_group_id
    -- allbound_id_c -> allbound_id
    -- analytics_id_c -> analytics_id
    -- attempting_contact_date_time_c -> last_contact_attempt
    -- attended_event_c -> has_attended_event
    -- automation_tracking_c -> automation_tracking
    -- avatar_c -> avatar_url
    -- behavioral_score_c -> behavioral_score
    -- beta_connector_interest_c -> beta_connector_interest
    -- bill_to_contact_hidden_c -> is_billing_contact_hidden
    -- bizible_2_bizible_id_c -> bizible_id
    -- bt_stripe_default_payment_gateway_c -> stripe_default_gateway
    -- bt_stripe_default_payment_method_c -> stripe_default_payment_method
    -- bt_stripe_gender_c -> stripe_gender
    -- bt_stripe_languages_c -> stripe_languages
    -- bt_stripe_level_c -> stripe_customer_level
    -- bt_stripe_maiden_name_c -> stripe_maiden_name
    -- bt_stripe_personal_id_number_c -> stripe_personal_id_number
    -- bt_stripe_personal_id_number_encrypted_c -> stripe_encrypted_personal_id
    -- bt_stripe_personal_id_type_c -> stripe_personal_id_type
    -- bt_stripe_ssn_last_4_c -> stripe_ssn_last_4
    -- bt_stripe_ssn_last_4_encrypted_c -> stripe_encrypted_ssn_last_4
    -- campaignid_c -> campaign_id
    -- cbit_clearbit_c -> clearbit_id
    -- cbit_clearbit_ready_c -> clearbit_data_ready
    -- cbit_created_by_clearbit_c -> created_by_clearbit
    -- celigo_sfnsio_net_suite_id_c -> netsuite_id
    -- celigo_sfnsio_net_suite_record_c -> netsuite_record
    -- celigo_sfnsio_skip_export_to_net_suite_c -> skip_netsuite_export
    -- celigo_sfnsio_test_mode_record_c -> test_mode_record
    -- city_c -> city
    -- clarus_date_c -> clarus_date
    -- clarus_editor_c -> clarus_editor
    -- clarus_notes_c -> clarus_notes
    -- clarus_project_c -> clarus_project
    -- clarus_status_c -> clarus_status
    -- clearbit_role_c -> clearbit_role
    -- clearbit_seniority_c -> clearbit_seniority
    -- clearbit_sub_role_c -> clearbit_sub_role
    -- company_c -> company
    -- competitor_c -> is_competitor
    -- contact_holdover_c -> contact_holdover
    -- contact_owners_manager_stamped_c -> contact_owner_manager
    -- contact_stage_c -> contact_stage
    -- contact_status_c -> contact_status
    -- contact_type_c -> contact_type
    -- contacts_domain_exists_c -> domain_exists
    -- country_c -> country
    -- country_code_c -> country_code
    -- created_at_c -> created_at
    -- created_by_role_c -> created_by_role
    -- creative_c -> creative_id
    -- csi_code_c -> csi_code
    -- demographic_score_c -> demographic_score
    -- device_c -> device_type
    -- direct_office_c -> direct_office
    -- dnb_contact_phone_c -> dnb_contact_phone
    -- dnb_email_c -> dnb_email
    -- dnb_email_deliverability_score_c -> dnb_email_deliverability_score
    -- dnb_job_title_c -> dnb_job_title
    -- dnb_phone_accuracy_score_c -> dnb_phone_accuracy_score
    -- dnb_primary_address_city_c -> dnb_primary_city
    -- dnb_primary_address_country_region_code_c -> dnb_primary_country_code
    -- dnb_primary_address_postal_code_c -> dnb_primary_postal_code
    -- dnb_primary_address_state_province_abbre_c -> dnb_primary_state_abbr
    -- dnb_primary_address_state_province_c -> dnb_primary_state
    -- dnboptimizer_dn_bcontact_record_c -> dnb_optimizer_contact_id
    -- do_not_route_lead_c -> do_not_route_lead
    -- do_not_sync_marketo_c -> do_not_sync_marketo
    -- do_not_sync_reason_marketo_c -> marketo_sync_block_reason
    -- dozisf_zoom_info_company_id_c -> zoominfo_company_id
    -- dozisf_zoom_info_first_updated_c -> zoominfo_first_updated
    -- dozisf_zoom_info_id_c -> zoominfo_contact_id
    -- dozisf_zoom_info_last_updated_c -> zoominfo_last_updated
    -- drift_cql_c -> drift_cql
    -- email_bounced_c -> email_bounced
    -- email_bounced_date -> email_bounce_date
    -- email_bounced_reason -> email_bounce_reason
    -- email_opt_in_double_c -> email_double_opt_in
    -- email_opt_in_explicit_c -> email_explicit_opt_in
    -- email_opt_in_implicit_c -> email_implicit_opt_in
    -- email_opt_out_date_time_c -> email_opt_out_timestamp
    -- email_quality_unknown_c -> email_quality_unknown
    -- enrichment_request_c -> data_enrichment_request
    -- es_seniority_c -> seniority_level
    -- fax -> fax_number
    -- first_activity_after_mql_changed_c -> first_activity_post_mql
    -- first_activity_after_mql_date_c -> first_activity_post_mql_date
    -- first_manual_activity_after_mql_date_c -> first_manual_activity_post_mql_date
    -- first_mql_date_c -> first_mql_date
    -- free_trial_email_confirmed_date_c -> free_trial_confirmation_date
    -- gclid_c -> google_click_id
    -- gdpr_opt_in_explicit_c -> gdpr_explicit_opt_in
    -- has_opted_out_of_email -> email_opt_out
    -- has_opted_out_of_fax -> fax_opt_out
    -- historical_contact_status_c -> historical_contact_status
    -- home_phone -> home_phone_number
    -- hot_contact_c -> is_hot_contact
    -- hvr_update_c -> hvr_update
    -- i_sell_avention_id_c -> isell_avention_id
    -- id -> contact_id
    -- ironclad_workflow_c -> ironclad_workflow_status
    -- is_emea_event_routing_c -> is_emea_event_routing
    -- is_eu_resident_c -> is_eu_resident
    -- jigsaw -> jigsaw_data
    -- job_function_c -> job_function
    -- job_level_c -> job_level
    -- keyword_c -> keywords
    -- last_ae_activity_owner_c -> last_ae_activity_owner
    -- last_bdr_activity_owner_c -> last_bdr_activity_owner
    -- last_curequest_date -> last_customer_request_date
    -- last_cuupdate_date -> last_customer_update_date
    -- last_manual_ae_activity_date_c -> last_manual_ae_activity_date
    -- last_manual_bdr_activity_date_c -> last_manual_bdr_activity_date
    -- last_marketing_interesting_moment_date_c -> last_marketing_moment_date
    -- last_sales_activity_date_time_c -> last_sales_activity_datetime
    -- last_sdr_activity_date_c -> last_sdr_activity_date
    -- last_sdr_activity_owner_c -> last_sdr_activity_owner
    -- lean_data_ld_segment_c -> lean_data_segment
    -- lean_data_manual_route_trigger_c -> lean_data_manual_route_trigger
    -- lean_data_matched_buyer_persona_c -> lean_data_matched_buyer_persona
    -- lean_data_modified_score_c -> lean_data_modified_score
    -- lean_data_router_completion_date_time_c -> lean_data_routing_completion_datetime
    -- lean_data_routing_action_c -> lean_data_routing_action
    -- lean_data_status_info_c -> leandata_status
    -- lean_data_tag_c -> leandata_tag
    -- leandata_contact_owner_override_c -> leandata_owner_override
    -- legacy_hvr_id_c -> legacy_hvr_id
    -- lid_linked_in_company_id_c -> linkedin_company_id
    -- lid_linked_in_member_token_c -> linkedin_member_token
    -- linked_in_url_c -> linkedin_url
    -- marketing_connector_interest_c -> marketing_connector_interest
    -- marketing_process_c -> marketing_process_status
    -- matchtype_c -> match_type
    -- mc_4_sf_mc_subscriber_c -> marketing_cloud_subscriber
    -- meta_data_create_date_c -> metadata_creation_date
    -- mql_date_c -> mql_date
    -- mql_date_changed_c -> mql_date_changed
    -- mql_reason_c -> mql_reason
    -- netsuite_conn_celigo_update_c -> netsuite_celigo_update
    -- netsuite_conn_net_suite_id_c -> netsuite_connection_id
    -- netsuite_conn_push_to_net_suite_c -> push_to_netsuite
    -- netsuite_conn_pushed_from_opportunity_c -> pushed_from_opportunity
    -- netsuite_conn_sync_in_progress_c -> netsuite_sync_in_progress
    -- network_c -> professional_network
    -- no_geo_data_c -> no_geo_data
    -- no_longer_at_company_c -> no_longer_at_company
    -- notes_c -> contact_notes
    -- old_lead_source_c -> previous_lead_source
    -- old_lead_source_detail_c -> previous_lead_source_details
    -- opp_handoff_ae_c -> opportunity_handoff_ae
    -- opportunity_c -> associated_opportunity
    -- original_utm_campaign_c -> original_utm_campaign
    -- original_utm_content_c -> original_utm_content
    -- original_utm_medium_c -> original_utm_medium
    -- original_utm_source_c -> original_utm_source
    -- original_utm_term_c -> original_utm_term
    -- other_city -> secondary_city
    -- other_country -> secondary_country
    -- other_geocode_accuracy -> secondary_geocode_accuracy
    -- other_latitude -> secondary_latitude
    -- other_longitude -> secondary_longitude
    -- other_phone -> secondary_phone
    -- other_postal_code -> secondary_postal_code
    -- other_state -> secondary_state
    -- other_street -> secondary_street
    -- partner_company_c -> partner_company
    -- partner_contact_c -> partner_contact
    -- partner_contact_deprecate_c -> deprecated_partner_contact
    -- partner_rep_email_c -> partner_rep_email
    -- partner_rep_name_c -> partner_rep_name
    -- partner_territory_c -> partner_territory
    -- pbf_startup_certify_eligibility_c -> startup_certification_eligibility
    -- pbf_startup_primary_role_c -> startup_primary_role
    -- persona_c -> customer_persona
    -- phone_extension_c -> phone_extension
    -- phone_number_catch_all_c -> additional_phone_numbers
    -- pi_campaign_c -> marketing_campaign
    -- pi_comments_c -> comments
    -- pi_conversion_date_c -> conversion_date
    -- pi_conversion_object_name_c -> conversion_object_name
    -- pi_conversion_object_type_c -> conversion_object_type
    -- pi_first_activity_c -> first_activity
    -- pi_first_search_term_c -> first_search_term
    -- pi_first_search_type_c -> first_search_type
    -- pi_first_touch_url_c -> first_touch_url
    -- pi_grade_c -> lead_grade
    -- pi_last_activity_c -> last_activity
    -- pi_needs_score_synced_c -> needs_score_sync
    -- pi_notes_c -> notes
    -- pi_pardot_hard_bounced_c -> email_hard_bounced
    -- pi_pardot_last_scored_at_c -> last_scored_at
    -- pi_score_c -> lead_score
    -- pi_url_c -> associated_url
    -- pi_utm_campaign_c -> utm_campaign
    -- pi_utm_content_c -> utm_content
    -- pi_utm_medium_c -> utm_medium
    -- pi_utm_source_c -> utm_source
    -- pi_utm_term_c -> utm_term
    -- potential_fivetran_use_case_c -> fivetran_use_case
    -- primary_se_c -> primary_sales_engineer
    -- promotion_id_c -> promotion_id
    -- recent_marketing_campaign_status_c -> recent_campaign_status
    -- referral_account_c -> referral_account
    -- referral_contact_c -> referral_contact
    -- referral_exists_c -> has_referral
    -- referral_first_name_c -> referral_first_name
    -- referral_last_name_c -> referral_last_name
    -- region_c -> region
    -- rh_2_describe_c -> custom_description
    -- routed_from_manual_bdr_ae_activity_c -> manual_routing
    -- sales_email_opt_out_c -> sales_email_opt_out
    -- sales_email_opt_out_date_time_c -> sales_email_opt_out_datetime
    -- salesloft_cadence_trigger_c -> salesloft_cadence_trigger
    -- salesloft_owner_c -> salesloft_owner
    -- salesloft_owner_sf_c -> salesloft_owner_sf_id
    -- secondary_email_c -> secondary_email
    -- self_service_routing_c -> self_service_routing
    -- source_detail_c -> source_detail
    -- source_last_lead_source_c -> last_lead_source
    -- source_last_lead_source_category_c -> last_lead_source_category
    -- source_last_lead_source_detail_c -> last_lead_source_detail
    -- state_c -> state
    -- state_code_c -> state_code
    -- system_modstamp -> last_modified_timestamp
    -- technical_contact_c -> is_technical_contact
    -- title -> job_title
    -- to_be_deleted_salesloft_backfill_c -> delete_salesloft_data
    -- trial_contact_start_date_c -> trial_start_date
    -- unique_email_c -> email_address
    -- unqualified_reason_c -> unqualified_reason
    -- user_activity_logged_by_c -> activity_logged_by
    -- user_gems_has_changed_job_c -> has_changed_job
    -- user_gems_is_a_user_gem_c -> is_user_gem
    -- user_gems_past_account_c -> past_account
    -- user_gems_past_company_c -> past_company
    -- user_gems_past_contact_c -> past_contact_info
    -- user_gems_past_title_c -> past_job_title
    -- user_gems_ug_created_by_ug_c -> created_by_user_gems
    -- user_gems_ug_current_infos_c -> current_user_gems_info
    -- user_gems_ug_past_infos_c -> past_user_gems_info
    -- user_gems_user_gems_id_c -> user_gems_id
    -- username_c -> username
    -- verified_c -> is_verified
    -- zoominfo_technologies_c -> used_technologies
    SELECT 
        "_fivetran_active" AS "is_active",
        "account_id",
        "act_on_lead_score_c" AS "act_on_lead_score",
        "active_relationship_c" AS "is_relationship_active",
        "adgroupid_c" AS "ad_group_id",
        "allbound_id_c" AS "allbound_id",
        "analytics_id_c" AS "analytics_id",
        "assistant_name",
        "assistant_phone",
        "attempting_contact_date_time_c" AS "last_contact_attempt",
        "attended_event_c" AS "has_attended_event",
        "automation_tracking_c" AS "automation_tracking",
        "avatar_c" AS "avatar_url",
        "behavioral_score_c" AS "behavioral_score",
        "beta_connector_interest_c" AS "beta_connector_interest",
        "bill_to_contact_hidden_c" AS "is_billing_contact_hidden",
        "birthdate",
        "bizible_2_bizible_id_c" AS "bizible_id",
        "bt_stripe_default_payment_gateway_c" AS "stripe_default_gateway",
        "bt_stripe_default_payment_method_c" AS "stripe_default_payment_method",
        "bt_stripe_gender_c" AS "stripe_gender",
        "bt_stripe_languages_c" AS "stripe_languages",
        "bt_stripe_level_c" AS "stripe_customer_level",
        "bt_stripe_maiden_name_c" AS "stripe_maiden_name",
        "bt_stripe_personal_id_number_c" AS "stripe_personal_id_number",
        "bt_stripe_personal_id_number_encrypted_c" AS "stripe_encrypted_personal_id",
        "bt_stripe_personal_id_type_c" AS "stripe_personal_id_type",
        "bt_stripe_ssn_last_4_c" AS "stripe_ssn_last_4",
        "bt_stripe_ssn_last_4_encrypted_c" AS "stripe_encrypted_ssn_last_4",
        "campaignid_c" AS "campaign_id",
        "cbit_clearbit_c" AS "clearbit_id",
        "cbit_clearbit_ready_c" AS "clearbit_data_ready",
        "cbit_created_by_clearbit_c" AS "created_by_clearbit",
        "celigo_sfnsio_net_suite_id_c" AS "netsuite_id",
        "celigo_sfnsio_net_suite_record_c" AS "netsuite_record",
        "celigo_sfnsio_net_suite_sync_error_c",
        "celigo_sfnsio_skip_export_to_net_suite_c" AS "skip_netsuite_export",
        "celigo_sfnsio_test_mode_record_c" AS "test_mode_record",
        "city_c" AS "city",
        "clarus_date_c" AS "clarus_date",
        "clarus_editor_c" AS "clarus_editor",
        "clarus_notes_c" AS "clarus_notes",
        "clarus_project_c" AS "clarus_project",
        "clarus_status_c" AS "clarus_status",
        "clearbit_role_c" AS "clearbit_role",
        "clearbit_seniority_c" AS "clearbit_seniority",
        "clearbit_sub_role_c" AS "clearbit_sub_role",
        "company_c" AS "company",
        "competitor_c" AS "is_competitor",
        "contact_holdover_c" AS "contact_holdover",
        "contact_owners_manager_stamped_c" AS "contact_owner_manager",
        "contact_stage_c" AS "contact_stage",
        "contact_status_c" AS "contact_status",
        "contact_type_c" AS "contact_type",
        "contacts_domain_exists_c" AS "domain_exists",
        "country_c" AS "country",
        "country_code_c" AS "country_code",
        "created_at_c" AS "created_at",
        "created_by_id",
        "created_by_role_c" AS "created_by_role",
        "created_date",
        "creative_c" AS "creative_id",
        "csi_code_c" AS "csi_code",
        "demographic_score_c" AS "demographic_score",
        "department",
        "description",
        "device_c" AS "device_type",
        "direct_office_c" AS "direct_office",
        "dnb_contact_phone_c" AS "dnb_contact_phone",
        "dnb_email_c" AS "dnb_email",
        "dnb_email_deliverability_score_c" AS "dnb_email_deliverability_score",
        "dnb_job_title_c" AS "dnb_job_title",
        "dnb_phone_accuracy_score_c" AS "dnb_phone_accuracy_score",
        "dnb_primary_address_city_c" AS "dnb_primary_city",
        "dnb_primary_address_country_region_code_c" AS "dnb_primary_country_code",
        "dnb_primary_address_postal_code_c" AS "dnb_primary_postal_code",
        "dnb_primary_address_state_province_abbre_c" AS "dnb_primary_state_abbr",
        "dnb_primary_address_state_province_c" AS "dnb_primary_state",
        "dnboptimizer_dn_bcontact_record_c" AS "dnb_optimizer_contact_id",
        "do_not_call",
        "do_not_route_lead_c" AS "do_not_route_lead",
        "do_not_sync_marketo_c" AS "do_not_sync_marketo",
        "do_not_sync_reason_marketo_c" AS "marketo_sync_block_reason",
        "dozisf_zoom_info_company_id_c" AS "zoominfo_company_id",
        "dozisf_zoom_info_first_updated_c" AS "zoominfo_first_updated",
        "dozisf_zoom_info_id_c" AS "zoominfo_contact_id",
        "dozisf_zoom_info_last_updated_c" AS "zoominfo_last_updated",
        "drift_cql_c" AS "drift_cql",
        "email",
        "email_bounced_c" AS "email_bounced",
        "email_bounced_date" AS "email_bounce_date",
        "email_bounced_reason" AS "email_bounce_reason",
        "email_opt_in_double_c" AS "email_double_opt_in",
        "email_opt_in_explicit_c" AS "email_explicit_opt_in",
        "email_opt_in_implicit_c" AS "email_implicit_opt_in",
        "email_opt_out_date_time_c" AS "email_opt_out_timestamp",
        "email_quality_unknown_c" AS "email_quality_unknown",
        "enrichment_request_c" AS "data_enrichment_request",
        "es_seniority_c" AS "seniority_level",
        "fax" AS "fax_number",
        "first_activity_after_mql_changed_c" AS "first_activity_post_mql",
        "first_activity_after_mql_date_c" AS "first_activity_post_mql_date",
        "first_manual_activity_after_mql_date_c" AS "first_manual_activity_post_mql_date",
        "first_mql_date_c" AS "first_mql_date",
        "first_name",
        "free_trial_email_confirmed_date_c" AS "free_trial_confirmation_date",
        "gclid_c" AS "google_click_id",
        "gdpr_opt_in_explicit_c" AS "gdpr_explicit_opt_in",
        "has_opted_out_of_email" AS "email_opt_out",
        "has_opted_out_of_fax" AS "fax_opt_out",
        "historical_contact_status_c" AS "historical_contact_status",
        "home_phone" AS "home_phone_number",
        "hot_contact_c" AS "is_hot_contact",
        "hvr_update_c" AS "hvr_update",
        "i_sell_avention_id_c" AS "isell_avention_id",
        "id" AS "contact_id",
        "individual_id",
        "ironclad_workflow_c" AS "ironclad_workflow_status",
        "is_deleted",
        "is_email_bounced",
        "is_emea_event_routing_c" AS "is_emea_event_routing",
        "is_eu_resident_c" AS "is_eu_resident",
        "jigsaw" AS "jigsaw_data",
        "jigsaw_contact_id",
        "job_function_c" AS "job_function",
        "job_level_c" AS "job_level",
        "keyword_c" AS "keywords",
        "last_activity_date",
        "last_ae_activity_owner_c" AS "last_ae_activity_owner",
        "last_bdr_activity_owner_c" AS "last_bdr_activity_owner",
        "last_curequest_date" AS "last_customer_request_date",
        "last_cuupdate_date" AS "last_customer_update_date",
        "last_manual_ae_activity_date_c" AS "last_manual_ae_activity_date",
        "last_manual_bdr_activity_date_c" AS "last_manual_bdr_activity_date",
        "last_marketing_interesting_moment_date_c" AS "last_marketing_moment_date",
        "last_modified_by_id",
        "last_modified_date",
        "last_name",
        "last_referenced_date",
        "last_sales_activity_date_time_c" AS "last_sales_activity_datetime",
        "last_sdr_activity_date_c" AS "last_sdr_activity_date",
        "last_sdr_activity_owner_c" AS "last_sdr_activity_owner",
        "last_viewed_date",
        "lead_source",
        "lean_data_ld_segment_c" AS "lean_data_segment",
        "lean_data_manual_route_trigger_c" AS "lean_data_manual_route_trigger",
        "lean_data_matched_buyer_persona_c" AS "lean_data_matched_buyer_persona",
        "lean_data_modified_score_c" AS "lean_data_modified_score",
        "lean_data_router_completion_date_time_c" AS "lean_data_routing_completion_datetime",
        "lean_data_routing_action_c" AS "lean_data_routing_action",
        "lean_data_status_info_c" AS "leandata_status",
        "lean_data_tag_c" AS "leandata_tag",
        "leandata_contact_owner_override_c" AS "leandata_owner_override",
        "legacy_hvr_id_c" AS "legacy_hvr_id",
        "lid_linked_in_company_id_c" AS "linkedin_company_id",
        "lid_linked_in_member_token_c" AS "linkedin_member_token",
        "linked_in_url_c" AS "linkedin_url",
        "mailing_city",
        "mailing_country",
        "mailing_country_code",
        "mailing_geocode_accuracy",
        "mailing_latitude",
        "mailing_longitude",
        "mailing_postal_code",
        "mailing_state",
        "mailing_state_code",
        "mailing_street",
        "marketing_connector_interest_c" AS "marketing_connector_interest",
        "marketing_process_c" AS "marketing_process_status",
        "master_record_id",
        "matchtype_c" AS "match_type",
        "mc_4_sf_mc_subscriber_c" AS "marketing_cloud_subscriber",
        "meta_data_create_date_c" AS "metadata_creation_date",
        "mobile_phone",
        "mql_date_c" AS "mql_date",
        "mql_date_changed_c" AS "mql_date_changed",
        "mql_reason_c" AS "mql_reason",
        "name",
        "netsuite_conn_celigo_update_c" AS "netsuite_celigo_update",
        "netsuite_conn_net_suite_id_c" AS "netsuite_connection_id",
        "netsuite_conn_net_suite_sync_err_c",
        "netsuite_conn_push_to_net_suite_c" AS "push_to_netsuite",
        "netsuite_conn_pushed_from_opportunity_c" AS "pushed_from_opportunity",
        "netsuite_conn_sync_in_progress_c" AS "netsuite_sync_in_progress",
        "network_c" AS "professional_network",
        "no_geo_data_c" AS "no_geo_data",
        "no_longer_at_company_c" AS "no_longer_at_company",
        "notes_c" AS "contact_notes",
        "old_lead_source_c" AS "previous_lead_source",
        "old_lead_source_detail_c" AS "previous_lead_source_details",
        "opp_handoff_ae_c" AS "opportunity_handoff_ae",
        "opportunity_c" AS "associated_opportunity",
        "original_utm_campaign_c" AS "original_utm_campaign",
        "original_utm_content_c" AS "original_utm_content",
        "original_utm_medium_c" AS "original_utm_medium",
        "original_utm_source_c" AS "original_utm_source",
        "original_utm_term_c" AS "original_utm_term",
        "other_city" AS "secondary_city",
        "other_country" AS "secondary_country",
        "other_geocode_accuracy" AS "secondary_geocode_accuracy",
        "other_latitude" AS "secondary_latitude",
        "other_longitude" AS "secondary_longitude",
        "other_phone" AS "secondary_phone",
        "other_postal_code" AS "secondary_postal_code",
        "other_state" AS "secondary_state",
        "other_street" AS "secondary_street",
        "owner_id",
        "partner_company_c" AS "partner_company",
        "partner_contact_c" AS "partner_contact",
        "partner_contact_deprecate_c" AS "deprecated_partner_contact",
        "partner_rep_email_c" AS "partner_rep_email",
        "partner_rep_name_c" AS "partner_rep_name",
        "partner_territory_c" AS "partner_territory",
        "pbf_startup_certify_eligibility_c" AS "startup_certification_eligibility",
        "pbf_startup_primary_role_c" AS "startup_primary_role",
        "persona_c" AS "customer_persona",
        "phone",
        "phone_extension_c" AS "phone_extension",
        "phone_number_catch_all_c" AS "additional_phone_numbers",
        "photo_url",
        "pi_campaign_c" AS "marketing_campaign",
        "pi_comments_c" AS "comments",
        "pi_conversion_date_c" AS "conversion_date",
        "pi_conversion_object_name_c" AS "conversion_object_name",
        "pi_conversion_object_type_c" AS "conversion_object_type",
        "pi_created_date_c",
        "pi_first_activity_c" AS "first_activity",
        "pi_first_search_term_c" AS "first_search_term",
        "pi_first_search_type_c" AS "first_search_type",
        "pi_first_touch_url_c" AS "first_touch_url",
        "pi_grade_c" AS "lead_grade",
        "pi_last_activity_c" AS "last_activity",
        "pi_needs_score_synced_c" AS "needs_score_sync",
        "pi_notes_c" AS "notes",
        "pi_pardot_hard_bounced_c" AS "email_hard_bounced",
        "pi_pardot_last_scored_at_c" AS "last_scored_at",
        "pi_score_c" AS "lead_score",
        "pi_url_c" AS "associated_url",
        "pi_utm_campaign_c" AS "utm_campaign",
        "pi_utm_content_c" AS "utm_content",
        "pi_utm_medium_c" AS "utm_medium",
        "pi_utm_source_c" AS "utm_source",
        "pi_utm_term_c" AS "utm_term",
        "potential_fivetran_use_case_c" AS "fivetran_use_case",
        "primary_se_c" AS "primary_sales_engineer",
        "promotion_id_c" AS "promotion_id",
        "recent_marketing_campaign_status_c" AS "recent_campaign_status",
        "referral_account_c" AS "referral_account",
        "referral_contact_c" AS "referral_contact",
        "referral_exists_c" AS "has_referral",
        "referral_first_name_c" AS "referral_first_name",
        "referral_last_name_c" AS "referral_last_name",
        "region_c" AS "region",
        "reports_to_id",
        "rh_2_describe_c" AS "custom_description",
        "routed_from_manual_bdr_ae_activity_c" AS "manual_routing",
        "sales_email_opt_out_c" AS "sales_email_opt_out",
        "sales_email_opt_out_date_time_c" AS "sales_email_opt_out_datetime",
        "salesloft_cadence_trigger_c" AS "salesloft_cadence_trigger",
        "salesloft_owner_c" AS "salesloft_owner",
        "salesloft_owner_sf_c" AS "salesloft_owner_sf_id",
        "salutation",
        "secondary_email_c" AS "secondary_email",
        "self_service_routing_c" AS "self_service_routing",
        "source_detail_c" AS "source_detail",
        "source_last_lead_source_c" AS "last_lead_source",
        "source_last_lead_source_category_c" AS "last_lead_source_category",
        "source_last_lead_source_detail_c" AS "last_lead_source_detail",
        "state_c" AS "state",
        "state_code_c" AS "state_code",
        "system_modstamp" AS "last_modified_timestamp",
        "technical_contact_c" AS "is_technical_contact",
        "title" AS "job_title",
        "to_be_deleted_salesloft_backfill_c" AS "delete_salesloft_data",
        "trial_contact_start_date_c" AS "trial_start_date",
        "unique_email_c" AS "email_address",
        "unqualified_reason_c" AS "unqualified_reason",
        "user_activity_logged_by_c" AS "activity_logged_by",
        "user_gems_has_changed_job_c" AS "has_changed_job",
        "user_gems_is_a_user_gem_c" AS "is_user_gem",
        "user_gems_past_account_c" AS "past_account",
        "user_gems_past_company_c" AS "past_company",
        "user_gems_past_contact_c" AS "past_contact_info",
        "user_gems_past_title_c" AS "past_job_title",
        "user_gems_ug_created_by_ug_c" AS "created_by_user_gems",
        "user_gems_ug_current_infos_c" AS "current_user_gems_info",
        "user_gems_ug_past_infos_c" AS "past_user_gems_info",
        "user_gems_user_gems_id_c" AS "user_gems_id",
        "username_c" AS "username",
        "verified_c" AS "is_verified",
        "zoominfo_technologies_c" AS "used_technologies"
    FROM "sf_contact_data_removeWideColumns_projected"
),

"sf_contact_data_removeWideColumns_projected_renamed_cleaned" AS (
    -- Clean unusual string values: 
    -- contact_status: The problem is that 'Aemping Conac' appears to be a typo or misspelling. It's not a recognizable phrase or status in English. The most likely intended phrase is "Attempting Contact". This would be a logical status for a contact column, indicating that an attempt to reach out to someone is being made. 
    -- first_name: The problem is that 'x' is not a typical first name and appears to be a placeholder or anonymized value. In data anonymization, 'x' is often used to replace actual names to protect privacy. The correct value would depend on the purpose of the dataset and privacy requirements. If maintaining anonymity is crucial, 'x' could be kept. If more meaningful placeholders are desired, options like 'Anonymous' or leaving it as an empty string could be considered. 
    -- last_name: The problem is that 'G' is indeed an unusual value for a last name, as it's a single letter. This could be due to various reasons: 1. It might be an abbreviation of a longer last name. 2. It could be a data entry error where only the first letter of the last name was recorded. 3. In some rare cases, it might actually be a person's full last name. Without more context or additional data, it's difficult to determine the correct full last name.  Given the limited information, the best approach is to keep the value as is, since changing it without more information could introduce errors. 
    -- lead_source: The problem is that both values in the lead_source column are unusual. 'oominfo' is likely a typo for 'ZoomInfo', a popular B2B contact database. 'Vendor Lis' appears to be an incomplete entry, probably meant to be 'Vendor List'. The correct values should be 'ZoomInfo' and 'Vendor List' respectively. 
    -- lean_data_routing_action: The problem is that both values in the column contain spelling errors and inconsistencies. 'convered' is a misspelling of 'converted', and 'accoun' is missing the final 't'. The correct values should be 'converted' and 'converted - new account'. Since 'convered' is the most frequent value, we'll use 'converted' as the standard form. 
    -- mailing_country: The problem is that 'Unied Saes' is a misspelling of 'United States' with missing letters. The correct value should be 'United States'. 
    -- name: The problem is that 'Jerome' and 'Jerome Powell' are inconsistent representations of the same person. The correct value should be the full name 'Jerome Powell', which is more informative and consistent with the format of 'Janet Yellen'. 
    -- photo_url: The problem is that all the values in the photo_url column contain a typo: 'phoo' instead of 'photo' in the file path. This is consistent across all values, indicating it's likely a systematic error. The correct values should have 'photo' instead of 'phoo' in the path. 
    -- marketing_campaign: The problem is a typo in the only value present in the marketing_campaign column. 'Salesforce Creaed' is misspelled and should be 'Salesforce Created'. This appears to be the only value in the column, so we'll correct the spelling. 
    -- associated_url: The problem is that the URL protocol prefix 'hp://' is incorrect. The correct protocol prefix for a web URL should be 'http://' or 'https://'. In this case, it's likely that the 'tt' was accidentally omitted from 'http://'. The correct value should use the 'http://' protocol prefix. 
    -- source_detail: The problem is that 'ryProspec' appears to be a truncated or misspelled word with atypical capitalization. It's likely that this is a shortened version of "DairyProspector" or "DairyProspects", which could be a source for dairy industry information. Without additional context or other values in the column, it's difficult to determine the exact intended full form. However, we can standardize the capitalization to make it more consistent. 
    -- job_title: The problem is that all job titles contain misspellings. The correct values should be: 'Data Science Director' instead of 'Daa Science Direcor', 'Director, Business Insights & Strategy' instead of 'Direcor, Business Insighs & Sraegy', and 'Marketing Director' instead of 'Markeing Direcor'. These corrections fix the typos in each job title. 
    SELECT
        "is_active",
        "account_id",
        "act_on_lead_score",
        "is_relationship_active",
        "ad_group_id",
        "allbound_id",
        "analytics_id",
        "assistant_name",
        "assistant_phone",
        "last_contact_attempt",
        "has_attended_event",
        "automation_tracking",
        "avatar_url",
        "behavioral_score",
        "beta_connector_interest",
        "is_billing_contact_hidden",
        "birthdate",
        "bizible_id",
        "stripe_default_gateway",
        "stripe_default_payment_method",
        "stripe_gender",
        "stripe_languages",
        "stripe_customer_level",
        "stripe_maiden_name",
        "stripe_personal_id_number",
        "stripe_encrypted_personal_id",
        "stripe_personal_id_type",
        "stripe_ssn_last_4",
        "stripe_encrypted_ssn_last_4",
        "campaign_id",
        "clearbit_id",
        "clearbit_data_ready",
        "created_by_clearbit",
        "netsuite_id",
        "netsuite_record",
        "celigo_sfnsio_net_suite_sync_error_c",
        "skip_netsuite_export",
        "test_mode_record",
        "city",
        "clarus_date",
        "clarus_editor",
        "clarus_notes",
        "clarus_project",
        "clarus_status",
        "clearbit_role",
        "clearbit_seniority",
        "clearbit_sub_role",
        "company",
        "is_competitor",
        "contact_holdover",
        "contact_owner_manager",
        "contact_stage",
        CASE
            WHEN "contact_status" = 'Aemping Conac' THEN 'Attempting Contact'
            ELSE "contact_status"
        END AS "contact_status",
        "contact_type",
        "domain_exists",
        "country",
        "country_code",
        "created_at",
        "created_by_id",
        "created_by_role",
        "created_date",
        "creative_id",
        "csi_code",
        "demographic_score",
        "department",
        "description",
        "device_type",
        "direct_office",
        "dnb_contact_phone",
        "dnb_email",
        "dnb_email_deliverability_score",
        "dnb_job_title",
        "dnb_phone_accuracy_score",
        "dnb_primary_city",
        "dnb_primary_country_code",
        "dnb_primary_postal_code",
        "dnb_primary_state_abbr",
        "dnb_primary_state",
        "dnb_optimizer_contact_id",
        "do_not_call",
        "do_not_route_lead",
        "do_not_sync_marketo",
        "marketo_sync_block_reason",
        "zoominfo_company_id",
        "zoominfo_first_updated",
        "zoominfo_contact_id",
        "zoominfo_last_updated",
        "drift_cql",
        "email",
        "email_bounced",
        "email_bounce_date",
        "email_bounce_reason",
        "email_double_opt_in",
        "email_explicit_opt_in",
        "email_implicit_opt_in",
        "email_opt_out_timestamp",
        "email_quality_unknown",
        "data_enrichment_request",
        "seniority_level",
        "fax_number",
        "first_activity_post_mql",
        "first_activity_post_mql_date",
        "first_manual_activity_post_mql_date",
        "first_mql_date",
        CASE
            WHEN "first_name" = 'x' THEN ''
            ELSE "first_name"
        END AS "first_name",
        "free_trial_confirmation_date",
        "google_click_id",
        "gdpr_explicit_opt_in",
        "email_opt_out",
        "fax_opt_out",
        "historical_contact_status",
        "home_phone_number",
        "is_hot_contact",
        "hvr_update",
        "isell_avention_id",
        "contact_id",
        "individual_id",
        "ironclad_workflow_status",
        "is_deleted",
        "is_email_bounced",
        "is_emea_event_routing",
        "is_eu_resident",
        "jigsaw_data",
        "jigsaw_contact_id",
        "job_function",
        "job_level",
        "keywords",
        "last_activity_date",
        "last_ae_activity_owner",
        "last_bdr_activity_owner",
        "last_customer_request_date",
        "last_customer_update_date",
        "last_manual_ae_activity_date",
        "last_manual_bdr_activity_date",
        "last_marketing_moment_date",
        "last_modified_by_id",
        "last_modified_date",
        "last_name",
        "last_referenced_date",
        "last_sales_activity_datetime",
        "last_sdr_activity_date",
        "last_sdr_activity_owner",
        "last_viewed_date",
        CASE
            WHEN "lead_source" = 'oominfo' THEN 'ZoomInfo'
            WHEN "lead_source" = 'Vendor Lis' THEN 'Vendor List'
            ELSE "lead_source"
        END AS "lead_source",
        "lean_data_segment",
        "lean_data_manual_route_trigger",
        "lean_data_matched_buyer_persona",
        "lean_data_modified_score",
        "lean_data_routing_completion_datetime",
        CASE
            WHEN "lean_data_routing_action" = 'convered' THEN 'converted'
            WHEN "lean_data_routing_action" = 'convered - new accoun' THEN 'converted - new account'
            ELSE "lean_data_routing_action"
        END AS "lean_data_routing_action",
        "leandata_status",
        "leandata_tag",
        "leandata_owner_override",
        "legacy_hvr_id",
        "linkedin_company_id",
        "linkedin_member_token",
        "linkedin_url",
        "mailing_city",
        CASE
            WHEN "mailing_country" = 'Unied Saes' THEN 'United States'
            ELSE "mailing_country"
        END AS "mailing_country",
        "mailing_country_code",
        "mailing_geocode_accuracy",
        "mailing_latitude",
        "mailing_longitude",
        "mailing_postal_code",
        "mailing_state",
        "mailing_state_code",
        "mailing_street",
        "marketing_connector_interest",
        "marketing_process_status",
        "master_record_id",
        "match_type",
        "marketing_cloud_subscriber",
        "metadata_creation_date",
        "mobile_phone",
        "mql_date",
        "mql_date_changed",
        "mql_reason",
        CASE
            WHEN "name" = 'Jerome' THEN 'Jerome Powell'
            ELSE "name"
        END AS "name",
        "netsuite_celigo_update",
        "netsuite_connection_id",
        "netsuite_conn_net_suite_sync_err_c",
        "push_to_netsuite",
        "pushed_from_opportunity",
        "netsuite_sync_in_progress",
        "professional_network",
        "no_geo_data",
        "no_longer_at_company",
        "contact_notes",
        "previous_lead_source",
        "previous_lead_source_details",
        "opportunity_handoff_ae",
        "associated_opportunity",
        "original_utm_campaign",
        "original_utm_content",
        "original_utm_medium",
        "original_utm_source",
        "original_utm_term",
        "secondary_city",
        "secondary_country",
        "secondary_geocode_accuracy",
        "secondary_latitude",
        "secondary_longitude",
        "secondary_phone",
        "secondary_postal_code",
        "secondary_state",
        "secondary_street",
        "owner_id",
        "partner_company",
        "partner_contact",
        "deprecated_partner_contact",
        "partner_rep_email",
        "partner_rep_name",
        "partner_territory",
        "startup_certification_eligibility",
        "startup_primary_role",
        "customer_persona",
        "phone",
        "phone_extension",
        "additional_phone_numbers",
        CASE
            WHEN "photo_url" = '/services/images/phoo/0031G00000q9jPQAQ' THEN '/services/images/photo/0031G00000q9jPQAQ'
            WHEN "photo_url" = '/services/images/phoo/0031G00000qAfq1QAC' THEN '/services/images/photo/0031G00000qAfq1QAC'
            WHEN "photo_url" = '/services/images/phoo/0031G00000rfAvuQAE' THEN '/services/images/photo/0031G00000rfAvuQAE'
            ELSE "photo_url"
        END AS "photo_url",
        CASE
            WHEN "marketing_campaign" = 'Salesforce Creaed' THEN 'Salesforce Created'
            ELSE "marketing_campaign"
        END AS "marketing_campaign",
        "comments",
        "conversion_date",
        "conversion_object_name",
        "conversion_object_type",
        "pi_created_date_c",
        "first_activity",
        "first_search_term",
        "first_search_type",
        "first_touch_url",
        "lead_grade",
        "last_activity",
        "needs_score_sync",
        "notes",
        "email_hard_bounced",
        "last_scored_at",
        "lead_score",
        CASE
            WHEN "associated_url" = 'hp://pi.pardo.com/prospec/read?id=396093715' THEN 'http://pi.pardo.com/prospec/read?id=396093715'
            ELSE "associated_url"
        END AS "associated_url",
        "utm_campaign",
        "utm_content",
        "utm_medium",
        "utm_source",
        "utm_term",
        "fivetran_use_case",
        "primary_sales_engineer",
        "promotion_id",
        "recent_campaign_status",
        "referral_account",
        "referral_contact",
        "has_referral",
        "referral_first_name",
        "referral_last_name",
        "region",
        "reports_to_id",
        "custom_description",
        "manual_routing",
        "sales_email_opt_out",
        "sales_email_opt_out_datetime",
        "salesloft_cadence_trigger",
        "salesloft_owner",
        "salesloft_owner_sf_id",
        "salutation",
        "secondary_email",
        "self_service_routing",
        CASE
            WHEN "source_detail" = 'ryProspec' THEN 'RyProspec'
            ELSE "source_detail"
        END AS "source_detail",
        "last_lead_source",
        "last_lead_source_category",
        "last_lead_source_detail",
        "state",
        "state_code",
        "last_modified_timestamp",
        "is_technical_contact",
        CASE
            WHEN "job_title" = 'Daa Science Direcor' THEN 'Data Science Director'
            WHEN "job_title" = 'Direcor, Business Insighs & Sraegy' THEN 'Director, Business Insights & Strategy'
            WHEN "job_title" = 'Markeing Direcor' THEN 'Marketing Director'
            ELSE "job_title"
        END AS "job_title",
        "delete_salesloft_data",
        "trial_start_date",
        "email_address",
        "unqualified_reason",
        "activity_logged_by",
        "has_changed_job",
        "is_user_gem",
        "past_account",
        "past_company",
        "past_contact_info",
        "past_job_title",
        "created_by_user_gems",
        "current_user_gems_info",
        "past_user_gems_info",
        "user_gems_id",
        "username",
        "is_verified",
        "used_technologies"
    FROM "sf_contact_data_removeWideColumns_projected_renamed"
),

"sf_contact_data_removeWideColumns_projected_renamed_cleaned_null" AS (
    -- NULL Imputation: Impute Null to Disguised Missing Values
    -- first_name: ['']
    SELECT 
        CASE
            WHEN "first_name" = '' THEN NULL
            ELSE "first_name"
        END AS "first_name",
        "associated_url",
        "is_hot_contact",
        "secondary_latitude",
        "lean_data_manual_route_trigger",
        "original_utm_campaign",
        "contact_stage",
        "referral_last_name",
        "utm_source",
        "mailing_country",
        "mailing_latitude",
        "mailing_longitude",
        "username",
        "is_billing_contact_hidden",
        "birthdate",
        "account_id",
        "individual_id",
        "lean_data_matched_buyer_persona",
        "dnb_contact_phone",
        "drift_cql",
        "domain_exists",
        "first_manual_activity_post_mql_date",
        "last_customer_request_date",
        "legacy_hvr_id",
        "csi_code",
        "conversion_date",
        "celigo_sfnsio_net_suite_sync_error_c",
        "keywords",
        "last_modified_timestamp",
        "dnb_optimizer_contact_id",
        "country_code",
        "last_activity_date",
        "match_type",
        "pushed_from_opportunity",
        "dnb_email_deliverability_score",
        "last_lead_source_category",
        "data_enrichment_request",
        "ad_group_id",
        "mobile_phone",
        "test_mode_record",
        "last_viewed_date",
        "master_record_id",
        "isell_avention_id",
        "phone_extension",
        "hvr_update",
        "self_service_routing",
        "no_geo_data",
        "direct_office",
        "partner_rep_email",
        "clearbit_seniority",
        "linkedin_company_id",
        "stripe_languages",
        "dnb_phone_accuracy_score",
        "clarus_date",
        "mailing_street",
        "salesloft_owner_sf_id",
        "zoominfo_first_updated",
        "contact_owner_manager",
        "is_eu_resident",
        "beta_connector_interest",
        "original_utm_source",
        "last_lead_source_detail",
        "device_type",
        "department",
        "original_utm_medium",
        "user_gems_id",
        "last_name",
        "mailing_country_code",
        "created_by_id",
        "netsuite_connection_id",
        "photo_url",
        "past_company",
        "clearbit_id",
        "first_activity_post_mql_date",
        "lean_data_routing_completion_datetime",
        "partner_rep_name",
        "referral_account",
        "city",
        "source_detail",
        "partner_territory",
        "salutation",
        "linkedin_member_token",
        "assistant_name",
        "last_ae_activity_owner",
        "secondary_email",
        "email_quality_unknown",
        "activity_logged_by",
        "campaign_id",
        "primary_sales_engineer",
        "last_marketing_moment_date",
        "automation_tracking",
        "last_customer_update_date",
        "has_referral",
        "utm_term",
        "email_explicit_opt_in",
        "notes",
        "sales_email_opt_out_datetime",
        "stripe_personal_id_type",
        "past_account",
        "last_lead_source",
        "is_emea_event_routing",
        "lean_data_modified_score",
        "secondary_postal_code",
        "startup_primary_role",
        "skip_netsuite_export",
        "created_at",
        "fivetran_use_case",
        "job_function",
        "contact_notes",
        "dnb_primary_postal_code",
        "email_bounced",
        "email_opt_out_timestamp",
        "utm_medium",
        "last_sdr_activity_owner",
        "email",
        "customer_persona",
        "last_modified_by_id",
        "lean_data_segment",
        "is_verified",
        "professional_network",
        "referral_contact",
        "past_job_title",
        "netsuite_conn_net_suite_sync_err_c",
        "zoominfo_company_id",
        "dnb_email",
        "jigsaw_data",
        "last_scored_at",
        "lean_data_routing_action",
        "mql_date",
        "stripe_default_gateway",
        "no_longer_at_company",
        "creative_id",
        "previous_lead_source",
        "fax_opt_out",
        "deprecated_partner_contact",
        "salesloft_cadence_trigger",
        "is_active",
        "push_to_netsuite",
        "previous_lead_source_details",
        "region",
        "behavioral_score",
        "salesloft_owner",
        "email_bounce_date",
        "mailing_geocode_accuracy",
        "assistant_phone",
        "stripe_ssn_last_4",
        "dnb_primary_state",
        "past_contact_info",
        "is_technical_contact",
        "current_user_gems_info",
        "created_by_role",
        "dnb_primary_city",
        "mql_reason",
        "clearbit_role",
        "used_technologies",
        "mailing_city",
        "original_utm_term",
        "utm_content",
        "allbound_id",
        "analytics_id",
        "contact_holdover",
        "description",
        "is_email_bounced",
        "first_activity_post_mql",
        "dnb_job_title",
        "partner_company",
        "clarus_project",
        "marketing_connector_interest",
        "first_touch_url",
        "first_activity",
        "home_phone_number",
        "last_modified_date",
        "opportunity_handoff_ae",
        "stripe_customer_level",
        "last_activity",
        "needs_score_sync",
        "state",
        "netsuite_id",
        "clearbit_sub_role",
        "pi_created_date_c",
        "fax_number",
        "is_competitor",
        "secondary_phone",
        "is_user_gem",
        "additional_phone_numbers",
        "is_relationship_active",
        "zoominfo_contact_id",
        "stripe_default_payment_method",
        "do_not_route_lead",
        "last_sdr_activity_date",
        "past_user_gems_info",
        "startup_certification_eligibility",
        "zoominfo_last_updated",
        "lead_source",
        "sales_email_opt_out",
        "email_address",
        "clearbit_data_ready",
        "has_attended_event",
        "phone",
        "email_hard_bounced",
        "lead_grade",
        "mailing_postal_code",
        "secondary_longitude",
        "marketo_sync_block_reason",
        "linkedin_url",
        "associated_opportunity",
        "secondary_city",
        "email_implicit_opt_in",
        "last_bdr_activity_owner",
        "comments",
        "job_title",
        "last_sales_activity_datetime",
        "email_opt_out",
        "leandata_status",
        "manual_routing",
        "created_by_clearbit",
        "promotion_id",
        "leandata_tag",
        "clarus_notes",
        "stripe_maiden_name",
        "last_referenced_date",
        "name",
        "unqualified_reason",
        "company",
        "ironclad_workflow_status",
        "mailing_state",
        "mailing_state_code",
        "email_bounce_reason",
        "stripe_encrypted_ssn_last_4",
        "marketing_cloud_subscriber",
        "delete_salesloft_data",
        "last_manual_bdr_activity_date",
        "clarus_editor",
        "contact_type",
        "first_search_type",
        "secondary_state",
        "netsuite_celigo_update",
        "email_double_opt_in",
        "bizible_id",
        "jigsaw_contact_id",
        "recent_campaign_status",
        "owner_id",
        "referral_first_name",
        "state_code",
        "gdpr_explicit_opt_in",
        "google_click_id",
        "secondary_street",
        "marketing_process_status",
        "avatar_url",
        "mql_date_changed",
        "historical_contact_status",
        "job_level",
        "original_utm_content",
        "partner_contact",
        "leandata_owner_override",
        "dnb_primary_state_abbr",
        "secondary_country",
        "last_contact_attempt",
        "stripe_encrypted_personal_id",
        "is_deleted",
        "netsuite_sync_in_progress",
        "last_manual_ae_activity_date",
        "contact_status",
        "free_trial_confirmation_date",
        "dnb_primary_country_code",
        "first_mql_date",
        "conversion_object_name",
        "netsuite_record",
        "act_on_lead_score",
        "created_by_user_gems",
        "utm_campaign",
        "do_not_call",
        "lead_score",
        "country",
        "custom_description",
        "has_changed_job",
        "metadata_creation_date",
        "conversion_object_type",
        "stripe_personal_id_number",
        "stripe_gender",
        "demographic_score",
        "do_not_sync_marketo",
        "secondary_geocode_accuracy",
        "marketing_campaign",
        "clarus_status",
        "first_search_term",
        "contact_id",
        "reports_to_id",
        "created_date",
        "seniority_level",
        "trial_start_date"
    FROM "sf_contact_data_removeWideColumns_projected_renamed_cleaned"
),

"sf_contact_data_removeWideColumns_projected_renamed_cleaned_null_casted" AS (
    -- Column Type Casting: 
    -- act_on_lead_score: from DECIMAL to INT
    -- activity_logged_by: from DECIMAL to VARCHAR
    -- ad_group_id: from DECIMAL to VARCHAR
    -- additional_phone_numbers: from DECIMAL to VARCHAR
    -- allbound_id: from DECIMAL to VARCHAR
    -- analytics_id: from DECIMAL to VARCHAR
    -- assistant_name: from DECIMAL to VARCHAR
    -- assistant_phone: from DECIMAL to VARCHAR
    -- associated_opportunity: from DECIMAL to VARCHAR
    -- automation_tracking: from DECIMAL to VARCHAR
    -- avatar_url: from DECIMAL to VARCHAR
    -- behavioral_score: from DECIMAL to INT
    -- beta_connector_interest: from DECIMAL to BOOLEAN
    -- birthdate: from DECIMAL to DATE
    -- bizible_id: from DECIMAL to VARCHAR
    -- campaign_id: from DECIMAL to VARCHAR
    -- celigo_sfnsio_net_suite_sync_error_c: from DECIMAL to VARCHAR
    -- city: from DECIMAL to VARCHAR
    -- clarus_date: from DECIMAL to DATE
    -- clarus_editor: from DECIMAL to VARCHAR
    -- clarus_notes: from DECIMAL to VARCHAR
    -- clarus_project: from DECIMAL to VARCHAR
    -- clarus_status: from DECIMAL to VARCHAR
    -- clearbit_role: from DECIMAL to VARCHAR
    -- clearbit_seniority: from DECIMAL to VARCHAR
    -- clearbit_sub_role: from DECIMAL to VARCHAR
    -- comments: from DECIMAL to VARCHAR
    -- company: from DECIMAL to VARCHAR
    -- contact_holdover: from DECIMAL to VARCHAR
    -- contact_notes: from DECIMAL to VARCHAR
    -- contact_owner_manager: from DECIMAL to VARCHAR
    -- contact_stage: from DECIMAL to VARCHAR
    -- contact_type: from DECIMAL to VARCHAR
    -- conversion_date: from DECIMAL to DATE
    -- conversion_object_name: from DECIMAL to VARCHAR
    -- conversion_object_type: from DECIMAL to VARCHAR
    -- country: from DECIMAL to VARCHAR
    -- country_code: from DECIMAL to VARCHAR
    -- created_at: from DECIMAL to TIMESTAMP
    -- created_by_role: from DECIMAL to VARCHAR
    -- created_by_user_gems: from DECIMAL to VARCHAR
    -- created_date: from VARCHAR to TIMESTAMP
    -- creative_id: from DECIMAL to VARCHAR
    -- csi_code: from DECIMAL to VARCHAR
    -- current_user_gems_info: from DECIMAL to VARCHAR
    -- custom_description: from DECIMAL to VARCHAR
    -- customer_persona: from DECIMAL to VARCHAR
    -- data_enrichment_request: from DECIMAL to VARCHAR
    -- delete_salesloft_data: from DECIMAL to VARCHAR
    -- demographic_score: from DECIMAL to VARCHAR
    -- department: from DECIMAL to VARCHAR
    -- deprecated_partner_contact: from DECIMAL to VARCHAR
    -- device_type: from DECIMAL to VARCHAR
    -- direct_office: from DECIMAL to VARCHAR
    -- dnb_contact_phone: from DECIMAL to VARCHAR
    -- dnb_email: from DECIMAL to VARCHAR
    -- dnb_job_title: from DECIMAL to VARCHAR
    -- dnb_optimizer_contact_id: from DECIMAL to VARCHAR
    -- dnb_primary_city: from DECIMAL to VARCHAR
    -- dnb_primary_country_code: from DECIMAL to VARCHAR
    -- dnb_primary_postal_code: from DECIMAL to VARCHAR
    -- dnb_primary_state: from DECIMAL to VARCHAR
    -- dnb_primary_state_abbr: from DECIMAL to VARCHAR
    -- do_not_sync_marketo: from DECIMAL to BOOLEAN
    -- domain_exists: from DECIMAL to BOOLEAN
    -- drift_cql: from DECIMAL to VARCHAR
    -- email_address: from DECIMAL to VARCHAR
    -- email_bounce_date: from DECIMAL to DATE
    -- email_bounce_reason: from DECIMAL to VARCHAR
    -- email_double_opt_in: from DECIMAL to BOOLEAN
    -- email_explicit_opt_in: from DECIMAL to BOOLEAN
    -- email_implicit_opt_in: from DECIMAL to BOOLEAN
    -- email_opt_out_timestamp: from DECIMAL to TIMESTAMP
    -- fax_number: from DECIMAL to VARCHAR
    -- fax_opt_out: from DECIMAL to BOOLEAN
    -- first_activity: from DECIMAL to TIMESTAMP
    -- first_activity_post_mql: from DECIMAL to TIMESTAMP
    -- first_activity_post_mql_date: from DECIMAL to DATE
    -- first_manual_activity_post_mql_date: from DECIMAL to DATE
    -- first_mql_date: from DECIMAL to DATE
    -- first_search_term: from DECIMAL to VARCHAR
    -- first_search_type: from DECIMAL to VARCHAR
    -- first_touch_url: from DECIMAL to VARCHAR
    -- fivetran_use_case: from DECIMAL to VARCHAR
    -- free_trial_confirmation_date: from DECIMAL to DATE
    -- gdpr_explicit_opt_in: from DECIMAL to BOOLEAN
    -- google_click_id: from DECIMAL to VARCHAR
    -- has_attended_event: from DECIMAL to BOOLEAN
    -- has_changed_job: from DECIMAL to BOOLEAN
    -- has_referral: from DECIMAL to BOOLEAN
    -- historical_contact_status: from DECIMAL to VARCHAR
    -- home_phone_number: from DECIMAL to VARCHAR
    -- hvr_update: from DECIMAL to TIMESTAMP
    -- individual_id: from DECIMAL to UUID
    -- ironclad_workflow_status: from DECIMAL to VARCHAR
    -- is_active: from DECIMAL to BOOLEAN
    -- is_billing_contact_hidden: from DECIMAL to BOOLEAN
    -- is_competitor: from DECIMAL to BOOLEAN
    -- is_deleted: from DECIMAL to BOOLEAN
    -- is_emea_event_routing: from DECIMAL to BOOLEAN
    -- is_hot_contact: from DECIMAL to BOOLEAN
    -- is_relationship_active: from DECIMAL to BOOLEAN
    -- is_technical_contact: from DECIMAL to BOOLEAN
    -- is_user_gem: from DECIMAL to BOOLEAN
    -- is_verified: from DECIMAL to BOOLEAN
    -- isell_avention_id: from DECIMAL to VARCHAR
    -- jigsaw_contact_id: from DECIMAL to VARCHAR
    -- jigsaw_data: from DECIMAL to JSON
    -- job_function: from DECIMAL to VARCHAR
    -- job_level: from DECIMAL to VARCHAR
    -- keywords: from DECIMAL to ARRAY
    -- last_activity: from DECIMAL to VARCHAR
    -- last_activity_date: from DECIMAL to DATE
    -- last_ae_activity_owner: from DECIMAL to VARCHAR
    -- last_bdr_activity_owner: from DECIMAL to VARCHAR
    -- last_contact_attempt: from DECIMAL to DATE
    -- last_customer_request_date: from DECIMAL to DATE
    -- last_customer_update_date: from DECIMAL to DATE
    -- last_lead_source: from DECIMAL to VARCHAR
    -- last_lead_source_category: from DECIMAL to VARCHAR
    -- last_lead_source_detail: from DECIMAL to VARCHAR
    -- last_manual_ae_activity_date: from DECIMAL to DATE
    -- last_manual_bdr_activity_date: from DECIMAL to DATE
    -- last_marketing_moment_date: from DECIMAL to DATE
    -- last_modified_date: from VARCHAR to TIMESTAMP
    -- last_modified_timestamp: from VARCHAR to TIMESTAMP
    -- last_referenced_date: from DECIMAL to DATE
    -- last_sales_activity_datetime: from DECIMAL to TIMESTAMP
    -- last_scored_at: from DECIMAL to TIMESTAMP
    -- last_sdr_activity_date: from DECIMAL to DATE
    -- last_sdr_activity_owner: from DECIMAL to VARCHAR
    -- last_viewed_date: from DECIMAL to DATE
    -- lead_grade: from DECIMAL to VARCHAR
    -- lead_score: from DECIMAL to INT
    -- lean_data_manual_route_trigger: from DECIMAL to VARCHAR
    -- lean_data_matched_buyer_persona: from DECIMAL to VARCHAR
    -- lean_data_modified_score: from DECIMAL to INT
    -- lean_data_routing_completion_datetime: from DECIMAL to TIMESTAMP
    -- lean_data_segment: from DECIMAL to VARCHAR
    -- leandata_owner_override: from DECIMAL to VARCHAR
    -- leandata_status: from DECIMAL to VARCHAR
    -- leandata_tag: from DECIMAL to VARCHAR
    -- legacy_hvr_id: from DECIMAL to VARCHAR
    -- linkedin_company_id: from DECIMAL to VARCHAR
    -- linkedin_member_token: from DECIMAL to VARCHAR
    -- linkedin_url: from DECIMAL to VARCHAR
    -- mailing_geocode_accuracy: from DECIMAL to VARCHAR
    -- mailing_postal_code: from DECIMAL to VARCHAR
    -- manual_routing: from DECIMAL to VARCHAR
    -- marketing_cloud_subscriber: from DECIMAL to VARCHAR
    -- marketing_connector_interest: from DECIMAL to VARCHAR
    -- marketing_process_status: from DECIMAL to VARCHAR
    -- marketo_sync_block_reason: from DECIMAL to VARCHAR
    -- master_record_id: from DECIMAL to VARCHAR
    -- match_type: from DECIMAL to VARCHAR
    -- metadata_creation_date: from DECIMAL to TIMESTAMP
    -- mobile_phone: from DECIMAL to VARCHAR
    -- mql_date: from DECIMAL to DATE
    -- mql_date_changed: from DECIMAL to DATE
    -- mql_reason: from DECIMAL to VARCHAR
    -- netsuite_conn_net_suite_sync_err_c: from DECIMAL to VARCHAR
    -- netsuite_connection_id: from DECIMAL to VARCHAR
    -- netsuite_id: from DECIMAL to VARCHAR
    -- netsuite_record: from DECIMAL to VARCHAR
    -- no_geo_data: from DECIMAL to BOOLEAN
    -- notes: from DECIMAL to VARCHAR
    -- opportunity_handoff_ae: from DECIMAL to VARCHAR
    -- original_utm_campaign: from DECIMAL to VARCHAR
    -- original_utm_content: from DECIMAL to VARCHAR
    -- original_utm_medium: from DECIMAL to VARCHAR
    -- original_utm_source: from DECIMAL to VARCHAR
    -- original_utm_term: from DECIMAL to VARCHAR
    -- partner_company: from DECIMAL to VARCHAR
    -- partner_contact: from DECIMAL to VARCHAR
    -- partner_rep_email: from DECIMAL to VARCHAR
    -- partner_rep_name: from DECIMAL to VARCHAR
    -- partner_territory: from DECIMAL to VARCHAR
    -- past_account: from DECIMAL to VARCHAR
    -- past_company: from DECIMAL to VARCHAR
    -- past_contact_info: from DECIMAL to VARCHAR
    -- past_job_title: from DECIMAL to VARCHAR
    -- past_user_gems_info: from DECIMAL to VARCHAR
    -- phone_extension: from DECIMAL to VARCHAR
    -- pi_created_date_c: from VARCHAR to TIMESTAMP
    -- previous_lead_source: from DECIMAL to VARCHAR
    -- previous_lead_source_details: from DECIMAL to VARCHAR
    -- primary_sales_engineer: from DECIMAL to VARCHAR
    -- professional_network: from DECIMAL to VARCHAR
    -- promotion_id: from DECIMAL to VARCHAR
    -- recent_campaign_status: from DECIMAL to VARCHAR
    -- referral_account: from DECIMAL to VARCHAR
    -- referral_contact: from DECIMAL to VARCHAR
    -- referral_first_name: from DECIMAL to VARCHAR
    -- referral_last_name: from DECIMAL to VARCHAR
    -- region: from DECIMAL to VARCHAR
    -- reports_to_id: from DECIMAL to VARCHAR
    -- sales_email_opt_out: from DECIMAL to BOOLEAN
    -- sales_email_opt_out_datetime: from DECIMAL to TIMESTAMP
    -- salesloft_cadence_trigger: from DECIMAL to VARCHAR
    -- salesloft_owner: from DECIMAL to VARCHAR
    -- salesloft_owner_sf_id: from DECIMAL to VARCHAR
    -- salutation: from DECIMAL to VARCHAR
    -- secondary_city: from DECIMAL to VARCHAR
    -- secondary_country: from DECIMAL to VARCHAR
    -- secondary_email: from DECIMAL to VARCHAR
    -- secondary_geocode_accuracy: from DECIMAL to VARCHAR
    -- secondary_phone: from DECIMAL to VARCHAR
    -- secondary_postal_code: from DECIMAL to VARCHAR
    -- secondary_state: from DECIMAL to VARCHAR
    -- secondary_street: from DECIMAL to VARCHAR
    -- self_service_routing: from DECIMAL to VARCHAR
    -- seniority_level: from DECIMAL to VARCHAR
    -- skip_netsuite_export: from DECIMAL to BOOLEAN
    -- startup_certification_eligibility: from DECIMAL to VARCHAR
    -- startup_primary_role: from DECIMAL to VARCHAR
    -- state: from DECIMAL to VARCHAR
    -- state_code: from DECIMAL to VARCHAR
    -- stripe_customer_level: from DECIMAL to VARCHAR
    -- stripe_default_gateway: from DECIMAL to VARCHAR
    -- stripe_default_payment_method: from DECIMAL to VARCHAR
    -- stripe_encrypted_personal_id: from DECIMAL to VARCHAR
    -- stripe_encrypted_ssn_last_4: from DECIMAL to VARCHAR
    -- stripe_gender: from DECIMAL to VARCHAR
    -- stripe_languages: from DECIMAL to VARCHAR
    -- stripe_maiden_name: from DECIMAL to VARCHAR
    -- stripe_personal_id_number: from DECIMAL to VARCHAR
    -- stripe_personal_id_type: from DECIMAL to VARCHAR
    -- stripe_ssn_last_4: from DECIMAL to VARCHAR
    -- test_mode_record: from DECIMAL to BOOLEAN
    -- trial_start_date: from DECIMAL to DATE
    -- unqualified_reason: from DECIMAL to VARCHAR
    -- used_technologies: from DECIMAL to ARRAY
    -- user_gems_id: from DECIMAL to UUID
    -- username: from DECIMAL to VARCHAR
    -- utm_campaign: from DECIMAL to VARCHAR
    -- utm_content: from DECIMAL to VARCHAR
    -- utm_medium: from DECIMAL to VARCHAR
    -- utm_source: from DECIMAL to VARCHAR
    -- utm_term: from DECIMAL to VARCHAR
    -- zoominfo_company_id: from DECIMAL to VARCHAR
    -- zoominfo_contact_id: from DECIMAL to VARCHAR
    -- zoominfo_first_updated: from DECIMAL to TIMESTAMP
    -- zoominfo_last_updated: from DECIMAL to TIMESTAMP
    SELECT
        "first_name",
        "associated_url",
        "secondary_latitude",
        "mailing_country",
        "mailing_latitude",
        "mailing_longitude",
        "account_id",
        "pushed_from_opportunity",
        "dnb_email_deliverability_score",
        "dnb_phone_accuracy_score",
        "mailing_street",
        "is_eu_resident",
        "last_name",
        "mailing_country_code",
        "created_by_id",
        "photo_url",
        "clearbit_id",
        "source_detail",
        "email_quality_unknown",
        "email_bounced",
        "email",
        "last_modified_by_id",
        "lean_data_routing_action",
        "no_longer_at_company",
        "push_to_netsuite",
        "mailing_city",
        "description",
        "is_email_bounced",
        "needs_score_sync",
        "do_not_route_lead",
        "lead_source",
        "clearbit_data_ready",
        "phone",
        "email_hard_bounced",
        "secondary_longitude",
        "job_title",
        "email_opt_out",
        "created_by_clearbit",
        "name",
        "mailing_state",
        "mailing_state_code",
        "netsuite_celigo_update",
        "owner_id",
        "netsuite_sync_in_progress",
        "contact_status",
        "do_not_call",
        "marketing_campaign",
        "contact_id",
        CAST("act_on_lead_score" AS INT) AS "act_on_lead_score",
        CAST("activity_logged_by" AS VARCHAR) AS "activity_logged_by",
        CAST("ad_group_id" AS VARCHAR) AS "ad_group_id",
        CAST("additional_phone_numbers" AS VARCHAR) AS "additional_phone_numbers",
        CAST("allbound_id" AS VARCHAR) AS "allbound_id",
        CAST("analytics_id" AS VARCHAR) AS "analytics_id",
        CAST("assistant_name" AS VARCHAR) AS "assistant_name",
        CAST("assistant_phone" AS VARCHAR) AS "assistant_phone",
        CAST("associated_opportunity" AS VARCHAR) AS "associated_opportunity",
        CAST("automation_tracking" AS VARCHAR) AS "automation_tracking",
        CAST("avatar_url" AS VARCHAR) AS "avatar_url",
        CAST("behavioral_score" AS INT) AS "behavioral_score",
        CAST("beta_connector_interest" AS BOOLEAN) AS "beta_connector_interest",
        CAST("birthdate" AS DATE) AS "birthdate",
        CAST("bizible_id" AS VARCHAR) AS "bizible_id",
        CAST("campaign_id" AS VARCHAR) AS "campaign_id",
        CAST("celigo_sfnsio_net_suite_sync_error_c" AS VARCHAR) AS "celigo_sfnsio_net_suite_sync_error_c",
        CAST("city" AS VARCHAR) AS "city",
        CAST("clarus_date" AS DATE) AS "clarus_date",
        CAST("clarus_editor" AS VARCHAR) AS "clarus_editor",
        CAST("clarus_notes" AS VARCHAR) AS "clarus_notes",
        CAST("clarus_project" AS VARCHAR) AS "clarus_project",
        CAST("clarus_status" AS VARCHAR) AS "clarus_status",
        CAST("clearbit_role" AS VARCHAR) AS "clearbit_role",
        CAST("clearbit_seniority" AS VARCHAR) AS "clearbit_seniority",
        CAST("clearbit_sub_role" AS VARCHAR) AS "clearbit_sub_role",
        CAST("comments" AS VARCHAR) AS "comments",
        CAST("company" AS VARCHAR) AS "company",
        CAST("contact_holdover" AS VARCHAR) AS "contact_holdover",
        CAST("contact_notes" AS VARCHAR) AS "contact_notes",
        CAST("contact_owner_manager" AS VARCHAR) AS "contact_owner_manager",
        CAST("contact_stage" AS VARCHAR) AS "contact_stage",
        CAST("contact_type" AS VARCHAR) AS "contact_type",
        CAST("conversion_date" AS DATE) AS "conversion_date",
        CAST("conversion_object_name" AS VARCHAR) AS "conversion_object_name",
        CAST("conversion_object_type" AS VARCHAR) AS "conversion_object_type",
        CAST("country" AS VARCHAR) AS "country",
        CAST("country_code" AS VARCHAR) AS "country_code",
        CAST("created_at" AS TIMESTAMP) AS "created_at",
        CAST("created_by_role" AS VARCHAR) AS "created_by_role",
        CAST("created_by_user_gems" AS VARCHAR) AS "created_by_user_gems",
        CAST("created_date" AS TIMESTAMP) AS "created_date",
        CAST("creative_id" AS VARCHAR) AS "creative_id",
        CAST("csi_code" AS VARCHAR) AS "csi_code",
        CAST("current_user_gems_info" AS VARCHAR) AS "current_user_gems_info",
        CAST("custom_description" AS VARCHAR) AS "custom_description",
        CAST("customer_persona" AS VARCHAR) AS "customer_persona",
        CAST("data_enrichment_request" AS VARCHAR) AS "data_enrichment_request",
        CAST("delete_salesloft_data" AS VARCHAR) AS "delete_salesloft_data",
        CAST("demographic_score" AS VARCHAR) AS "demographic_score",
        CAST("department" AS VARCHAR) AS "department",
        CAST("deprecated_partner_contact" AS VARCHAR) AS "deprecated_partner_contact",
        CAST("device_type" AS VARCHAR) AS "device_type",
        CAST("direct_office" AS VARCHAR) AS "direct_office",
        CAST("dnb_contact_phone" AS VARCHAR) AS "dnb_contact_phone",
        CAST("dnb_email" AS VARCHAR) AS "dnb_email",
        CAST("dnb_job_title" AS VARCHAR) AS "dnb_job_title",
        CAST("dnb_optimizer_contact_id" AS VARCHAR) AS "dnb_optimizer_contact_id",
        CAST("dnb_primary_city" AS VARCHAR) AS "dnb_primary_city",
        CAST("dnb_primary_country_code" AS VARCHAR) AS "dnb_primary_country_code",
        CAST("dnb_primary_postal_code" AS VARCHAR) AS "dnb_primary_postal_code",
        CAST("dnb_primary_state" AS VARCHAR) AS "dnb_primary_state",
        CAST("dnb_primary_state_abbr" AS VARCHAR) AS "dnb_primary_state_abbr",
        CAST("do_not_sync_marketo" AS BOOLEAN) AS "do_not_sync_marketo",
        CAST("domain_exists" AS BOOLEAN) AS "domain_exists",
        CAST("drift_cql" AS VARCHAR) AS "drift_cql",
        CAST("email_address" AS VARCHAR) AS "email_address",
        CAST("email_bounce_date" AS DATE) AS "email_bounce_date",
        CAST("email_bounce_reason" AS VARCHAR) AS "email_bounce_reason",
        CAST("email_double_opt_in" AS BOOLEAN) AS "email_double_opt_in",
        CAST("email_explicit_opt_in" AS BOOLEAN) AS "email_explicit_opt_in",
        CAST("email_implicit_opt_in" AS BOOLEAN) AS "email_implicit_opt_in",
        CAST("email_opt_out_timestamp" AS TIMESTAMP) AS "email_opt_out_timestamp",
        CAST("fax_number" AS VARCHAR) AS "fax_number",
        CAST("fax_opt_out" AS BOOLEAN) AS "fax_opt_out",
        CAST("first_activity" AS TIMESTAMP) AS "first_activity",
        CAST("first_activity_post_mql" AS TIMESTAMP) AS "first_activity_post_mql",
        CAST("first_activity_post_mql_date" AS DATE) AS "first_activity_post_mql_date",
        CAST("first_manual_activity_post_mql_date" AS DATE) AS "first_manual_activity_post_mql_date",
        CAST("first_mql_date" AS DATE) AS "first_mql_date",
        CAST("first_search_term" AS VARCHAR) AS "first_search_term",
        CAST("first_search_type" AS VARCHAR) AS "first_search_type",
        CAST("first_touch_url" AS VARCHAR) AS "first_touch_url",
        CAST("fivetran_use_case" AS VARCHAR) AS "fivetran_use_case",
        CAST("free_trial_confirmation_date" AS DATE) AS "free_trial_confirmation_date",
        CAST("gdpr_explicit_opt_in" AS BOOLEAN) AS "gdpr_explicit_opt_in",
        CAST("google_click_id" AS VARCHAR) AS "google_click_id",
        CAST("has_attended_event" AS BOOLEAN) AS "has_attended_event",
        CAST("has_changed_job" AS BOOLEAN) AS "has_changed_job",
        CAST("has_referral" AS BOOLEAN) AS "has_referral",
        CAST("historical_contact_status" AS VARCHAR) AS "historical_contact_status",
        CAST("home_phone_number" AS VARCHAR) AS "home_phone_number",
        CAST("hvr_update" AS TIMESTAMP) AS "hvr_update",
        CAST("individual_id" AS UUID) AS "individual_id",
        CAST("ironclad_workflow_status" AS VARCHAR) AS "ironclad_workflow_status",
        CAST("is_active" AS BOOLEAN) AS "is_active",
        CAST("is_billing_contact_hidden" AS BOOLEAN) AS "is_billing_contact_hidden",
        CAST("is_competitor" AS BOOLEAN) AS "is_competitor",
        CAST("is_deleted" AS BOOLEAN) AS "is_deleted",
        CAST("is_emea_event_routing" AS BOOLEAN) AS "is_emea_event_routing",
        CAST("is_hot_contact" AS BOOLEAN) AS "is_hot_contact",
        CAST("is_relationship_active" AS BOOLEAN) AS "is_relationship_active",
        CAST("is_technical_contact" AS BOOLEAN) AS "is_technical_contact",
        CAST("is_user_gem" AS BOOLEAN) AS "is_user_gem",
        CAST("is_verified" AS BOOLEAN) AS "is_verified",
        CAST("isell_avention_id" AS VARCHAR) AS "isell_avention_id",
        CAST("jigsaw_contact_id" AS VARCHAR) AS "jigsaw_contact_id",
        CAST("jigsaw_data" AS JSON) AS "jigsaw_data",
        CAST("job_function" AS VARCHAR) AS "job_function",
        CAST("job_level" AS VARCHAR) AS "job_level",
        STRING_SPLIT("keywords", ',') AS "keywords",
        CAST("last_activity" AS VARCHAR) AS "last_activity",
        CAST("last_activity_date" AS DATE) AS "last_activity_date",
        CAST("last_ae_activity_owner" AS VARCHAR) AS "last_ae_activity_owner",
        CAST("last_bdr_activity_owner" AS VARCHAR) AS "last_bdr_activity_owner",
        CAST("last_contact_attempt" AS DATE) AS "last_contact_attempt",
        CAST("last_customer_request_date" AS DATE) AS "last_customer_request_date",
        CAST("last_customer_update_date" AS DATE) AS "last_customer_update_date",
        CAST("last_lead_source" AS VARCHAR) AS "last_lead_source",
        CAST("last_lead_source_category" AS VARCHAR) AS "last_lead_source_category",
        CAST("last_lead_source_detail" AS VARCHAR) AS "last_lead_source_detail",
        CAST("last_manual_ae_activity_date" AS DATE) AS "last_manual_ae_activity_date",
        CAST("last_manual_bdr_activity_date" AS DATE) AS "last_manual_bdr_activity_date",
        CAST("last_marketing_moment_date" AS DATE) AS "last_marketing_moment_date",
        CAST("last_modified_date" AS TIMESTAMP) AS "last_modified_date",
        CAST("last_modified_timestamp" AS TIMESTAMP) AS "last_modified_timestamp",
        CAST("last_referenced_date" AS DATE) AS "last_referenced_date",
        CAST("last_sales_activity_datetime" AS TIMESTAMP) AS "last_sales_activity_datetime",
        CAST("last_scored_at" AS TIMESTAMP) AS "last_scored_at",
        CAST("last_sdr_activity_date" AS DATE) AS "last_sdr_activity_date",
        CAST("last_sdr_activity_owner" AS VARCHAR) AS "last_sdr_activity_owner",
        CAST("last_viewed_date" AS DATE) AS "last_viewed_date",
        CAST("lead_grade" AS VARCHAR) AS "lead_grade",
        CAST("lead_score" AS INT) AS "lead_score",
        CAST("lean_data_manual_route_trigger" AS VARCHAR) AS "lean_data_manual_route_trigger",
        CAST("lean_data_matched_buyer_persona" AS VARCHAR) AS "lean_data_matched_buyer_persona",
        CAST("lean_data_modified_score" AS INT) AS "lean_data_modified_score",
        CAST("lean_data_routing_completion_datetime" AS TIMESTAMP) AS "lean_data_routing_completion_datetime",
        CAST("lean_data_segment" AS VARCHAR) AS "lean_data_segment",
        CAST("leandata_owner_override" AS VARCHAR) AS "leandata_owner_override",
        CAST("leandata_status" AS VARCHAR) AS "leandata_status",
        CAST("leandata_tag" AS VARCHAR) AS "leandata_tag",
        CAST("legacy_hvr_id" AS VARCHAR) AS "legacy_hvr_id",
        CAST("linkedin_company_id" AS VARCHAR) AS "linkedin_company_id",
        CAST("linkedin_member_token" AS VARCHAR) AS "linkedin_member_token",
        CAST("linkedin_url" AS VARCHAR) AS "linkedin_url",
        CAST("mailing_geocode_accuracy" AS VARCHAR) AS "mailing_geocode_accuracy",
        CAST("mailing_postal_code" AS VARCHAR) AS "mailing_postal_code",
        CAST("manual_routing" AS VARCHAR) AS "manual_routing",
        CAST("marketing_cloud_subscriber" AS VARCHAR) AS "marketing_cloud_subscriber",
        CAST("marketing_connector_interest" AS VARCHAR) AS "marketing_connector_interest",
        CAST("marketing_process_status" AS VARCHAR) AS "marketing_process_status",
        CAST("marketo_sync_block_reason" AS VARCHAR) AS "marketo_sync_block_reason",
        CAST("master_record_id" AS VARCHAR) AS "master_record_id",
        CAST("match_type" AS VARCHAR) AS "match_type",
        CAST("metadata_creation_date" AS TIMESTAMP) AS "metadata_creation_date",
        CAST("mobile_phone" AS VARCHAR) AS "mobile_phone",
        CAST("mql_date" AS DATE) AS "mql_date",
        CAST("mql_date_changed" AS DATE) AS "mql_date_changed",
        CAST("mql_reason" AS VARCHAR) AS "mql_reason",
        CAST("netsuite_conn_net_suite_sync_err_c" AS VARCHAR) AS "netsuite_conn_net_suite_sync_err_c",
        CAST("netsuite_connection_id" AS VARCHAR) AS "netsuite_connection_id",
        CAST("netsuite_id" AS VARCHAR) AS "netsuite_id",
        CAST("netsuite_record" AS VARCHAR) AS "netsuite_record",
        CAST("no_geo_data" AS BOOLEAN) AS "no_geo_data",
        CAST("notes" AS VARCHAR) AS "notes",
        CAST("opportunity_handoff_ae" AS VARCHAR) AS "opportunity_handoff_ae",
        CAST("original_utm_campaign" AS VARCHAR) AS "original_utm_campaign",
        CAST("original_utm_content" AS VARCHAR) AS "original_utm_content",
        CAST("original_utm_medium" AS VARCHAR) AS "original_utm_medium",
        CAST("original_utm_source" AS VARCHAR) AS "original_utm_source",
        CAST("original_utm_term" AS VARCHAR) AS "original_utm_term",
        CAST("partner_company" AS VARCHAR) AS "partner_company",
        CAST("partner_contact" AS VARCHAR) AS "partner_contact",
        CAST("partner_rep_email" AS VARCHAR) AS "partner_rep_email",
        CAST("partner_rep_name" AS VARCHAR) AS "partner_rep_name",
        CAST("partner_territory" AS VARCHAR) AS "partner_territory",
        CAST("past_account" AS VARCHAR) AS "past_account",
        CAST("past_company" AS VARCHAR) AS "past_company",
        CAST("past_contact_info" AS VARCHAR) AS "past_contact_info",
        CAST("past_job_title" AS VARCHAR) AS "past_job_title",
        CAST("past_user_gems_info" AS VARCHAR) AS "past_user_gems_info",
        CAST("phone_extension" AS VARCHAR) AS "phone_extension",
        CAST("pi_created_date_c" AS TIMESTAMP) AS "pi_created_date_c",
        CAST("previous_lead_source" AS VARCHAR) AS "previous_lead_source",
        CAST("previous_lead_source_details" AS VARCHAR) AS "previous_lead_source_details",
        CAST("primary_sales_engineer" AS VARCHAR) AS "primary_sales_engineer",
        CAST("professional_network" AS VARCHAR) AS "professional_network",
        CAST("promotion_id" AS VARCHAR) AS "promotion_id",
        CAST("recent_campaign_status" AS VARCHAR) AS "recent_campaign_status",
        CAST("referral_account" AS VARCHAR) AS "referral_account",
        CAST("referral_contact" AS VARCHAR) AS "referral_contact",
        CAST("referral_first_name" AS VARCHAR) AS "referral_first_name",
        CAST("referral_last_name" AS VARCHAR) AS "referral_last_name",
        CAST("region" AS VARCHAR) AS "region",
        CAST("reports_to_id" AS VARCHAR) AS "reports_to_id",
        CAST("sales_email_opt_out" AS BOOLEAN) AS "sales_email_opt_out",
        CAST("sales_email_opt_out_datetime" AS TIMESTAMP) AS "sales_email_opt_out_datetime",
        CAST("salesloft_cadence_trigger" AS VARCHAR) AS "salesloft_cadence_trigger",
        CAST("salesloft_owner" AS VARCHAR) AS "salesloft_owner",
        CAST("salesloft_owner_sf_id" AS VARCHAR) AS "salesloft_owner_sf_id",
        CAST("salutation" AS VARCHAR) AS "salutation",
        CAST("secondary_city" AS VARCHAR) AS "secondary_city",
        CAST("secondary_country" AS VARCHAR) AS "secondary_country",
        CAST("secondary_email" AS VARCHAR) AS "secondary_email",
        CAST("secondary_geocode_accuracy" AS VARCHAR) AS "secondary_geocode_accuracy",
        CAST("secondary_phone" AS VARCHAR) AS "secondary_phone",
        CAST("secondary_postal_code" AS VARCHAR) AS "secondary_postal_code",
        CAST("secondary_state" AS VARCHAR) AS "secondary_state",
        CAST("secondary_street" AS VARCHAR) AS "secondary_street",
        CAST("self_service_routing" AS VARCHAR) AS "self_service_routing",
        CAST("seniority_level" AS VARCHAR) AS "seniority_level",
        CAST("skip_netsuite_export" AS BOOLEAN) AS "skip_netsuite_export",
        CAST("startup_certification_eligibility" AS VARCHAR) AS "startup_certification_eligibility",
        CAST("startup_primary_role" AS VARCHAR) AS "startup_primary_role",
        CAST("state" AS VARCHAR) AS "state",
        CAST("state_code" AS VARCHAR) AS "state_code",
        CAST("stripe_customer_level" AS VARCHAR) AS "stripe_customer_level",
        CAST("stripe_default_gateway" AS VARCHAR) AS "stripe_default_gateway",
        CAST("stripe_default_payment_method" AS VARCHAR) AS "stripe_default_payment_method",
        CAST("stripe_encrypted_personal_id" AS VARCHAR) AS "stripe_encrypted_personal_id",
        CAST("stripe_encrypted_ssn_last_4" AS VARCHAR) AS "stripe_encrypted_ssn_last_4",
        CAST("stripe_gender" AS VARCHAR) AS "stripe_gender",
        CAST("stripe_languages" AS VARCHAR) AS "stripe_languages",
        CAST("stripe_maiden_name" AS VARCHAR) AS "stripe_maiden_name",
        CAST("stripe_personal_id_number" AS VARCHAR) AS "stripe_personal_id_number",
        CAST("stripe_personal_id_type" AS VARCHAR) AS "stripe_personal_id_type",
        CAST("stripe_ssn_last_4" AS VARCHAR) AS "stripe_ssn_last_4",
        CAST("test_mode_record" AS BOOLEAN) AS "test_mode_record",
        CAST("trial_start_date" AS DATE) AS "trial_start_date",
        CAST("unqualified_reason" AS VARCHAR) AS "unqualified_reason",
        CAST("used_technologies" AS VARCHAR[]) AS "used_technologies",
        CAST("user_gems_id" AS UUID) AS "user_gems_id",
        CAST("username" AS VARCHAR) AS "username",
        CAST("utm_campaign" AS VARCHAR) AS "utm_campaign",
        CAST("utm_content" AS VARCHAR) AS "utm_content",
        CAST("utm_medium" AS VARCHAR) AS "utm_medium",
        CAST("utm_source" AS VARCHAR) AS "utm_source",
        CAST("utm_term" AS VARCHAR) AS "utm_term",
        CAST("zoominfo_company_id" AS VARCHAR) AS "zoominfo_company_id",
        CAST("zoominfo_contact_id" AS VARCHAR) AS "zoominfo_contact_id",
        CAST("zoominfo_first_updated" AS TIMESTAMP) AS "zoominfo_first_updated",
        CAST("zoominfo_last_updated" AS TIMESTAMP) AS "zoominfo_last_updated"
    FROM "sf_contact_data_removeWideColumns_projected_renamed_cleaned_null"
),

"sf_contact_data_removeWideColumns_projected_renamed_cleaned_null_casted_missing_handled" AS (
    -- Handling missing values: There are 221 columns with unacceptable missing values
    -- account_id has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- act_on_lead_score has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- activity_logged_by has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- ad_group_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- additional_phone_numbers has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- allbound_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- analytics_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- assistant_name has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- assistant_phone has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- associated_opportunity has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- associated_url has 75.0 percent missing. Strategy: 🔄 Unchanged
    -- automation_tracking has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- avatar_url has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- behavioral_score has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- beta_connector_interest has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- birthdate has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- bizible_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- campaign_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- celigo_sfnsio_net_suite_sync_error_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- city has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- clarus_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- clarus_editor has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- clarus_notes has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- clarus_project has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- clarus_status has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- comments has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- company has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- contact_holdover has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- contact_notes has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- contact_owner_manager has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- contact_stage has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- contact_status has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- contact_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- conversion_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- conversion_object_name has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- conversion_object_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- country has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- country_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- created_at has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- created_by_id has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- created_by_role has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- created_by_user_gems has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- creative_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- csi_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- current_user_gems_info has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- custom_description has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- customer_persona has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- data_enrichment_request has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- delete_salesloft_data has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- demographic_score has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- department has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- deprecated_partner_contact has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- description has 50.0 percent missing. Strategy: 🔄 Unchanged
    -- device_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- direct_office has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- dnb_contact_phone has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- dnb_email has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- dnb_email_deliverability_score has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- dnb_job_title has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- dnb_optimizer_contact_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- dnb_phone_accuracy_score has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- dnb_primary_city has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- dnb_primary_country_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- dnb_primary_postal_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- dnb_primary_state has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- dnb_primary_state_abbr has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- do_not_sync_marketo has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- domain_exists has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- drift_cql has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- email has 75.0 percent missing. Strategy: 🔄 Unchanged
    -- email_address has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- email_bounced has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- email_double_opt_in has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- email_explicit_opt_in has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- email_implicit_opt_in has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- email_quality_unknown has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- fax_number has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- first_activity has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- first_name has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- first_search_term has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- first_search_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- first_touch_url has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- fivetran_use_case has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- gdpr_explicit_opt_in has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- google_click_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- historical_contact_status has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- home_phone_number has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- hvr_update has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- individual_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- ironclad_workflow_status has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- is_active has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- is_deleted has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- is_email_bounced has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- is_emea_event_routing has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- is_eu_resident has 75.0 percent missing. Strategy: 🔄 Unchanged
    -- is_relationship_active has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- is_user_gem has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- is_verified has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- isell_avention_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- jigsaw_contact_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- jigsaw_data has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- job_function has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- job_level has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- job_title has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- keywords has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_activity has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_activity_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_ae_activity_owner has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_bdr_activity_owner has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_lead_source has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_lead_source_category has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_lead_source_detail has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_manual_ae_activity_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_manual_bdr_activity_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_marketing_moment_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_modified_by_id has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- last_name has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- last_referenced_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_sales_activity_datetime has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_scored_at has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_viewed_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_source has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- lean_data_manual_route_trigger has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lean_data_matched_buyer_persona has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lean_data_modified_score has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lean_data_routing_completion_datetime has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lean_data_segment has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- leandata_owner_override has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- leandata_status has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- leandata_tag has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- legacy_hvr_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- linkedin_company_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- linkedin_member_token has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- linkedin_url has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- mailing_city has 75.0 percent missing. Strategy: 🔄 Unchanged
    -- mailing_country has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- mailing_country_code has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- mailing_geocode_accuracy has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- mailing_latitude has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- mailing_longitude has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- mailing_postal_code has 75.0 percent missing. Strategy: 🔄 Unchanged
    -- mailing_street has 75.0 percent missing. Strategy: 🔄 Unchanged
    -- manual_routing has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- marketing_campaign has 75.0 percent missing. Strategy: 🔄 Unchanged
    -- marketing_cloud_subscriber has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- marketing_connector_interest has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- marketing_process_status has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- marketo_sync_block_reason has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- master_record_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- match_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- metadata_creation_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- mobile_phone has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- name has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- needs_score_sync has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- netsuite_celigo_update has 50.0 percent missing. Strategy: 🔄 Unchanged
    -- netsuite_conn_net_suite_sync_err_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- netsuite_connection_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- netsuite_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- netsuite_record has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- no_geo_data has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- notes has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- opportunity_handoff_ae has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- original_utm_campaign has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- original_utm_content has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- original_utm_medium has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- original_utm_source has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- original_utm_term has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- owner_id has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- partner_company has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- partner_contact has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- partner_rep_email has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- partner_rep_name has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- partner_territory has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- past_account has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- past_company has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- past_contact_info has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- past_job_title has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- past_user_gems_info has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- phone has 50.0 percent missing. Strategy: 🔄 Unchanged
    -- photo_url has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- previous_lead_source has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- previous_lead_source_details has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- primary_sales_engineer has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- professional_network has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- promotion_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- recent_campaign_status has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- referral_account has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- referral_contact has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- referral_first_name has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- referral_last_name has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- region has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- reports_to_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- sales_email_opt_out has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- sales_email_opt_out_datetime has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- salesloft_cadence_trigger has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- salesloft_owner has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- salesloft_owner_sf_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- salutation has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- self_service_routing has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- seniority_level has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- skip_netsuite_export has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- source_detail has 75.0 percent missing. Strategy: 🔄 Unchanged
    -- startup_certification_eligibility has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- startup_primary_role has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- state has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- state_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- test_mode_record has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- trial_start_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- unqualified_reason has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- used_technologies has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- user_gems_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- username has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- utm_campaign has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- utm_content has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- utm_medium has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- utm_source has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- utm_term has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- zoominfo_company_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- zoominfo_contact_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- zoominfo_first_updated has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- zoominfo_last_updated has 100.0 percent missing. Strategy: 🗑️ Drop Column
    SELECT
        "associated_url",
        "secondary_latitude",
        "mailing_country",
        "account_id",
        "pushed_from_opportunity",
        "mailing_street",
        "is_eu_resident",
        "last_name",
        "mailing_country_code",
        "created_by_id",
        "photo_url",
        "clearbit_id",
        "source_detail",
        "email_quality_unknown",
        "email_bounced",
        "email",
        "last_modified_by_id",
        "lean_data_routing_action",
        "no_longer_at_company",
        "push_to_netsuite",
        "mailing_city",
        "description",
        "is_email_bounced",
        "needs_score_sync",
        "do_not_route_lead",
        "lead_source",
        "clearbit_data_ready",
        "phone",
        "email_hard_bounced",
        "secondary_longitude",
        "job_title",
        "email_opt_out",
        "created_by_clearbit",
        "name",
        "mailing_state",
        "mailing_state_code",
        "netsuite_celigo_update",
        "owner_id",
        "netsuite_sync_in_progress",
        "contact_status",
        "do_not_call",
        "marketing_campaign",
        "contact_id",
        "clearbit_role",
        "clearbit_seniority",
        "clearbit_sub_role",
        "created_date",
        "email_bounce_date",
        "email_bounce_reason",
        "email_opt_out_timestamp",
        "fax_opt_out",
        "first_activity_post_mql",
        "first_activity_post_mql_date",
        "first_manual_activity_post_mql_date",
        "first_mql_date",
        "free_trial_confirmation_date",
        "has_attended_event",
        "has_changed_job",
        "has_referral",
        "is_billing_contact_hidden",
        "is_competitor",
        "is_hot_contact",
        "is_technical_contact",
        "last_contact_attempt",
        "last_customer_request_date",
        "last_customer_update_date",
        "last_modified_date",
        "last_modified_timestamp",
        "last_sdr_activity_date",
        "last_sdr_activity_owner",
        "lead_grade",
        "lead_score",
        "mailing_postal_code",
        "mql_date",
        "mql_date_changed",
        "mql_reason",
        "phone_extension",
        "pi_created_date_c",
        "secondary_city",
        "secondary_country",
        "secondary_email",
        "secondary_geocode_accuracy",
        "secondary_phone",
        "secondary_postal_code",
        "secondary_state",
        "secondary_street",
        "stripe_customer_level",
        "stripe_default_gateway",
        "stripe_default_payment_method",
        "stripe_encrypted_personal_id",
        "stripe_encrypted_ssn_last_4",
        "stripe_gender",
        "stripe_languages",
        "stripe_maiden_name",
        "stripe_personal_id_number",
        "stripe_personal_id_type",
        "stripe_ssn_last_4"
    FROM "sf_contact_data_removeWideColumns_projected_renamed_cleaned_null_casted"
)

-- COCOON BLOCK END
SELECT * FROM "sf_contact_data_removeWideColumns_projected_renamed_cleaned_null_casted_missing_handled"

stg_sf_contact_data.yml (Document the table)

version: 2
models:
- name: stg_sf_contact_data
  description: The table is about contact data. It includes contact details like name,
    email, phone, and address. It has professional info such as job title and company.
    The table tracks marketing data, sales activities, and system metadata. It contains
    many custom fields for specific business processes and integrations.
  columns:
  - name: associated_url
    description: Associated URL
    tests:
    - not_null
  - name: secondary_latitude
    description: Latitude for secondary address
    cocoon_meta:
      missing_acceptable: Not applicable for entries without secondary addresses
  - name: mailing_country
    description: Country for mailing address
    tests:
    - not_null
  - name: account_id
    description: Unique identifier for the associated account
    tests:
    - not_null
  - name: pushed_from_opportunity
    description: Flag if pushed from Opportunity to NetSuite
    cocoon_meta:
      missing_acceptable: Only applicable for records originating from opportunities
  - name: mailing_street
    description: Street address for mailing
    tests:
    - not_null
  - name: is_eu_resident
    description: Indicates if contact is an EU resident
    tests:
    - not_null
  - name: last_name
    description: Contact's last name
    tests:
    - not_null
  - name: mailing_country_code
    description: Country code for mailing address
    tests:
    - not_null
  - name: created_by_id
    description: ID of user who created the record
    tests:
    - not_null
  - name: photo_url
    description: URL of contact's photo
    tests:
    - not_null
  - name: clearbit_id
    description: Clearbit integration identifier
    tests:
    - unique
    cocoon_meta:
      missing_acceptable: Clearbit-specific identifier, not applicable if not using
        Clearbit service.
      uniqueness: This column represents the Clearbit integration identifier. For
        this table, each row is for a unique contact. If this ID is consistently provided
        by Clearbit for each unique contact, it could serve as a candidate key.
  - name: source_detail
    description: Detailed source information for contact
    tests:
    - not_null
  - name: email_quality_unknown
    description: Indicates if email quality is unknown
    tests:
    - not_null
  - name: email_bounced
    description: Flag indicating if email has bounced
    tests:
    - not_null
  - name: email
    description: Email address of the contact
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column represents the email address of the contact. For this
        table, each row is for a unique contact. Email addresses are typically unique
        for each contact in a professional context.
  - name: last_modified_by_id
    description: ID of user who last modified the record
    tests:
    - not_null
  - name: lean_data_routing_action
    description: LeanData routing action taken
    tests:
    - accepted_values:
        values:
        - converted
        - converted - new account
        - converted - existing account
        - not converted
        - routed to sales
        - routed to marketing
        - routed to support
        - on hold
        - rejected
        - other
    cocoon_meta:
      missing_acceptable: Not applicable if lead hasn't been routed yet.
  - name: no_longer_at_company
    description: Flag if contact left the company
    cocoon_meta:
      missing_acceptable: Only applicable for former employees
  - name: push_to_netsuite
    description: Flag to push data to NetSuite
    cocoon_meta:
      missing_acceptable: Only applicable for records that interact with NetSuite
  - name: mailing_city
    description: City for mailing address
    tests:
    - not_null
  - name: description
    description: Description or notes about the contact
    tests:
    - not_null
  - name: is_email_bounced
    description: Indicates if email to the contact has bounced
    tests:
    - not_null
  - name: needs_score_sync
    description: Indicates if score needs syncing
    tests:
    - not_null
  - name: do_not_route_lead
    description: Flag to prevent lead routing
    cocoon_meta:
      missing_acceptable: Not applicable if lead routing is allowed
  - name: lead_source
    description: Source of the lead or contact
    tests:
    - not_null
  - name: clearbit_data_ready
    description: Indicates if Clearbit data is ready
    cocoon_meta:
      missing_acceptable: Indicates if Clearbit data is ready, not applicable if not
        using Clearbit.
  - name: phone
    description: Primary phone number
    tests:
    - not_null
  - name: email_hard_bounced
    description: Email hard bounce status
    cocoon_meta:
      missing_acceptable: Not applicable if email hasn't bounced
  - name: secondary_longitude
    description: Longitude for secondary address
    cocoon_meta:
      missing_acceptable: Not applicable for entries without secondary addresses
  - name: job_title
    description: Job title of the contact
    tests:
    - not_null
  - name: email_opt_out
    description: Indicates if contact has opted out of emails
    cocoon_meta:
      missing_acceptable: Not applicable if user hasn't opted out
  - name: created_by_clearbit
    description: Contact created by Clearbit flag
    cocoon_meta:
      missing_acceptable: Indicates if created by Clearbit, not applicable if not
        using Clearbit.
  - name: name
    description: Contact's full name
    tests:
    - not_null
  - name: mailing_state
    description: State for mailing address
    cocoon_meta:
      missing_acceptable: Not applicable for countries without states/provinces.
  - name: mailing_state_code
    description: State code for mailing address
    tests:
    - accepted_values:
        values:
        - AL
        - AK
        - AZ
        - AR
        - CA
        - CO
        - CT
        - DE
        - FL
        - GA
        - HI
        - ID
        - IL
        - IN
        - IA
        - KS
        - KY
        - LA
        - ME
        - MD
        - MA
        - MI
        - MN
        - MS
        - MO
        - MT
        - NE
        - NV
        - NH
        - NJ
        - NM
        - NY
        - NC
        - ND
        - OH
        - OK
        - OR
        - PA
        - RI
        - SC
        - SD
        - TN
        - TX
        - UT
        - VT
        - VA
        - WA
        - WV
        - WI
        - WY
    cocoon_meta:
      missing_acceptable: Not applicable for countries without state/province codes.
  - name: netsuite_celigo_update
    description: NetSuite Celigo update flag
    tests:
    - not_null
  - name: owner_id
    description: ID of the contact owner
    tests:
    - not_null
  - name: netsuite_sync_in_progress
    description: Flag if NetSuite sync is in progress
    cocoon_meta:
      missing_acceptable: Only applicable when syncing with NetSuite
  - name: contact_status
    description: Status of the contact
    tests:
    - not_null
    - accepted_values:
        values:
        - Attempting Contact
        - Contact Made
        - No Contact
        - Contact Refused
        - Wrong Contact Information
        - Follow-up Required
        - Scheduled
        - Completed
        - Not Applicable
  - name: do_not_call
    description: Flag indicating if contact should not be called
    cocoon_meta:
      missing_acceptable: Not applicable if calling is allowed
  - name: marketing_campaign
    description: Associated marketing campaign
    tests:
    - not_null
  - name: contact_id
    description: Unique identifier for the contact record
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column represents the unique identifier for the contact record.
        For this table, each row is for a unique contact. Contact ID is specifically
        designed to be unique for each contact.
  - name: clearbit_role
    description: Role information from Clearbit
    cocoon_meta:
      missing_acceptable: Role information from Clearbit, not applicable if not using
        Clearbit.
  - name: clearbit_seniority
    description: Seniority information from Clearbit
    cocoon_meta:
      missing_acceptable: Seniority information from Clearbit, not applicable if not
        using Clearbit.
  - name: clearbit_sub_role
    description: Sub-role information from Clearbit
    cocoon_meta:
      missing_acceptable: Sub-role information from Clearbit, not applicable if not
        using Clearbit.
  - name: created_date
    description: Date record was created
    tests:
    - not_null
  - name: email_bounce_date
    description: Date when an email to the contact bounced
    cocoon_meta:
      missing_acceptable: Not applicable if email hasn't bounced
  - name: email_bounce_reason
    description: Reason for email bounce
    cocoon_meta:
      missing_acceptable: Not applicable if email hasn't bounced
  - name: email_opt_out_timestamp
    description: Date and time when contact opted out of emails
    cocoon_meta:
      missing_acceptable: Not applicable if user hasn't opted out
  - name: fax_opt_out
    description: Indicates if contact has opted out of faxes
    cocoon_meta:
      missing_acceptable: Not applicable if fax communication is allowed
  - name: first_activity_post_mql
    description: First activity type after MQL status changed
    cocoon_meta:
      missing_acceptable: Not applicable if no activity after becoming MQL
  - name: first_activity_post_mql_date
    description: Date of first activity after MQL status changed
    cocoon_meta:
      missing_acceptable: Not applicable if no activity after becoming MQL
  - name: first_manual_activity_post_mql_date
    description: Date of first manual activity after MQL status
    cocoon_meta:
      missing_acceptable: Not applicable if no manual activity after becoming MQL
  - name: first_mql_date
    description: Date when contact first became a Marketing Qualified Lead
    cocoon_meta:
      missing_acceptable: Not applicable if lead hasn't reached MQL status
  - name: free_trial_confirmation_date
    description: Date when free trial email was confirmed
    cocoon_meta:
      missing_acceptable: Not applicable if user didn't start a free trial
  - name: has_attended_event
    description: Indicates if contact attended an event
    cocoon_meta:
      missing_acceptable: Not applicable if no events were organized
  - name: has_changed_job
    description: Indicates if contact has changed jobs
    cocoon_meta:
      missing_acceptable: Not applicable for new contacts or stable employment
  - name: has_referral
    description: Indicates if a referral exists for contact
    cocoon_meta:
      missing_acceptable: Not applicable if not referred by anyone
  - name: is_billing_contact_hidden
    description: Hidden field for billing contact information
    cocoon_meta:
      missing_acceptable: Not applicable if not a billing contact
  - name: is_competitor
    description: Indicates if the contact is a competitor
    cocoon_meta:
      missing_acceptable: Not applicable if not assessed for competitor status
  - name: is_hot_contact
    description: Indicates if the contact is considered 'hot'
    cocoon_meta:
      missing_acceptable: Not applicable if not evaluated for priority
  - name: is_technical_contact
    description: Indicates if the contact is a technical point of contact
    cocoon_meta:
      missing_acceptable: Not applicable if not in a technical role
  - name: last_contact_attempt
    description: Timestamp of last attempt to contact
    cocoon_meta:
      missing_acceptable: Not applicable if never contacted
  - name: last_customer_request_date
    description: Date of last customer request
    cocoon_meta:
      missing_acceptable: Not applicable if never made a request
  - name: last_customer_update_date
    description: Date of last customer update
    cocoon_meta:
      missing_acceptable: Not applicable if no updates were made
  - name: last_modified_date
    description: Date and time of last record modification
    tests:
    - not_null
  - name: last_modified_timestamp
    description: Timestamp of last system modification
    tests:
    - not_null
  - name: last_sdr_activity_date
    description: Date of last SDR activity
    cocoon_meta:
      missing_acceptable: Not applicable if no SDR activity has occurred yet.
  - name: last_sdr_activity_owner
    description: Owner of last SDR activity
    cocoon_meta:
      missing_acceptable: Not applicable if no SDR activity has occurred yet.
  - name: lead_grade
    description: Lead or contact grade
    cocoon_meta:
      missing_acceptable: Not applicable if lead grading system is not used.
  - name: lead_score
    description: Numeric score of lead or contact
    cocoon_meta:
      missing_acceptable: Not applicable if lead scoring system is not used.
  - name: mailing_postal_code
    description: Postal code for mailing address
    tests:
    - not_null
  - name: mql_date
    description: Marketing Qualified Lead date
    cocoon_meta:
      missing_acceptable: Not applicable if lead hasn't become MQL yet.
  - name: mql_date_changed
    description: MQL date change flag
    cocoon_meta:
      missing_acceptable: Not applicable if lead hasn't become MQL yet.
  - name: mql_reason
    description: Reason for MQL status
    cocoon_meta:
      missing_acceptable: Not applicable if lead hasn't become MQL yet.
  - name: phone_extension
    description: Phone extension number
    cocoon_meta:
      missing_acceptable: Only applicable if main phone number exists
  - name: pi_created_date_c
    description: ''
    tests:
    - not_null
  - name: secondary_city
    description: Secondary or alternative city
    cocoon_meta:
      missing_acceptable: Only applicable if person has secondary address
  - name: secondary_country
    description: Secondary or alternative country
    cocoon_meta:
      missing_acceptable: Only applicable if person has secondary address
  - name: secondary_email
    description: Secondary email address for contact
    cocoon_meta:
      missing_acceptable: Only applicable if person has multiple email addresses
  - name: secondary_geocode_accuracy
    description: Geocode accuracy for secondary address
    cocoon_meta:
      missing_acceptable: Not applicable for entries without secondary addresses
  - name: secondary_phone
    description: Secondary or alternative phone number
    cocoon_meta:
      missing_acceptable: Not applicable for entries without secondary phone numbers
  - name: secondary_postal_code
    description: Postal code for secondary address
    cocoon_meta:
      missing_acceptable: Not applicable for entries without secondary addresses
  - name: secondary_state
    description: State for secondary address
    cocoon_meta:
      missing_acceptable: Not applicable for entries without secondary addresses
  - name: secondary_street
    description: Street for secondary address
    cocoon_meta:
      missing_acceptable: Not applicable for entries without secondary addresses
  - name: stripe_customer_level
    description: Customer level information for Stripe
    cocoon_meta:
      missing_acceptable: Not applicable for non-Stripe customers
  - name: stripe_default_gateway
    description: Default payment gateway for Stripe
    cocoon_meta:
      missing_acceptable: Not applicable for non-Stripe customers
  - name: stripe_default_payment_method
    description: Default payment method for Stripe
    cocoon_meta:
      missing_acceptable: Not applicable for non-Stripe customers
  - name: stripe_encrypted_personal_id
    description: Encrypted personal ID number for Stripe
    cocoon_meta:
      missing_acceptable: Not applicable for non-Stripe customers
  - name: stripe_encrypted_ssn_last_4
    description: Encrypted last 4 digits of SSN for Stripe
    cocoon_meta:
      missing_acceptable: Not applicable for non-Stripe customers
  - name: stripe_gender
    description: Gender information for Stripe
    cocoon_meta:
      missing_acceptable: Not applicable for non-Stripe customers
  - name: stripe_languages
    description: Languages spoken by contact for Stripe
    cocoon_meta:
      missing_acceptable: Not applicable for non-Stripe customers
  - name: stripe_maiden_name
    description: Maiden name information for Stripe
    cocoon_meta:
      missing_acceptable: Not applicable for non-Stripe customers
  - name: stripe_personal_id_number
    description: Personal ID number for Stripe
    cocoon_meta:
      missing_acceptable: Not applicable for non-Stripe customers
  - name: stripe_personal_id_type
    description: Type of personal ID for Stripe
    cocoon_meta:
      missing_acceptable: Not applicable for non-Stripe customers
  - name: stripe_ssn_last_4
    description: Last 4 digits of SSN for Stripe
    cocoon_meta:
      missing_acceptable: Not applicable for non-Stripe customers

stg_sf_lead_data (first 100 rows)

last_utm_medium routing_action photo_url is_converted email_explicit_opt_in is_emea_event_routing email_quality active_in_sequence is_user_gem do_not_route_lead status email_implicit_opt_in email_opt_out manual_routing_trigger email_double_opt_in clearbit_ready last_interaction_description contact_stage enrichment_requested demo_scheduled_calendly last_name converted_account_id id lead_urgency_value last_utm_term email last_modified_by_id is_verified last_interaction_source behavioral_score last_interaction_type startup_eligibility_certified marketo_sync_disabled sales_email_opt_out reporting_matched_account created_by_clearbit created_by_user_gems last_utm_content is_unread_by_owner routing_status bombora_total_composite_score created_by_id attended_event mql_reason email_bounced_c prospect_routing_rules lead_priority_score converted_contact_id owner_id is_deleted industry annual_revenue first_name fivetran_use_case intent_score is_to_delete is_competitor company last_utm_campaign gdpr_opt_in_status csi_description account_all_products account_bi_tools account_data_warehouses act_on_lead_score ad_group_id alexa_rank all_connectors all_data_warehouses all_lead_source_categories all_lead_source_details all_utm_content all_utm_ids all_utm_sources allbound_id bizible_2_account bizible_2_ad_campaign_name_first_touch bizible_2_ad_campaign_name_last_touch bizible_2_id bizible_2_landing_page_first_touch bizible_2_landing_page_last_touch bizible_2_marketing_channel_first_touch bombora_last_update_date bombora_surge_record_count bounced_email_c calendly_creation_date clarus_date clarus_editor clarus_notes clarus_project clarus_status cloudingo_agent_as cloudingo_agent_les conversion_date conversion_object_name conversion_object_type converted_date converted_datetime converted_opportunity_id created_date creative_assets data_warehouse_products datawarehouse_used email_bounced_date email_bounced_reason email_opt_out_datetime engagio_first_engagement_date first_mql_date first_search_term first_search_type first_touch_url first_touchpoint_date first_touchpoint_source first_utm_campaign first_utm_content first_utm_id first_utm_medium first_utm_source first_utm_term fivetran_account_id fivetran_account_stage fivetran_association_date fivetran_sync_status fivetran_user_id fivetran_user_roles free_trial_confirmation_date google_click_id has_changed_job intent_timestamp intent_topics last_completed_salesloft_step last_interesting_moment_date last_modified_date last_modified_timestamp latest_salesloft_cadence_name lead_creation_datetime lead_grade lead_number_c lead_relative_score lead_segment metadata_creation_date mql_date next_salesloft_step_due_date opportunity_competitors opportunity_products original_referrer original_search_engine original_search_phrase original_utm_campaign original_utm_content original_utm_medium original_utm_source original_utm_term pardot_hard_bounced pardot_last_scored_at partner_rep_email partner_rep_name partner_type past_account past_user_gems_info referral_account referral_contact referral_contact_email referral_first_name referral_last_name reporting_timestamp sales_email_opt_out_datetime salesloft_cadence_trigger trial_start_date twitter_url volume_in_millions
0 paid_social converted /services/images/photo/00Q1G00000nDnM5UAK True True False False False False False Converted False False False False False Metadata Lead Conversion - 04 ADS-2022-MetadataADS-Q1Y22-EMEA-DACH-ETLTools Prospect False False Croc 0011G00000tLWKnQAO 00Q1G00000nDnM5UAK 3 Q122 EMEA_Germany-SFDC h@gmail.com 0051G000007F2JGQA0 False Lead action 0 Milestone False False False 0011G00000fV7vHQAS False False LinkedIn False converted NaN 0051G0000060XhiQAE False Website False False 60 0031G00001QtDPlQAN 00537000003tmTnAAI False Internet Software & Services 280522000 H Unknown NaN False False Z Q122-EMEA-DACH-ETLTools_SFDC False RAW [] [] [None] NaN None NaN [None] [] [None] [] [] [null] [null] None None None None None None None None NaT NaN None NaT NaT None None None None 0 0 None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None 2019-11-11 17:23:34 None None None None None NaT NaT NaT None None None NaT None None None None None None None None None NaT None None None NaT None NaN NaT NaN None 2019-11-11 17:23:34 2019-11-11 17:23:34 2019-11-11 17:23:34 None 2019-11-11 17:23:34 None 1305025 None None 2019-11-11 17:23:34 NaT NaT None None None None None None None None None None NaN NaT None None None None None None None None None None 2019-11-11 17:23:34 NaT None NaT None 0.0

stg_sf_lead_data.sql (clean the table)

-- COCOON BLOCK START: PLEASE DO NOT MODIFY THIS BLOCK FOR SELF-MAINTENANCE
WITH 
"sf_lead_data_projected" AS (
    -- Projection: Selecting 381 out of 382 columns
    -- Columns projected out: ['_fivetran_synced']
    SELECT 
        "country",
        "email_bounced_reason",
        "email_bounced_date",
        "owner_id",
        "secondary_email_c",
        "lead_source",
        "converted_date",
        "last_modified_date",
        "master_record_id",
        "last_modified_by_id",
        "system_modstamp",
        "geocode_accuracy",
        "converted_contact_id",
        "up_region_c",
        "id",
        "photo_url",
        "state",
        "longitude",
        "last_referenced_date",
        "up_district_c",
        "last_activity_date",
        "country_code",
        "phone",
        "mc_4_sf_mc_subscriber_c",
        "name",
        "jigsaw_contact_id",
        "lead_source_detail_c",
        "created_by_id",
        "salutation",
        "is_converted",
        "state_code",
        "is_unread_by_owner",
        "status",
        "city",
        "latitude",
        "cbit_clearbit_c",
        "industry",
        "title",
        "last_viewed_date",
        "converted_opportunity_id",
        "is_deleted",
        "street",
        "company",
        "first_name",
        "email",
        "website",
        "last_name",
        "number_of_employees",
        "up_territory_c",
        "created_date",
        "gclid_c",
        "active_in_sequence_c",
        "postal_code",
        "cbit_clearbit_ready_c",
        "has_opted_out_of_email",
        "converted_account_id",
        "mobile_phone",
        "calendly_created_c",
        "account_c",
        "all_connectors_c",
        "all_data_warehouses_c",
        "bi_tools_c",
        "competitors_c",
        "annual_revenue",
        "connectors_products_c",
        "contact_c",
        "data_warehouse_products_c",
        "notes_c",
        "timeframe_c",
        "account_all_products_c",
        "account_bi_tools_c",
        "account_data_warehouses_c",
        "opportunity_competitors_c",
        "opportunity_products_c",
        "description",
        "referral_account_c",
        "referral_contact_c",
        "volume_in_millions_c",
        "feature_requests_c",
        "lead_number_c",
        "demo_scheduled_by_calenderly_c",
        "to_delete_c",
        "bounced_email_c",
        "email_quality_c",
        "email_quality_catchall_c",
        "old_lead_source_c",
        "email_bounced_c",
        "old_lead_source_detail_c",
        "utm_medium_c",
        "utm_source_c",
        "utm_campaign_c",
        "utm_content_c",
        "utm_term_c",
        "act_on_lead_score_c",
        "cbit_created_by_clearbit_c",
        "fivetran_user_id_c",
        "geo_state_acton_c",
        "actoncountry_c",
        "actoncity_c",
        "actoncountrycode_c",
        "actonpostalcode_c",
        "actonreferrer_c",
        "actonstate_c",
        "geo_city_c",
        "geo_country_c",
        "geo_country_code_c",
        "geo_postal_code_c",
        "geo_state_c",
        "company_type_c",
        "pi_campaign_c",
        "pi_comments_c",
        "pi_conversion_date_c",
        "pi_conversion_object_name_c",
        "pi_conversion_object_type_c",
        "pi_created_date_c",
        "pi_first_activity_c",
        "pi_first_search_term_c",
        "pi_first_search_type_c",
        "pi_first_touch_url_c",
        "pi_grade_c",
        "pi_last_activity_c",
        "pi_needs_score_synced_c",
        "pi_notes_c",
        "pi_pardot_hard_bounced_c",
        "pi_pardot_last_scored_at_c",
        "pi_score_c",
        "pi_url_c",
        "pi_utm_campaign_c",
        "pi_utm_content_c",
        "pi_utm_medium_c",
        "pi_utm_source_c",
        "pi_utm_term_c",
        "fax",
        "region_c",
        "competitor_c",
        "source_detail_c",
        "fivetran_account_stage_c",
        "fivetran_account_id_c",
        "lean_data_router_status_c",
        "lean_data_matched_lead_c",
        "lean_data_routing_action_c",
        "lean_data_search_index_c",
        "lean_data_reporting_matched_account_c",
        "lean_data_reporting_timestamp_c",
        "lean_data_ld_segment_c",
        "lean_data_marketing_sys_created_date_c",
        "lean_data_matched_account_c",
        "lean_data_a_2_b_account_c",
        "lean_data_search_c",
        "lean_data_routing_status_c",
        "lean_data_a_2_b_group_c",
        "lean_data_matched_buyer_persona_c",
        "lean_data_tag_c",
        "lean_data_status_info_c",
        "lean_data_modified_score_c",
        "do_not_route_lead_c",
        "partner_type_c",
        "allbound_id_c",
        "lid_linked_in_company_id_c",
        "lid_linked_in_member_token_c",
        "lean_data_re_route_c",
        "sales_loft_1_most_recent_cadence_next_step_due_date_c",
        "sales_loft_1_most_recent_last_completed_step_c",
        "sales_loft_1_most_recent_cadence_name_c",
        "network_c",
        "matchtype_c",
        "device_c",
        "creative_c",
        "adgroupid_c",
        "keyword_c",
        "campaignid_c",
        "partner_rep_email_c",
        "partner_rep_name_c",
        "lead_type_c",
        "contact_stage_c",
        "original_utm_campaign_c",
        "original_utm_content_c",
        "original_utm_medium_c",
        "original_utm_source_c",
        "original_utm_term_c",
        "es_app_esalexa_rank_c",
        "es_app_esaudience_names_c",
        "es_app_escity_c",
        "es_app_escompany_phone_c",
        "es_app_escountry_c",
        "es_app_escreated_timestamp_c",
        "es_app_esecid_c",
        "es_app_esemployees_c",
        "es_app_esenriched_c",
        "es_app_esenriched_timestamp_c",
        "es_app_esfacebook_c",
        "es_app_esindustry_c",
        "es_app_esintent_aggregate_score_c",
        "es_app_esintent_timestamp_c",
        "es_app_esintent_topics_c",
        "es_app_eskeywords_c",
        "es_app_eslinked_in_c",
        "es_app_esoverall_fit_score_c",
        "es_app_esrevenue_c",
        "es_app_essource_c",
        "es_app_esstate_c",
        "es_app_esstreet_c",
        "es_app_estechnologies_c",
        "es_app_estwitter_c",
        "es_app_eszipcode_c",
        "marketing_prospect_routing_rules_c",
        "individual_id",
        "marketing_process_c",
        "automation_tracking_c",
        "user_gems_has_changed_job_c",
        "user_gems_linked_in_c",
        "email_opt_in_c",
        "email_opt_in_explicit_c",
        "email_opt_in_implicit_c",
        "gdpr_opt_in_explicit_c",
        "user_gems_is_a_user_gem_c",
        "user_gems_past_account_c",
        "user_gems_past_company_c",
        "user_gems_past_contact_c",
        "user_gems_past_title_c",
        "promotion_id_c",
        "previous_customer_c",
        "referral_contact_email_c",
        "referral_firstname_c",
        "referral_last_name_c",
        "mkto_71_lead_score_c",
        "mkto_71_acquisition_date_c",
        "mkto_71_acquisition_program_id_c",
        "mkto_acquisition_program_c",
        "mkto_71_inferred_city_c",
        "mkto_71_inferred_company_c",
        "mkto_71_inferred_country_c",
        "mkto_71_inferred_metropolitan_area_c",
        "mkto_71_inferred_phone_area_code_c",
        "mkto_71_inferred_postal_code_c",
        "mkto_71_inferred_state_region_c",
        "mkto_71_original_referrer_c",
        "mkto_71_original_search_engine_c",
        "mkto_71_original_search_phrase_c",
        "mkto_71_original_source_info_c",
        "mkto_71_original_source_type_c",
        "mkto_si_hide_date_c",
        "mkto_si_last_interesting_moment_date_c",
        "mkto_si_last_interesting_moment_desc_c",
        "mkto_si_last_interesting_moment_source_c",
        "mkto_si_last_interesting_moment_type_c",
        "mkto_si_msicontact_id_c",
        "mkto_si_priority_c",
        "mkto_si_relative_score_value_c",
        "mkto_si_urgency_value_c",
        "cloudingo_agent_ar_c",
        "cloudingo_agent_ardi_c",
        "cloudingo_agent_as_c",
        "cloudingo_agent_atz_c",
        "cloudingo_agent_av_c",
        "cloudingo_agent_les_c",
        "do_not_sync_marketo_c",
        "source_every_utm_campaign_c",
        "source_every_utm_content_c",
        "source_every_utm_medium_c",
        "source_every_utm_source_c",
        "source_every_utm_term_c",
        "source_first_utm_campaign_c",
        "source_first_utm_content_c",
        "source_first_utm_medium_c",
        "source_first_utm_source_c",
        "source_first_utm_term_c",
        "source_last_utm_campaign_c",
        "source_last_utm_content_c",
        "source_last_utm_medium_c",
        "source_last_utm_source_c",
        "source_last_utm_term_c",
        "direct_office_c",
        "city_c",
        "country_c",
        "state_c",
        "source_first_lead_source_category_c",
        "source_last_lead_source_c",
        "source_last_lead_source_category_c",
        "source_last_lead_source_detail_c",
        "source_every_lead_source_c",
        "source_every_lead_source_category_c",
        "source_every_lead_source_detail_c",
        "source_first_lead_source_c",
        "source_first_lead_source_detail_c",
        "behavioral_score_c",
        "demographic_score_c",
        "drift_cql_c",
        "unique_email_c",
        "is_emea_event_routing_c",
        "csi_code_c",
        "csi_description_c",
        "converted_date_time_c",
        "lead_created_date_time_reporting_c",
        "lead_iq_country_c",
        "lead_iq_employee_count_c",
        "lead_iq_employee_range_c",
        "lead_iq_state_c",
        "lead_iq_zip_code_c",
        "zoominfo_country_c",
        "zoominfo_employee_count_c",
        "zoominfo_state_c",
        "zoominfo_technologies_c",
        "zoominfo_zip_code_c",
        "attended_event_c",
        "mql_date_c",
        "user_gems_user_gems_id_c",
        "dozisf_zoom_info_company_id_c",
        "dozisf_zoom_info_first_updated_c",
        "dozisf_zoom_info_id_c",
        "dozisf_zoom_info_last_updated_c",
        "lean_data_manual_route_trigger_c",
        "first_mql_date_c",
        "fivetran_account_association_date_c",
        "fivetran_account_user_role_s_c",
        "mql_reason_c",
        "trial_contact_start_date_c",
        "enrichment_request_c",
        "meta_data_create_date_c",
        "clarus_date_c",
        "clarus_editor_c",
        "clarus_notes_c",
        "clarus_project_c",
        "clarus_status_c",
        "marketing_connector_interest_c",
        "recent_marketing_campaign_status_c",
        "salesloft_cadence_trigger_c",
        "datawarehouse_used_c",
        "contact_status_c",
        "leandata_contact_owner_override_c",
        "potential_fivetran_use_case_c",
        "bizible_2_account_c",
        "bizible_2_ad_campaign_name_ft_c",
        "bizible_2_ad_campaign_name_lc_c",
        "bizible_2_bizible_id_c",
        "bizible_2_landing_page_ft_c",
        "bizible_2_landing_page_lc_c",
        "bizible_2_marketing_channel_ft_c",
        "bizible_2_marketing_channel_lc_c",
        "bizible_2_touchpoint_date_ft_c",
        "bizible_2_touchpoint_date_lc_c",
        "bizible_2_touchpoint_source_ft_c",
        "bizible_2_touchpoint_source_lc_c",
        "sales_email_opt_out_c",
        "sales_email_opt_out_date_time_c",
        "bombora_app_bombora_surge_record_count_c",
        "bombora_app_bombora_last_date_time_updated_c",
        "bombora_app_bombora_total_composite_score_c",
        "linked_in_url_c",
        "beta_connector_interest_c",
        "user_gems_ug_past_infos_c",
        "user_gems_ug_current_infos_c",
        "user_gems_ug_created_by_ug_c",
        "free_trial_email_confirmed_date_c",
        "dnboptimizer_dn_bcontact_record_c",
        "dnboptimizer_dn_bcompany_record_c",
        "dnboptimizer_dnb_d_u_n_s_number_c",
        "i_sell_oskey_id_c",
        "verified_c",
        "email_opt_out_date_time_c",
        "pbf_startup_c",
        "pbf_startup_certify_eligibility_c",
        "engagio_intent_minutes_last_30_days_c",
        "engagio_engagement_minutes_last_3_months_c",
        "engagio_engagement_minutes_last_7_days_c",
        "engagio_matched_account_c",
        "engagio_first_engagement_date_c",
        "engagio_match_time_c",
        "engagio_department_c",
        "engagio_role_c",
        "legacy_hvr_id_c",
        "hvr_channel_c",
        "email_opt_in_double_c",
        "phone_number_catch_all_c",
        "contacts_domain_exists_c",
        "utm_id_c",
        "source_every_utm_id_c",
        "source_last_utm_id_c",
        "source_first_utm_id_c",
        "do_not_sync_reason_marketo_c",
        "_fivetran_active"
    FROM "sf_lead_data"
),

"sf_lead_data_projected_renamed" AS (
    -- Rename: Renaming columns
    -- secondary_email_c -> secondary_email
    -- system_modstamp -> last_modified_timestamp
    -- up_district_c -> district
    -- mc_4_sf_mc_subscriber_c -> marketing_cloud_subscriber
    -- lead_source_detail_c -> lead_source_details
    -- cbit_clearbit_c -> clearbit_status
    -- title -> job_title
    -- up_territory_c -> territory
    -- gclid_c -> google_click_id
    -- active_in_sequence_c -> active_in_sequence
    -- cbit_clearbit_ready_c -> clearbit_ready
    -- has_opted_out_of_email -> email_opt_out
    -- calendly_created_c -> calendly_creation_date
    -- account_c -> account_id
    -- all_connectors_c -> all_connectors
    -- all_data_warehouses_c -> all_data_warehouses
    -- bi_tools_c -> bi_tools
    -- competitors_c -> competitors
    -- connectors_products_c -> connector_products
    -- contact_c -> contact_info
    -- data_warehouse_products_c -> data_warehouse_products
    -- notes_c -> notes
    -- timeframe_c -> timeframe
    -- account_all_products_c -> account_all_products
    -- account_bi_tools_c -> account_bi_tools
    -- account_data_warehouses_c -> account_data_warehouses
    -- opportunity_competitors_c -> opportunity_competitors
    -- opportunity_products_c -> opportunity_products
    -- referral_account_c -> referral_account
    -- referral_contact_c -> referral_contact
    -- volume_in_millions_c -> volume_in_millions
    -- feature_requests_c -> feature_requests
    -- demo_scheduled_by_calenderly_c -> demo_scheduled_calendly
    -- to_delete_c -> is_to_delete
    -- email_quality_c -> email_quality
    -- email_quality_catchall_c -> email_quality_catchall
    -- old_lead_source_c -> previous_lead_source
    -- old_lead_source_detail_c -> previous_lead_source_detail
    -- act_on_lead_score_c -> act_on_lead_score
    -- cbit_created_by_clearbit_c -> created_by_clearbit
    -- fivetran_user_id_c -> fivetran_user_id
    -- geo_state_acton_c -> lead_state_acton
    -- actoncountry_c -> acton_country
    -- actoncity_c -> acton_city
    -- actoncountrycode_c -> acton_country_code
    -- actonpostalcode_c -> acton_postal_code
    -- actonreferrer_c -> acton_referrer
    -- actonstate_c -> acton_state
    -- geo_city_c -> lead_city
    -- geo_country_code_c -> lead_country_code
    -- geo_postal_code_c -> lead_postal_code
    -- company_type_c -> company_type
    -- pi_comments_c -> lead_comments
    -- pi_conversion_date_c -> conversion_date
    -- pi_conversion_object_name_c -> conversion_object_name
    -- pi_conversion_object_type_c -> conversion_object_type
    -- pi_created_date_c -> lead_creation_date
    -- pi_first_activity_c -> first_activity
    -- pi_first_search_term_c -> first_search_term
    -- pi_first_search_type_c -> first_search_type
    -- pi_first_touch_url_c -> first_touch_url
    -- pi_grade_c -> lead_grade
    -- pi_last_activity_c -> last_activity
    -- pi_needs_score_synced_c -> needs_score_sync
    -- pi_notes_c -> lead_notes
    -- pi_pardot_hard_bounced_c -> pardot_hard_bounced
    -- pi_pardot_last_scored_at_c -> pardot_last_scored_at
    -- pi_url_c -> lead_url
    -- competitor_c -> is_competitor
    -- source_detail_c -> source_detail
    -- fivetran_account_stage_c -> fivetran_account_stage
    -- fivetran_account_id_c -> fivetran_account_id
    -- lean_data_router_status_c -> router_status
    -- lean_data_matched_lead_c -> matched_lead
    -- lean_data_routing_action_c -> routing_action
    -- lean_data_search_index_c -> search_index
    -- lean_data_reporting_matched_account_c -> reporting_matched_account
    -- lean_data_reporting_timestamp_c -> reporting_timestamp
    -- lean_data_ld_segment_c -> lead_segment
    -- lean_data_marketing_sys_created_date_c -> marketing_system_creation_date
    -- lean_data_matched_account_c -> matched_account
    -- lean_data_a_2_b_account_c -> associated_account
    -- lean_data_search_c -> search_criteria
    -- lean_data_routing_status_c -> routing_status
    -- lean_data_a_2_b_group_c -> associated_group
    -- lean_data_matched_buyer_persona_c -> matched_buyer_persona
    -- lean_data_tag_c -> lead_tag
    -- lean_data_status_info_c -> status_info
    -- lean_data_modified_score_c -> modified_lead_score
    -- do_not_route_lead_c -> do_not_route_lead
    -- partner_type_c -> partner_type
    -- allbound_id_c -> allbound_id
    -- lid_linked_in_company_id_c -> linkedin_company_id
    -- lid_linked_in_member_token_c -> linkedin_member_token
    -- lean_data_re_route_c -> rerouting_status
    -- sales_loft_1_most_recent_cadence_next_step_due_date_c -> next_salesloft_step_due_date
    -- sales_loft_1_most_recent_last_completed_step_c -> last_completed_salesloft_step
    -- sales_loft_1_most_recent_cadence_name_c -> latest_salesloft_cadence_name
    -- network_c -> network
    -- matchtype_c -> match_type
    -- device_c -> device_info
    -- creative_c -> creative_assets
    -- adgroupid_c -> ad_group_id
    -- keyword_c -> lead_keyword
    -- partner_rep_email_c -> partner_rep_email
    -- partner_rep_name_c -> partner_rep_name
    -- lead_type_c -> lead_type
    -- contact_stage_c -> contact_stage
    -- original_utm_campaign_c -> original_utm_campaign
    -- original_utm_content_c -> original_utm_content
    -- original_utm_medium_c -> original_utm_medium
    -- original_utm_source_c -> original_utm_source
    -- original_utm_term_c -> original_utm_term
    -- es_app_esalexa_rank_c -> alexa_rank
    -- es_app_esaudience_names_c -> audience_names
    -- es_app_escompany_phone_c -> company_phone
    -- es_app_escreated_timestamp_c -> created_timestamp
    -- es_app_esemployees_c -> employee_count
    -- es_app_esenriched_c -> is_enriched
    -- es_app_esenriched_timestamp_c -> enriched_timestamp
    -- es_app_esfacebook_c -> facebook_url
    -- es_app_esintent_aggregate_score_c -> intent_score
    -- es_app_esintent_timestamp_c -> intent_timestamp
    -- es_app_esintent_topics_c -> intent_topics
    -- es_app_eskeywords_c -> keywords
    -- es_app_esoverall_fit_score_c -> fit_score
    -- es_app_esrevenue_c -> company_revenue
    -- es_app_esstreet_c -> street_address
    -- es_app_estechnologies_c -> technologies
    -- es_app_estwitter_c -> twitter_url
    -- es_app_eszipcode_c -> zipcode
    -- marketing_prospect_routing_rules_c -> prospect_routing_rules
    -- marketing_process_c -> marketing_process_stage
    -- automation_tracking_c -> automation_tracking_status
    -- user_gems_has_changed_job_c -> has_changed_job
    -- user_gems_linked_in_c -> linkedin_profile
    -- email_opt_in_c -> email_opt_in
    -- email_opt_in_explicit_c -> email_explicit_opt_in
    -- email_opt_in_implicit_c -> email_implicit_opt_in
    -- gdpr_opt_in_explicit_c -> gdpr_opt_in_status
    -- user_gems_is_a_user_gem_c -> is_user_gem
    -- user_gems_past_account_c -> past_account
    -- user_gems_past_company_c -> previous_company
    -- user_gems_past_contact_c -> previous_contact_info
    -- user_gems_past_title_c -> previous_job_title
    -- promotion_id_c -> promotion_id
    -- previous_customer_c -> is_previous_customer
    -- referral_contact_email_c -> referral_contact_email
    -- referral_firstname_c -> referral_first_name
    -- referral_last_name_c -> referral_last_name
    -- mkto_71_acquisition_date_c -> acquisition_date
    -- mkto_71_acquisition_program_id_c -> acquisition_program_id
    -- mkto_acquisition_program_c -> acquisition_program
    -- mkto_71_inferred_city_c -> inferred_city
    -- mkto_71_inferred_company_c -> inferred_company
    -- mkto_71_inferred_country_c -> inferred_country
    -- mkto_71_inferred_metropolitan_area_c -> inferred_metro_area
    -- mkto_71_inferred_phone_area_code_c -> inferred_phone_area_code
    -- mkto_71_inferred_postal_code_c -> inferred_postal_code
    -- mkto_71_inferred_state_region_c -> inferred_state_region
    -- mkto_71_original_referrer_c -> original_referrer
    -- mkto_71_original_search_engine_c -> original_search_engine
    -- mkto_71_original_search_phrase_c -> original_search_phrase
    -- mkto_71_original_source_info_c -> original_source_info
    -- mkto_71_original_source_type_c -> original_source_type
    -- mkto_si_hide_date_c -> sales_insight_hide_date
    -- mkto_si_last_interesting_moment_date_c -> last_interesting_moment_date
    -- mkto_si_last_interesting_moment_desc_c -> last_interaction_description
    -- mkto_si_last_interesting_moment_source_c -> last_interaction_source
    -- mkto_si_last_interesting_moment_type_c -> last_interaction_type
    -- mkto_si_msicontact_id_c -> marketing_contact_id
    -- mkto_si_priority_c -> lead_priority_score
    -- mkto_si_relative_score_value_c -> lead_relative_score
    -- mkto_si_urgency_value_c -> lead_urgency_value
    -- cloudingo_agent_ar_c -> cloudingo_agent_ar
    -- cloudingo_agent_ardi_c -> cloudingo_agent_ardi
    -- cloudingo_agent_as_c -> cloudingo_agent_as
    -- cloudingo_agent_atz_c -> cloudingo_agent_atz
    -- cloudingo_agent_av_c -> cloudingo_agent_av
    -- cloudingo_agent_les_c -> cloudingo_agent_les
    -- do_not_sync_marketo_c -> marketo_sync_disabled
    -- source_every_utm_campaign_c -> all_utm_campaigns
    -- source_every_utm_content_c -> all_utm_content
    -- source_every_utm_medium_c -> all_utm_mediums
    -- source_every_utm_source_c -> all_utm_sources
    -- source_every_utm_term_c -> all_utm_terms
    -- source_first_utm_campaign_c -> first_utm_campaign
    -- source_first_utm_content_c -> first_utm_content
    -- source_first_utm_medium_c -> first_utm_medium
    -- source_first_utm_source_c -> first_utm_source
    -- source_first_utm_term_c -> first_utm_term
    -- source_last_utm_campaign_c -> last_utm_campaign
    -- source_last_utm_content_c -> last_utm_content
    -- source_last_utm_medium_c -> last_utm_medium
    -- source_last_utm_source_c -> last_utm_source
    -- source_last_utm_term_c -> last_utm_term
    -- direct_office_c -> direct_office
    -- city_c -> alt_city
    -- country_c -> country_additional
    -- state_c -> state_custom
    -- source_first_lead_source_category_c -> first_lead_source_category
    -- source_last_lead_source_c -> last_lead_source
    -- source_last_lead_source_category_c -> last_lead_source_category
    -- source_last_lead_source_detail_c -> last_lead_source_detail
    -- source_every_lead_source_c -> all_lead_sources
    -- source_every_lead_source_category_c -> all_lead_source_categories
    -- source_every_lead_source_detail_c -> all_lead_source_details
    -- source_first_lead_source_c -> first_lead_source
    -- source_first_lead_source_detail_c -> first_lead_source_detail
    -- behavioral_score_c -> behavioral_score
    -- demographic_score_c -> demographic_score
    -- drift_cql_c -> drift_cql_status
    -- unique_email_c -> unique_email
    -- is_emea_event_routing_c -> is_emea_event_routing
    -- csi_code_c -> csi_code
    -- csi_description_c -> csi_description
    -- converted_date_time_c -> converted_datetime
    -- lead_created_date_time_reporting_c -> lead_creation_datetime
    -- lead_iq_employee_count_c -> company_employee_count
    -- lead_iq_employee_range_c -> company_employee_range
    -- lead_iq_zip_code_c -> lead_zip_code
    -- zoominfo_country_c -> zoominfo_country
    -- zoominfo_employee_count_c -> zoominfo_employee_count
    -- zoominfo_state_c -> zoominfo_state
    -- zoominfo_technologies_c -> zoominfo_technologies
    -- zoominfo_zip_code_c -> zoominfo_zip_code
    -- attended_event_c -> attended_event
    -- mql_date_c -> mql_date
    -- user_gems_user_gems_id_c -> user_gems_id
    -- dozisf_zoom_info_company_id_c -> zoominfo_company_id
    -- dozisf_zoom_info_first_updated_c -> zoominfo_first_updated
    -- dozisf_zoom_info_id_c -> zoominfo_contact_id
    -- dozisf_zoom_info_last_updated_c -> zoominfo_last_updated
    -- lean_data_manual_route_trigger_c -> manual_routing_trigger
    -- first_mql_date_c -> first_mql_date
    -- fivetran_account_association_date_c -> fivetran_association_date
    -- fivetran_account_user_role_s_c -> fivetran_user_roles
    -- mql_reason_c -> mql_reason
    -- trial_contact_start_date_c -> trial_start_date
    -- enrichment_request_c -> enrichment_requested
    -- meta_data_create_date_c -> metadata_creation_date
    -- clarus_date_c -> clarus_date
    -- clarus_editor_c -> clarus_editor
    -- clarus_notes_c -> clarus_notes
    -- clarus_project_c -> clarus_project
    -- clarus_status_c -> clarus_status
    -- marketing_connector_interest_c -> marketing_connector_interest
    -- recent_marketing_campaign_status_c -> recent_campaign_status
    -- salesloft_cadence_trigger_c -> salesloft_cadence_trigger
    -- datawarehouse_used_c -> datawarehouse_used
    -- contact_status_c -> contact_status
    -- leandata_contact_owner_override_c -> contact_owner_override
    -- potential_fivetran_use_case_c -> fivetran_use_case
    -- bizible_2_account_c -> bizible_2_account
    -- bizible_2_ad_campaign_name_ft_c -> bizible_2_ad_campaign_name_first_touch
    -- bizible_2_ad_campaign_name_lc_c -> bizible_2_ad_campaign_name_last_touch
    -- bizible_2_bizible_id_c -> bizible_2_id
    -- bizible_2_landing_page_ft_c -> bizible_2_landing_page_first_touch
    -- bizible_2_landing_page_lc_c -> bizible_2_landing_page_last_touch
    -- bizible_2_marketing_channel_ft_c -> bizible_2_marketing_channel_first_touch
    -- bizible_2_marketing_channel_lc_c -> last_marketing_channel
    -- bizible_2_touchpoint_date_ft_c -> first_touchpoint_date
    -- bizible_2_touchpoint_date_lc_c -> last_touchpoint_date
    -- bizible_2_touchpoint_source_ft_c -> first_touchpoint_source
    -- bizible_2_touchpoint_source_lc_c -> last_touchpoint_source
    -- sales_email_opt_out_c -> sales_email_opt_out
    -- sales_email_opt_out_date_time_c -> sales_email_opt_out_datetime
    -- bombora_app_bombora_surge_record_count_c -> bombora_surge_record_count
    -- bombora_app_bombora_last_date_time_updated_c -> bombora_last_update_date
    -- bombora_app_bombora_total_composite_score_c -> bombora_total_composite_score
    -- beta_connector_interest_c -> beta_connector_interest
    -- user_gems_ug_past_infos_c -> past_user_gems_info
    -- user_gems_ug_current_infos_c -> current_user_gems_info
    -- user_gems_ug_created_by_ug_c -> created_by_user_gems
    -- free_trial_email_confirmed_date_c -> free_trial_confirmation_date
    -- dnboptimizer_dn_bcontact_record_c -> dnb_contact_record
    -- dnboptimizer_dn_bcompany_record_c -> dnb_company_record
    -- dnboptimizer_dnb_d_u_n_s_number_c -> duns_number
    -- i_sell_oskey_id_c -> isell_os_key_id
    -- verified_c -> is_verified
    -- email_opt_out_date_time_c -> email_opt_out_datetime
    -- pbf_startup_c -> is_startup
    -- pbf_startup_certify_eligibility_c -> startup_eligibility_certified
    -- engagio_intent_minutes_last_30_days_c -> engagio_intent_minutes_30d
    -- engagio_engagement_minutes_last_3_months_c -> engagio_engagement_minutes_3m
    -- engagio_engagement_minutes_last_7_days_c -> engagio_engagement_minutes_7d
    -- engagio_matched_account_c -> engagio_matched_account
    -- engagio_first_engagement_date_c -> engagio_first_engagement_date
    -- engagio_match_time_c -> engagio_match_time
    -- engagio_department_c -> engagio_department
    -- engagio_role_c -> engagio_role
    -- legacy_hvr_id_c -> legacy_id
    -- hvr_channel_c -> hvr_channel
    -- email_opt_in_double_c -> email_double_opt_in
    -- phone_number_catch_all_c -> phone_number_misc
    -- contacts_domain_exists_c -> domain_exists
    -- utm_id_c -> utm_id
    -- source_every_utm_id_c -> all_utm_ids
    -- source_last_utm_id_c -> last_utm_id
    -- source_first_utm_id_c -> first_utm_id
    -- do_not_sync_reason_marketo_c -> marketo_sync_disabled_reason
    -- _fivetran_active -> fivetran_sync_status
    SELECT 
        "country",
        "email_bounced_reason",
        "email_bounced_date",
        "owner_id",
        "secondary_email_c" AS "secondary_email",
        "lead_source",
        "converted_date",
        "last_modified_date",
        "master_record_id",
        "last_modified_by_id",
        "system_modstamp" AS "last_modified_timestamp",
        "geocode_accuracy",
        "converted_contact_id",
        "up_region_c",
        "id",
        "photo_url",
        "state",
        "longitude",
        "last_referenced_date",
        "up_district_c" AS "district",
        "last_activity_date",
        "country_code",
        "phone",
        "mc_4_sf_mc_subscriber_c" AS "marketing_cloud_subscriber",
        "name",
        "jigsaw_contact_id",
        "lead_source_detail_c" AS "lead_source_details",
        "created_by_id",
        "salutation",
        "is_converted",
        "state_code",
        "is_unread_by_owner",
        "status",
        "city",
        "latitude",
        "cbit_clearbit_c" AS "clearbit_status",
        "industry",
        "title" AS "job_title",
        "last_viewed_date",
        "converted_opportunity_id",
        "is_deleted",
        "street",
        "company",
        "first_name",
        "email",
        "website",
        "last_name",
        "number_of_employees",
        "up_territory_c" AS "territory",
        "created_date",
        "gclid_c" AS "google_click_id",
        "active_in_sequence_c" AS "active_in_sequence",
        "postal_code",
        "cbit_clearbit_ready_c" AS "clearbit_ready",
        "has_opted_out_of_email" AS "email_opt_out",
        "converted_account_id",
        "mobile_phone",
        "calendly_created_c" AS "calendly_creation_date",
        "account_c" AS "account_id",
        "all_connectors_c" AS "all_connectors",
        "all_data_warehouses_c" AS "all_data_warehouses",
        "bi_tools_c" AS "bi_tools",
        "competitors_c" AS "competitors",
        "annual_revenue",
        "connectors_products_c" AS "connector_products",
        "contact_c" AS "contact_info",
        "data_warehouse_products_c" AS "data_warehouse_products",
        "notes_c" AS "notes",
        "timeframe_c" AS "timeframe",
        "account_all_products_c" AS "account_all_products",
        "account_bi_tools_c" AS "account_bi_tools",
        "account_data_warehouses_c" AS "account_data_warehouses",
        "opportunity_competitors_c" AS "opportunity_competitors",
        "opportunity_products_c" AS "opportunity_products",
        "description",
        "referral_account_c" AS "referral_account",
        "referral_contact_c" AS "referral_contact",
        "volume_in_millions_c" AS "volume_in_millions",
        "feature_requests_c" AS "feature_requests",
        "lead_number_c",
        "demo_scheduled_by_calenderly_c" AS "demo_scheduled_calendly",
        "to_delete_c" AS "is_to_delete",
        "bounced_email_c",
        "email_quality_c" AS "email_quality",
        "email_quality_catchall_c" AS "email_quality_catchall",
        "old_lead_source_c" AS "previous_lead_source",
        "email_bounced_c",
        "old_lead_source_detail_c" AS "previous_lead_source_detail",
        "utm_medium_c",
        "utm_source_c",
        "utm_campaign_c",
        "utm_content_c",
        "utm_term_c",
        "act_on_lead_score_c" AS "act_on_lead_score",
        "cbit_created_by_clearbit_c" AS "created_by_clearbit",
        "fivetran_user_id_c" AS "fivetran_user_id",
        "geo_state_acton_c" AS "lead_state_acton",
        "actoncountry_c" AS "acton_country",
        "actoncity_c" AS "acton_city",
        "actoncountrycode_c" AS "acton_country_code",
        "actonpostalcode_c" AS "acton_postal_code",
        "actonreferrer_c" AS "acton_referrer",
        "actonstate_c" AS "acton_state",
        "geo_city_c" AS "lead_city",
        "geo_country_c",
        "geo_country_code_c" AS "lead_country_code",
        "geo_postal_code_c" AS "lead_postal_code",
        "geo_state_c",
        "company_type_c" AS "company_type",
        "pi_campaign_c",
        "pi_comments_c" AS "lead_comments",
        "pi_conversion_date_c" AS "conversion_date",
        "pi_conversion_object_name_c" AS "conversion_object_name",
        "pi_conversion_object_type_c" AS "conversion_object_type",
        "pi_created_date_c" AS "lead_creation_date",
        "pi_first_activity_c" AS "first_activity",
        "pi_first_search_term_c" AS "first_search_term",
        "pi_first_search_type_c" AS "first_search_type",
        "pi_first_touch_url_c" AS "first_touch_url",
        "pi_grade_c" AS "lead_grade",
        "pi_last_activity_c" AS "last_activity",
        "pi_needs_score_synced_c" AS "needs_score_sync",
        "pi_notes_c" AS "lead_notes",
        "pi_pardot_hard_bounced_c" AS "pardot_hard_bounced",
        "pi_pardot_last_scored_at_c" AS "pardot_last_scored_at",
        "pi_score_c",
        "pi_url_c" AS "lead_url",
        "pi_utm_campaign_c",
        "pi_utm_content_c",
        "pi_utm_medium_c",
        "pi_utm_source_c",
        "pi_utm_term_c",
        "fax",
        "region_c",
        "competitor_c" AS "is_competitor",
        "source_detail_c" AS "source_detail",
        "fivetran_account_stage_c" AS "fivetran_account_stage",
        "fivetran_account_id_c" AS "fivetran_account_id",
        "lean_data_router_status_c" AS "router_status",
        "lean_data_matched_lead_c" AS "matched_lead",
        "lean_data_routing_action_c" AS "routing_action",
        "lean_data_search_index_c" AS "search_index",
        "lean_data_reporting_matched_account_c" AS "reporting_matched_account",
        "lean_data_reporting_timestamp_c" AS "reporting_timestamp",
        "lean_data_ld_segment_c" AS "lead_segment",
        "lean_data_marketing_sys_created_date_c" AS "marketing_system_creation_date",
        "lean_data_matched_account_c" AS "matched_account",
        "lean_data_a_2_b_account_c" AS "associated_account",
        "lean_data_search_c" AS "search_criteria",
        "lean_data_routing_status_c" AS "routing_status",
        "lean_data_a_2_b_group_c" AS "associated_group",
        "lean_data_matched_buyer_persona_c" AS "matched_buyer_persona",
        "lean_data_tag_c" AS "lead_tag",
        "lean_data_status_info_c" AS "status_info",
        "lean_data_modified_score_c" AS "modified_lead_score",
        "do_not_route_lead_c" AS "do_not_route_lead",
        "partner_type_c" AS "partner_type",
        "allbound_id_c" AS "allbound_id",
        "lid_linked_in_company_id_c" AS "linkedin_company_id",
        "lid_linked_in_member_token_c" AS "linkedin_member_token",
        "lean_data_re_route_c" AS "rerouting_status",
        "sales_loft_1_most_recent_cadence_next_step_due_date_c" AS "next_salesloft_step_due_date",
        "sales_loft_1_most_recent_last_completed_step_c" AS "last_completed_salesloft_step",
        "sales_loft_1_most_recent_cadence_name_c" AS "latest_salesloft_cadence_name",
        "network_c" AS "network",
        "matchtype_c" AS "match_type",
        "device_c" AS "device_info",
        "creative_c" AS "creative_assets",
        "adgroupid_c" AS "ad_group_id",
        "keyword_c" AS "lead_keyword",
        "campaignid_c",
        "partner_rep_email_c" AS "partner_rep_email",
        "partner_rep_name_c" AS "partner_rep_name",
        "lead_type_c" AS "lead_type",
        "contact_stage_c" AS "contact_stage",
        "original_utm_campaign_c" AS "original_utm_campaign",
        "original_utm_content_c" AS "original_utm_content",
        "original_utm_medium_c" AS "original_utm_medium",
        "original_utm_source_c" AS "original_utm_source",
        "original_utm_term_c" AS "original_utm_term",
        "es_app_esalexa_rank_c" AS "alexa_rank",
        "es_app_esaudience_names_c" AS "audience_names",
        "es_app_escity_c",
        "es_app_escompany_phone_c" AS "company_phone",
        "es_app_escountry_c",
        "es_app_escreated_timestamp_c" AS "created_timestamp",
        "es_app_esecid_c",
        "es_app_esemployees_c" AS "employee_count",
        "es_app_esenriched_c" AS "is_enriched",
        "es_app_esenriched_timestamp_c" AS "enriched_timestamp",
        "es_app_esfacebook_c" AS "facebook_url",
        "es_app_esindustry_c",
        "es_app_esintent_aggregate_score_c" AS "intent_score",
        "es_app_esintent_timestamp_c" AS "intent_timestamp",
        "es_app_esintent_topics_c" AS "intent_topics",
        "es_app_eskeywords_c" AS "keywords",
        "es_app_eslinked_in_c",
        "es_app_esoverall_fit_score_c" AS "fit_score",
        "es_app_esrevenue_c" AS "company_revenue",
        "es_app_essource_c",
        "es_app_esstate_c",
        "es_app_esstreet_c" AS "street_address",
        "es_app_estechnologies_c" AS "technologies",
        "es_app_estwitter_c" AS "twitter_url",
        "es_app_eszipcode_c" AS "zipcode",
        "marketing_prospect_routing_rules_c" AS "prospect_routing_rules",
        "individual_id",
        "marketing_process_c" AS "marketing_process_stage",
        "automation_tracking_c" AS "automation_tracking_status",
        "user_gems_has_changed_job_c" AS "has_changed_job",
        "user_gems_linked_in_c" AS "linkedin_profile",
        "email_opt_in_c" AS "email_opt_in",
        "email_opt_in_explicit_c" AS "email_explicit_opt_in",
        "email_opt_in_implicit_c" AS "email_implicit_opt_in",
        "gdpr_opt_in_explicit_c" AS "gdpr_opt_in_status",
        "user_gems_is_a_user_gem_c" AS "is_user_gem",
        "user_gems_past_account_c" AS "past_account",
        "user_gems_past_company_c" AS "previous_company",
        "user_gems_past_contact_c" AS "previous_contact_info",
        "user_gems_past_title_c" AS "previous_job_title",
        "promotion_id_c" AS "promotion_id",
        "previous_customer_c" AS "is_previous_customer",
        "referral_contact_email_c" AS "referral_contact_email",
        "referral_firstname_c" AS "referral_first_name",
        "referral_last_name_c" AS "referral_last_name",
        "mkto_71_lead_score_c",
        "mkto_71_acquisition_date_c" AS "acquisition_date",
        "mkto_71_acquisition_program_id_c" AS "acquisition_program_id",
        "mkto_acquisition_program_c" AS "acquisition_program",
        "mkto_71_inferred_city_c" AS "inferred_city",
        "mkto_71_inferred_company_c" AS "inferred_company",
        "mkto_71_inferred_country_c" AS "inferred_country",
        "mkto_71_inferred_metropolitan_area_c" AS "inferred_metro_area",
        "mkto_71_inferred_phone_area_code_c" AS "inferred_phone_area_code",
        "mkto_71_inferred_postal_code_c" AS "inferred_postal_code",
        "mkto_71_inferred_state_region_c" AS "inferred_state_region",
        "mkto_71_original_referrer_c" AS "original_referrer",
        "mkto_71_original_search_engine_c" AS "original_search_engine",
        "mkto_71_original_search_phrase_c" AS "original_search_phrase",
        "mkto_71_original_source_info_c" AS "original_source_info",
        "mkto_71_original_source_type_c" AS "original_source_type",
        "mkto_si_hide_date_c" AS "sales_insight_hide_date",
        "mkto_si_last_interesting_moment_date_c" AS "last_interesting_moment_date",
        "mkto_si_last_interesting_moment_desc_c" AS "last_interaction_description",
        "mkto_si_last_interesting_moment_source_c" AS "last_interaction_source",
        "mkto_si_last_interesting_moment_type_c" AS "last_interaction_type",
        "mkto_si_msicontact_id_c" AS "marketing_contact_id",
        "mkto_si_priority_c" AS "lead_priority_score",
        "mkto_si_relative_score_value_c" AS "lead_relative_score",
        "mkto_si_urgency_value_c" AS "lead_urgency_value",
        "cloudingo_agent_ar_c" AS "cloudingo_agent_ar",
        "cloudingo_agent_ardi_c" AS "cloudingo_agent_ardi",
        "cloudingo_agent_as_c" AS "cloudingo_agent_as",
        "cloudingo_agent_atz_c" AS "cloudingo_agent_atz",
        "cloudingo_agent_av_c" AS "cloudingo_agent_av",
        "cloudingo_agent_les_c" AS "cloudingo_agent_les",
        "do_not_sync_marketo_c" AS "marketo_sync_disabled",
        "source_every_utm_campaign_c" AS "all_utm_campaigns",
        "source_every_utm_content_c" AS "all_utm_content",
        "source_every_utm_medium_c" AS "all_utm_mediums",
        "source_every_utm_source_c" AS "all_utm_sources",
        "source_every_utm_term_c" AS "all_utm_terms",
        "source_first_utm_campaign_c" AS "first_utm_campaign",
        "source_first_utm_content_c" AS "first_utm_content",
        "source_first_utm_medium_c" AS "first_utm_medium",
        "source_first_utm_source_c" AS "first_utm_source",
        "source_first_utm_term_c" AS "first_utm_term",
        "source_last_utm_campaign_c" AS "last_utm_campaign",
        "source_last_utm_content_c" AS "last_utm_content",
        "source_last_utm_medium_c" AS "last_utm_medium",
        "source_last_utm_source_c" AS "last_utm_source",
        "source_last_utm_term_c" AS "last_utm_term",
        "direct_office_c" AS "direct_office",
        "city_c" AS "alt_city",
        "country_c" AS "country_additional",
        "state_c" AS "state_custom",
        "source_first_lead_source_category_c" AS "first_lead_source_category",
        "source_last_lead_source_c" AS "last_lead_source",
        "source_last_lead_source_category_c" AS "last_lead_source_category",
        "source_last_lead_source_detail_c" AS "last_lead_source_detail",
        "source_every_lead_source_c" AS "all_lead_sources",
        "source_every_lead_source_category_c" AS "all_lead_source_categories",
        "source_every_lead_source_detail_c" AS "all_lead_source_details",
        "source_first_lead_source_c" AS "first_lead_source",
        "source_first_lead_source_detail_c" AS "first_lead_source_detail",
        "behavioral_score_c" AS "behavioral_score",
        "demographic_score_c" AS "demographic_score",
        "drift_cql_c" AS "drift_cql_status",
        "unique_email_c" AS "unique_email",
        "is_emea_event_routing_c" AS "is_emea_event_routing",
        "csi_code_c" AS "csi_code",
        "csi_description_c" AS "csi_description",
        "converted_date_time_c" AS "converted_datetime",
        "lead_created_date_time_reporting_c" AS "lead_creation_datetime",
        "lead_iq_country_c",
        "lead_iq_employee_count_c" AS "company_employee_count",
        "lead_iq_employee_range_c" AS "company_employee_range",
        "lead_iq_state_c",
        "lead_iq_zip_code_c" AS "lead_zip_code",
        "zoominfo_country_c" AS "zoominfo_country",
        "zoominfo_employee_count_c" AS "zoominfo_employee_count",
        "zoominfo_state_c" AS "zoominfo_state",
        "zoominfo_technologies_c" AS "zoominfo_technologies",
        "zoominfo_zip_code_c" AS "zoominfo_zip_code",
        "attended_event_c" AS "attended_event",
        "mql_date_c" AS "mql_date",
        "user_gems_user_gems_id_c" AS "user_gems_id",
        "dozisf_zoom_info_company_id_c" AS "zoominfo_company_id",
        "dozisf_zoom_info_first_updated_c" AS "zoominfo_first_updated",
        "dozisf_zoom_info_id_c" AS "zoominfo_contact_id",
        "dozisf_zoom_info_last_updated_c" AS "zoominfo_last_updated",
        "lean_data_manual_route_trigger_c" AS "manual_routing_trigger",
        "first_mql_date_c" AS "first_mql_date",
        "fivetran_account_association_date_c" AS "fivetran_association_date",
        "fivetran_account_user_role_s_c" AS "fivetran_user_roles",
        "mql_reason_c" AS "mql_reason",
        "trial_contact_start_date_c" AS "trial_start_date",
        "enrichment_request_c" AS "enrichment_requested",
        "meta_data_create_date_c" AS "metadata_creation_date",
        "clarus_date_c" AS "clarus_date",
        "clarus_editor_c" AS "clarus_editor",
        "clarus_notes_c" AS "clarus_notes",
        "clarus_project_c" AS "clarus_project",
        "clarus_status_c" AS "clarus_status",
        "marketing_connector_interest_c" AS "marketing_connector_interest",
        "recent_marketing_campaign_status_c" AS "recent_campaign_status",
        "salesloft_cadence_trigger_c" AS "salesloft_cadence_trigger",
        "datawarehouse_used_c" AS "datawarehouse_used",
        "contact_status_c" AS "contact_status",
        "leandata_contact_owner_override_c" AS "contact_owner_override",
        "potential_fivetran_use_case_c" AS "fivetran_use_case",
        "bizible_2_account_c" AS "bizible_2_account",
        "bizible_2_ad_campaign_name_ft_c" AS "bizible_2_ad_campaign_name_first_touch",
        "bizible_2_ad_campaign_name_lc_c" AS "bizible_2_ad_campaign_name_last_touch",
        "bizible_2_bizible_id_c" AS "bizible_2_id",
        "bizible_2_landing_page_ft_c" AS "bizible_2_landing_page_first_touch",
        "bizible_2_landing_page_lc_c" AS "bizible_2_landing_page_last_touch",
        "bizible_2_marketing_channel_ft_c" AS "bizible_2_marketing_channel_first_touch",
        "bizible_2_marketing_channel_lc_c" AS "last_marketing_channel",
        "bizible_2_touchpoint_date_ft_c" AS "first_touchpoint_date",
        "bizible_2_touchpoint_date_lc_c" AS "last_touchpoint_date",
        "bizible_2_touchpoint_source_ft_c" AS "first_touchpoint_source",
        "bizible_2_touchpoint_source_lc_c" AS "last_touchpoint_source",
        "sales_email_opt_out_c" AS "sales_email_opt_out",
        "sales_email_opt_out_date_time_c" AS "sales_email_opt_out_datetime",
        "bombora_app_bombora_surge_record_count_c" AS "bombora_surge_record_count",
        "bombora_app_bombora_last_date_time_updated_c" AS "bombora_last_update_date",
        "bombora_app_bombora_total_composite_score_c" AS "bombora_total_composite_score",
        "linked_in_url_c",
        "beta_connector_interest_c" AS "beta_connector_interest",
        "user_gems_ug_past_infos_c" AS "past_user_gems_info",
        "user_gems_ug_current_infos_c" AS "current_user_gems_info",
        "user_gems_ug_created_by_ug_c" AS "created_by_user_gems",
        "free_trial_email_confirmed_date_c" AS "free_trial_confirmation_date",
        "dnboptimizer_dn_bcontact_record_c" AS "dnb_contact_record",
        "dnboptimizer_dn_bcompany_record_c" AS "dnb_company_record",
        "dnboptimizer_dnb_d_u_n_s_number_c" AS "duns_number",
        "i_sell_oskey_id_c" AS "isell_os_key_id",
        "verified_c" AS "is_verified",
        "email_opt_out_date_time_c" AS "email_opt_out_datetime",
        "pbf_startup_c" AS "is_startup",
        "pbf_startup_certify_eligibility_c" AS "startup_eligibility_certified",
        "engagio_intent_minutes_last_30_days_c" AS "engagio_intent_minutes_30d",
        "engagio_engagement_minutes_last_3_months_c" AS "engagio_engagement_minutes_3m",
        "engagio_engagement_minutes_last_7_days_c" AS "engagio_engagement_minutes_7d",
        "engagio_matched_account_c" AS "engagio_matched_account",
        "engagio_first_engagement_date_c" AS "engagio_first_engagement_date",
        "engagio_match_time_c" AS "engagio_match_time",
        "engagio_department_c" AS "engagio_department",
        "engagio_role_c" AS "engagio_role",
        "legacy_hvr_id_c" AS "legacy_id",
        "hvr_channel_c" AS "hvr_channel",
        "email_opt_in_double_c" AS "email_double_opt_in",
        "phone_number_catch_all_c" AS "phone_number_misc",
        "contacts_domain_exists_c" AS "domain_exists",
        "utm_id_c" AS "utm_id",
        "source_every_utm_id_c" AS "all_utm_ids",
        "source_last_utm_id_c" AS "last_utm_id",
        "source_first_utm_id_c" AS "first_utm_id",
        "do_not_sync_reason_marketo_c" AS "marketo_sync_disabled_reason",
        "_fivetran_active" AS "fivetran_sync_status"
    FROM "sf_lead_data_projected"
),

"sf_lead_data_projected_renamed_cleaned" AS (
    -- Clean unusual string values: 
    -- name: The problem is that the name column contains a single letter 'h' as a value, which is highly unusual for a name. This is likely an incomplete entry, a placeholder, or an error. Without more context or additional data, it's impossible to determine what the correct full name should be. In such cases, it's often best to leave the field blank or mark it as unknown. 
    -- first_name: The problem is that 'H' is likely an abbreviation or initial rather than a full first name. Without more context or additional data, it's impossible to determine what the full name might be. In cases like this, it's generally best to leave the initial as is, rather than making assumptions about what it might stand for. 
    -- search_index: The problem is that the search_index column contains a single unusual value: 'geomecyvdvhj amazon'. This value appears to be a combination of a random string of letters ('geomecyvdvhj') followed by 'amazon'. It's unclear what this value is supposed to represent or if it's a data entry error. Without more context about the data or other correct values in this column, it's difficult to determine the intended correct value. In this case, since we can't confidently map it to a correct value, we'll map it to an empty string to remove the potentially erroneous data. 
    -- last_utm_source: The problem is that 'metadata' is not a typical UTM source value. UTM sources usually contain specific campaign names, marketing channels, or referral sources (e.g., 'google', 'facebook', 'email_campaign', etc.). 'metadata' is a generic term that doesn't provide meaningful information about the traffic source. The correct values should be more specific identifiers of where the traffic is coming from. 
    SELECT
        "country",
        "email_bounced_reason",
        "email_bounced_date",
        "owner_id",
        "secondary_email",
        "lead_source",
        "converted_date",
        "last_modified_date",
        "master_record_id",
        "last_modified_by_id",
        "last_modified_timestamp",
        "geocode_accuracy",
        "converted_contact_id",
        "up_region_c",
        "id",
        "photo_url",
        "state",
        "longitude",
        "last_referenced_date",
        "district",
        "last_activity_date",
        "country_code",
        "phone",
        "marketing_cloud_subscriber",
        CASE
            WHEN "name" = 'h' THEN ''
            ELSE "name"
        END AS "name",
        "jigsaw_contact_id",
        "lead_source_details",
        "created_by_id",
        "salutation",
        "is_converted",
        "state_code",
        "is_unread_by_owner",
        "status",
        "city",
        "latitude",
        "clearbit_status",
        "industry",
        "job_title",
        "last_viewed_date",
        "converted_opportunity_id",
        "is_deleted",
        "street",
        "company",
        "first_name",
        "email",
        "website",
        "last_name",
        "number_of_employees",
        "territory",
        "created_date",
        "google_click_id",
        "active_in_sequence",
        "postal_code",
        "clearbit_ready",
        "email_opt_out",
        "converted_account_id",
        "mobile_phone",
        "calendly_creation_date",
        "account_id",
        "all_connectors",
        "all_data_warehouses",
        "bi_tools",
        "competitors",
        "annual_revenue",
        "connector_products",
        "contact_info",
        "data_warehouse_products",
        "notes",
        "timeframe",
        "account_all_products",
        "account_bi_tools",
        "account_data_warehouses",
        "opportunity_competitors",
        "opportunity_products",
        "description",
        "referral_account",
        "referral_contact",
        "volume_in_millions",
        "feature_requests",
        "lead_number_c",
        "demo_scheduled_calendly",
        "is_to_delete",
        "bounced_email_c",
        "email_quality",
        "email_quality_catchall",
        "previous_lead_source",
        "email_bounced_c",
        "previous_lead_source_detail",
        "utm_medium_c",
        "utm_source_c",
        "utm_campaign_c",
        "utm_content_c",
        "utm_term_c",
        "act_on_lead_score",
        "created_by_clearbit",
        "fivetran_user_id",
        "lead_state_acton",
        "acton_country",
        "acton_city",
        "acton_country_code",
        "acton_postal_code",
        "acton_referrer",
        "acton_state",
        "lead_city",
        "geo_country_c",
        "lead_country_code",
        "lead_postal_code",
        "geo_state_c",
        "company_type",
        "pi_campaign_c",
        "lead_comments",
        "conversion_date",
        "conversion_object_name",
        "conversion_object_type",
        "lead_creation_date",
        "first_activity",
        "first_search_term",
        "first_search_type",
        "first_touch_url",
        "lead_grade",
        "last_activity",
        "needs_score_sync",
        "lead_notes",
        "pardot_hard_bounced",
        "pardot_last_scored_at",
        "pi_score_c",
        "lead_url",
        "pi_utm_campaign_c",
        "pi_utm_content_c",
        "pi_utm_medium_c",
        "pi_utm_source_c",
        "pi_utm_term_c",
        "fax",
        "region_c",
        "is_competitor",
        "source_detail",
        "fivetran_account_stage",
        "fivetran_account_id",
        "router_status",
        "matched_lead",
        "routing_action",
        CASE
            WHEN "search_index" = 'geomecyvdvhj amazon' THEN ''
            ELSE "search_index"
        END AS "search_index",
        "reporting_matched_account",
        "reporting_timestamp",
        "lead_segment",
        "marketing_system_creation_date",
        "matched_account",
        "associated_account",
        "search_criteria",
        "routing_status",
        "associated_group",
        "matched_buyer_persona",
        "lead_tag",
        "status_info",
        "modified_lead_score",
        "do_not_route_lead",
        "partner_type",
        "allbound_id",
        "linkedin_company_id",
        "linkedin_member_token",
        "rerouting_status",
        "next_salesloft_step_due_date",
        "last_completed_salesloft_step",
        "latest_salesloft_cadence_name",
        "network",
        "match_type",
        "device_info",
        "creative_assets",
        "ad_group_id",
        "lead_keyword",
        "campaignid_c",
        "partner_rep_email",
        "partner_rep_name",
        "lead_type",
        "contact_stage",
        "original_utm_campaign",
        "original_utm_content",
        "original_utm_medium",
        "original_utm_source",
        "original_utm_term",
        "alexa_rank",
        "audience_names",
        "es_app_escity_c",
        "company_phone",
        "es_app_escountry_c",
        "created_timestamp",
        "es_app_esecid_c",
        "employee_count",
        "is_enriched",
        "enriched_timestamp",
        "facebook_url",
        "es_app_esindustry_c",
        "intent_score",
        "intent_timestamp",
        "intent_topics",
        "keywords",
        "es_app_eslinked_in_c",
        "fit_score",
        "company_revenue",
        "es_app_essource_c",
        "es_app_esstate_c",
        "street_address",
        "technologies",
        "twitter_url",
        "zipcode",
        "prospect_routing_rules",
        "individual_id",
        "marketing_process_stage",
        "automation_tracking_status",
        "has_changed_job",
        "linkedin_profile",
        "email_opt_in",
        "email_explicit_opt_in",
        "email_implicit_opt_in",
        "gdpr_opt_in_status",
        "is_user_gem",
        "past_account",
        "previous_company",
        "previous_contact_info",
        "previous_job_title",
        "promotion_id",
        "is_previous_customer",
        "referral_contact_email",
        "referral_first_name",
        "referral_last_name",
        "mkto_71_lead_score_c",
        "acquisition_date",
        "acquisition_program_id",
        "acquisition_program",
        "inferred_city",
        "inferred_company",
        "inferred_country",
        "inferred_metro_area",
        "inferred_phone_area_code",
        "inferred_postal_code",
        "inferred_state_region",
        "original_referrer",
        "original_search_engine",
        "original_search_phrase",
        "original_source_info",
        "original_source_type",
        "sales_insight_hide_date",
        "last_interesting_moment_date",
        "last_interaction_description",
        "last_interaction_source",
        "last_interaction_type",
        "marketing_contact_id",
        "lead_priority_score",
        "lead_relative_score",
        "lead_urgency_value",
        "cloudingo_agent_ar",
        "cloudingo_agent_ardi",
        "cloudingo_agent_as",
        "cloudingo_agent_atz",
        "cloudingo_agent_av",
        "cloudingo_agent_les",
        "marketo_sync_disabled",
        "all_utm_campaigns",
        "all_utm_content",
        "all_utm_mediums",
        "all_utm_sources",
        "all_utm_terms",
        "first_utm_campaign",
        "first_utm_content",
        "first_utm_medium",
        "first_utm_source",
        "first_utm_term",
        "last_utm_campaign",
        "last_utm_content",
        "last_utm_medium",
        CASE
            WHEN "last_utm_source" = 'metadata' THEN ''
            ELSE "last_utm_source"
        END AS "last_utm_source",
        "last_utm_term",
        "direct_office",
        "alt_city",
        "country_additional",
        "state_custom",
        "first_lead_source_category",
        "last_lead_source",
        "last_lead_source_category",
        "last_lead_source_detail",
        "all_lead_sources",
        "all_lead_source_categories",
        "all_lead_source_details",
        "first_lead_source",
        "first_lead_source_detail",
        "behavioral_score",
        "demographic_score",
        "drift_cql_status",
        "unique_email",
        "is_emea_event_routing",
        "csi_code",
        "csi_description",
        "converted_datetime",
        "lead_creation_datetime",
        "lead_iq_country_c",
        "company_employee_count",
        "company_employee_range",
        "lead_iq_state_c",
        "lead_zip_code",
        "zoominfo_country",
        "zoominfo_employee_count",
        "zoominfo_state",
        "zoominfo_technologies",
        "zoominfo_zip_code",
        "attended_event",
        "mql_date",
        "user_gems_id",
        "zoominfo_company_id",
        "zoominfo_first_updated",
        "zoominfo_contact_id",
        "zoominfo_last_updated",
        "manual_routing_trigger",
        "first_mql_date",
        "fivetran_association_date",
        "fivetran_user_roles",
        "mql_reason",
        "trial_start_date",
        "enrichment_requested",
        "metadata_creation_date",
        "clarus_date",
        "clarus_editor",
        "clarus_notes",
        "clarus_project",
        "clarus_status",
        "marketing_connector_interest",
        "recent_campaign_status",
        "salesloft_cadence_trigger",
        "datawarehouse_used",
        "contact_status",
        "contact_owner_override",
        "fivetran_use_case",
        "bizible_2_account",
        "bizible_2_ad_campaign_name_first_touch",
        "bizible_2_ad_campaign_name_last_touch",
        "bizible_2_id",
        "bizible_2_landing_page_first_touch",
        "bizible_2_landing_page_last_touch",
        "bizible_2_marketing_channel_first_touch",
        "last_marketing_channel",
        "first_touchpoint_date",
        "last_touchpoint_date",
        "first_touchpoint_source",
        "last_touchpoint_source",
        "sales_email_opt_out",
        "sales_email_opt_out_datetime",
        "bombora_surge_record_count",
        "bombora_last_update_date",
        "bombora_total_composite_score",
        "linked_in_url_c",
        "beta_connector_interest",
        "past_user_gems_info",
        "current_user_gems_info",
        "created_by_user_gems",
        "free_trial_confirmation_date",
        "dnb_contact_record",
        "dnb_company_record",
        "duns_number",
        "isell_os_key_id",
        "is_verified",
        "email_opt_out_datetime",
        "is_startup",
        "startup_eligibility_certified",
        "engagio_intent_minutes_30d",
        "engagio_engagement_minutes_3m",
        "engagio_engagement_minutes_7d",
        "engagio_matched_account",
        "engagio_first_engagement_date",
        "engagio_match_time",
        "engagio_department",
        "engagio_role",
        "legacy_id",
        "hvr_channel",
        "email_double_opt_in",
        "phone_number_misc",
        "domain_exists",
        "utm_id",
        "all_utm_ids",
        "last_utm_id",
        "first_utm_id",
        "marketo_sync_disabled_reason",
        "fivetran_sync_status"
    FROM "sf_lead_data_projected_renamed"
),

"sf_lead_data_projected_renamed_cleaned_null" AS (
    -- NULL Imputation: Impute Null to Disguised Missing Values
    -- name: ['']
    -- search_index: ['']
    -- last_utm_source: ['']
    SELECT 
        CASE
            WHEN "name" = '' THEN NULL
            ELSE "name"
        END AS "name",
        CASE
            WHEN "search_index" = '' THEN NULL
            ELSE "search_index"
        END AS "search_index",
        CASE
            WHEN "last_utm_source" = '' THEN NULL
            ELSE "last_utm_source"
        END AS "last_utm_source",
        "account_id",
        "domain_exists",
        "last_utm_medium",
        "routing_action",
        "keywords",
        "bizible_2_account",
        "email_quality_catchall",
        "country_code",
        "first_touchpoint_source",
        "feature_requests",
        "ad_group_id",
        "last_viewed_date",
        "master_record_id",
        "fivetran_user_id",
        "lead_source_details",
        "lead_notes",
        "partner_rep_email",
        "lead_comments",
        "is_enriched",
        "zoominfo_first_updated",
        "beta_connector_interest",
        "original_utm_medium",
        "cloudingo_agent_as",
        "last_completed_salesloft_step",
        "first_lead_source_detail",
        "photo_url",
        "referral_account",
        "inferred_company",
        "last_touchpoint_source",
        "source_detail",
        "salutation",
        "acton_city",
        "cloudingo_agent_atz",
        "is_converted",
        "es_app_escountry_c",
        "pi_utm_medium_c",
        "email_explicit_opt_in",
        "last_lead_source",
        "is_emea_event_routing",
        "last_marketing_channel",
        "timeframe",
        "device_info",
        "es_app_esecid_c",
        "cloudingo_agent_ardi",
        "first_utm_id",
        "all_data_warehouses",
        "connector_products",
        "acton_country_code",
        "status_info",
        "email_quality",
        "reporting_timestamp",
        "bizible_2_ad_campaign_name_last_touch",
        "fivetran_association_date",
        "active_in_sequence",
        "marketing_contact_id",
        "created_timestamp",
        "first_activity",
        "last_modified_date",
        "needs_score_sync",
        "mkto_71_lead_score_c",
        "lead_country_code",
        "es_app_escity_c",
        "is_user_gem",
        "company_type",
        "alt_city",
        "do_not_route_lead",
        "fit_score",
        "company_phone",
        "status",
        "fivetran_account_id",
        "email_implicit_opt_in",
        "fivetran_sync_status",
        "job_title",
        "email_opt_out",
        "first_utm_content",
        "all_utm_ids",
        "bombora_last_update_date",
        "next_salesloft_step_due_date",
        "fivetran_user_roles",
        "manual_routing_trigger",
        "bi_tools",
        "zoominfo_employee_count",
        "acquisition_program",
        "email_double_opt_in",
        "recent_campaign_status",
        "state_code",
        "lead_number_c",
        "first_utm_term",
        "alexa_rank",
        "original_search_engine",
        "free_trial_confirmation_date",
        "conversion_object_name",
        "rerouting_status",
        "clearbit_ready",
        "contact_owner_override",
        "inferred_state_region",
        "conversion_object_type",
        "intent_topics",
        "all_lead_sources",
        "last_touchpoint_date",
        "last_interaction_description",
        "first_search_term",
        "first_touchpoint_date",
        "original_utm_campaign",
        "contact_stage",
        "all_utm_campaigns",
        "converted_opportunity_id",
        "enrichment_requested",
        "csi_code",
        "conversion_date",
        "last_activity_date",
        "match_type",
        "mobile_phone",
        "demo_scheduled_calendly",
        "engagio_matched_account",
        "utm_term_c",
        "linkedin_company_id",
        "lead_zip_code",
        "previous_lead_source_detail",
        "previous_job_title",
        "engagio_engagement_minutes_3m",
        "last_name",
        "converted_account_id",
        "first_utm_campaign",
        "router_status",
        "cloudingo_agent_ar",
        "linked_in_url_c",
        "fax",
        "zoominfo_technologies",
        "id",
        "all_utm_content",
        "lead_urgency_value",
        "last_utm_term",
        "sales_email_opt_out_datetime",
        "utm_id",
        "matched_account",
        "opportunity_competitors",
        "pi_campaign_c",
        "account_bi_tools",
        "marketing_process_stage",
        "email",
        "first_lead_source",
        "last_modified_by_id",
        "duns_number",
        "is_verified",
        "partner_type",
        "lead_state_acton",
        "zoominfo_company_id",
        "postal_code",
        "acton_state",
        "mql_date",
        "lead_tag",
        "pi_utm_content_c",
        "last_interaction_source",
        "salesloft_cadence_trigger",
        "all_connectors",
        "behavioral_score",
        "engagio_first_engagement_date",
        "up_region_c",
        "pardot_hard_bounced",
        "pi_score_c",
        "current_user_gems_info",
        "competitors",
        "inferred_country",
        "opportunity_products",
        "referral_contact_email",
        "clarus_project",
        "last_interaction_type",
        "last_activity",
        "startup_eligibility_certified",
        "linkedin_profile",
        "pi_utm_term_c",
        "lead_iq_state_c",
        "marketo_sync_disabled",
        "engagio_role",
        "street_address",
        "district",
        "sales_email_opt_out",
        "lead_creation_date",
        "reporting_matched_account",
        "original_source_type",
        "modified_lead_score",
        "original_referrer",
        "created_by_clearbit",
        "clarus_notes",
        "last_referenced_date",
        "converted_date",
        "intent_timestamp",
        "search_criteria",
        "marketing_cloud_subscriber",
        "associated_group",
        "number_of_employees",
        "enriched_timestamp",
        "first_search_type",
        "jigsaw_contact_id",
        "geo_state_c",
        "street",
        "sales_insight_hide_date",
        "google_click_id",
        "pardot_last_scored_at",
        "contact_status",
        "created_by_user_gems",
        "email_bounced_reason",
        "country",
        "metadata_creation_date",
        "all_utm_sources",
        "bounced_email_c",
        "inferred_phone_area_code",
        "trial_start_date",
        "original_source_info",
        "company_revenue",
        "previous_contact_info",
        "last_utm_content",
        "longitude",
        "is_unread_by_owner",
        "direct_office",
        "legacy_id",
        "routing_status",
        "calendly_creation_date",
        "website",
        "clarus_date",
        "bizible_2_landing_page_last_touch",
        "zipcode",
        "bombora_total_composite_score",
        "zoominfo_state",
        "automation_tracking_status",
        "created_by_id",
        "zoominfo_zip_code",
        "phone_number_misc",
        "partner_rep_name",
        "linkedin_member_token",
        "secondary_email",
        "previous_company",
        "notes",
        "lead_url",
        "country_additional",
        "lead_type",
        "first_utm_source",
        "attended_event",
        "inferred_postal_code",
        "email_bounced_date",
        "lead_postal_code",
        "es_app_eslinked_in_c",
        "previous_lead_source",
        "audience_names",
        "utm_medium_c",
        "bizible_2_marketing_channel_first_touch",
        "mql_reason",
        "original_utm_term",
        "campaignid_c",
        "utm_source_c",
        "marketing_connector_interest",
        "first_touch_url",
        "email_bounced_c",
        "pi_utm_source_c",
        "acton_referrer",
        "zoominfo_contact_id",
        "prospect_routing_rules",
        "lead_source",
        "latest_salesloft_cadence_name",
        "associated_account",
        "lead_priority_score",
        "latitude",
        "bizible_2_landing_page_first_touch",
        "promotion_id",
        "email_opt_out_datetime",
        "matched_lead",
        "email_opt_in",
        "converted_contact_id",
        "bizible_2_id",
        "employee_count",
        "acquisition_program_id",
        "geocode_accuracy",
        "owner_id",
        "referral_first_name",
        "original_search_phrase",
        "original_utm_content",
        "is_deleted",
        "facebook_url",
        "matched_buyer_persona",
        "account_data_warehouses",
        "region_c",
        "first_mql_date",
        "act_on_lead_score",
        "account_all_products",
        "first_utm_medium",
        "industry",
        "demographic_score",
        "isell_os_key_id",
        "created_date",
        "annual_revenue",
        "referral_last_name",
        "cloudingo_agent_les",
        "individual_id",
        "zoominfo_country",
        "technologies",
        "network",
        "last_utm_id",
        "last_modified_timestamp",
        "marketing_system_creation_date",
        "last_lead_source_category",
        "territory",
        "last_interesting_moment_date",
        "marketo_sync_disabled_reason",
        "pi_utm_campaign_c",
        "is_startup",
        "hvr_channel",
        "acton_country",
        "creative_assets",
        "original_utm_source",
        "all_utm_terms",
        "last_lead_source_detail",
        "dnb_contact_record",
        "user_gems_id",
        "volume_in_millions",
        "inferred_city",
        "first_name",
        "city",
        "past_account",
        "twitter_url",
        "lead_segment",
        "fivetran_use_case",
        "engagio_department",
        "engagio_intent_minutes_30d",
        "utm_content_c",
        "cloudingo_agent_av",
        "fivetran_account_stage",
        "all_lead_source_categories",
        "referral_contact",
        "all_utm_mediums",
        "bombora_surge_record_count",
        "contact_info",
        "data_warehouse_products",
        "intent_score",
        "lead_creation_datetime",
        "inferred_metro_area",
        "lead_keyword",
        "lead_relative_score",
        "company_employee_count",
        "allbound_id",
        "geo_country_c",
        "description",
        "clearbit_status",
        "state",
        "is_to_delete",
        "is_competitor",
        "zoominfo_last_updated",
        "es_app_essource_c",
        "phone",
        "lead_grade",
        "acton_postal_code",
        "es_app_esindustry_c",
        "company_employee_range",
        "lead_city",
        "company",
        "acquisition_date",
        "datawarehouse_used",
        "bizible_2_ad_campaign_name_first_touch",
        "last_utm_campaign",
        "clarus_editor",
        "converted_datetime",
        "es_app_esstate_c",
        "engagio_engagement_minutes_7d",
        "dnb_company_record",
        "all_lead_source_details",
        "lead_iq_country_c",
        "state_custom",
        "first_lead_source_category",
        "utm_campaign_c",
        "has_changed_job",
        "unique_email",
        "drift_cql_status",
        "gdpr_opt_in_status",
        "clarus_status",
        "engagio_match_time",
        "is_previous_customer",
        "csi_description",
        "past_user_gems_info"
    FROM "sf_lead_data_projected_renamed_cleaned"
),

"sf_lead_data_projected_renamed_cleaned_null_casted" AS (
    -- Column Type Casting: 
    -- account_all_products: from DECIMAL to ARRAY
    -- account_bi_tools: from DECIMAL to ARRAY
    -- account_data_warehouses: from DECIMAL to ARRAY
    -- account_id: from DECIMAL to VARCHAR
    -- acquisition_date: from DECIMAL to DATE
    -- acquisition_program: from DECIMAL to VARCHAR
    -- acquisition_program_id: from DECIMAL to VARCHAR
    -- act_on_lead_score: from DECIMAL to INT
    -- acton_city: from DECIMAL to VARCHAR
    -- acton_country: from DECIMAL to VARCHAR
    -- acton_country_code: from DECIMAL to VARCHAR
    -- acton_postal_code: from DECIMAL to VARCHAR
    -- acton_referrer: from DECIMAL to VARCHAR
    -- acton_state: from DECIMAL to VARCHAR
    -- ad_group_id: from DECIMAL to VARCHAR
    -- alexa_rank: from DECIMAL to INT
    -- all_connectors: from DECIMAL to ARRAY
    -- all_data_warehouses: from DECIMAL to ARRAY
    -- all_lead_source_categories: from DECIMAL to ARRAY
    -- all_lead_source_details: from DECIMAL to ARRAY
    -- all_lead_sources: from DECIMAL to ARRAY
    -- all_utm_campaigns: from DECIMAL to ARRAY
    -- all_utm_content: from DECIMAL to ARRAY
    -- all_utm_ids: from DECIMAL to ARRAY
    -- all_utm_mediums: from DECIMAL to ARRAY
    -- all_utm_sources: from DECIMAL to ARRAY
    -- all_utm_terms: from DECIMAL to ARRAY
    -- allbound_id: from DECIMAL to VARCHAR
    -- alt_city: from DECIMAL to VARCHAR
    -- associated_account: from DECIMAL to VARCHAR
    -- associated_group: from DECIMAL to VARCHAR
    -- audience_names: from DECIMAL to VARCHAR
    -- automation_tracking_status: from DECIMAL to VARCHAR
    -- beta_connector_interest: from DECIMAL to VARCHAR
    -- bi_tools: from DECIMAL to VARCHAR
    -- bizible_2_account: from DECIMAL to VARCHAR
    -- bizible_2_ad_campaign_name_first_touch: from DECIMAL to VARCHAR
    -- bizible_2_ad_campaign_name_last_touch: from DECIMAL to VARCHAR
    -- bizible_2_id: from DECIMAL to VARCHAR
    -- bizible_2_landing_page_first_touch: from DECIMAL to VARCHAR
    -- bizible_2_landing_page_last_touch: from DECIMAL to VARCHAR
    -- bizible_2_marketing_channel_first_touch: from DECIMAL to VARCHAR
    -- bombora_last_update_date: from DECIMAL to DATE
    -- bombora_surge_record_count: from DECIMAL to INT
    -- bounced_email_c: from DECIMAL to VARCHAR
    -- calendly_creation_date: from DECIMAL to DATE
    -- campaignid_c: from DECIMAL to VARCHAR
    -- city: from DECIMAL to VARCHAR
    -- clarus_date: from DECIMAL to DATE
    -- clarus_editor: from DECIMAL to VARCHAR
    -- clarus_notes: from DECIMAL to VARCHAR
    -- clarus_project: from DECIMAL to VARCHAR
    -- clarus_status: from DECIMAL to VARCHAR
    -- clearbit_status: from DECIMAL to VARCHAR
    -- cloudingo_agent_ar: from DECIMAL to VARCHAR
    -- cloudingo_agent_ardi: from DECIMAL to VARCHAR
    -- cloudingo_agent_as: from INT to VARCHAR
    -- cloudingo_agent_atz: from DECIMAL to VARCHAR
    -- cloudingo_agent_av: from DECIMAL to VARCHAR
    -- cloudingo_agent_les: from INT to VARCHAR
    -- company_employee_count: from DECIMAL to VARCHAR
    -- company_employee_range: from DECIMAL to VARCHAR
    -- company_phone: from DECIMAL to VARCHAR
    -- company_revenue: from DECIMAL to VARCHAR
    -- company_type: from DECIMAL to VARCHAR
    -- competitors: from DECIMAL to VARCHAR
    -- connector_products: from DECIMAL to VARCHAR
    -- contact_info: from DECIMAL to VARCHAR
    -- contact_owner_override: from DECIMAL to VARCHAR
    -- contact_status: from DECIMAL to VARCHAR
    -- conversion_date: from DECIMAL to VARCHAR
    -- conversion_object_name: from DECIMAL to VARCHAR
    -- conversion_object_type: from DECIMAL to VARCHAR
    -- converted_date: from VARCHAR to TIMESTAMP
    -- converted_datetime: from VARCHAR to TIMESTAMP
    -- converted_opportunity_id: from DECIMAL to VARCHAR
    -- country: from DECIMAL to VARCHAR
    -- country_additional: from DECIMAL to VARCHAR
    -- country_code: from DECIMAL to VARCHAR
    -- created_date: from VARCHAR to TIMESTAMP
    -- created_timestamp: from DECIMAL to VARCHAR
    -- creative_assets: from DECIMAL to VARCHAR
    -- csi_code: from DECIMAL to VARCHAR
    -- current_user_gems_info: from DECIMAL to VARCHAR
    -- data_warehouse_products: from DECIMAL to VARCHAR
    -- datawarehouse_used: from DECIMAL to VARCHAR
    -- demographic_score: from DECIMAL to VARCHAR
    -- description: from DECIMAL to VARCHAR
    -- device_info: from DECIMAL to VARCHAR
    -- direct_office: from DECIMAL to VARCHAR
    -- district: from DECIMAL to VARCHAR
    -- dnb_company_record: from DECIMAL to VARCHAR
    -- dnb_contact_record: from DECIMAL to VARCHAR
    -- domain_exists: from DECIMAL to VARCHAR
    -- drift_cql_status: from DECIMAL to VARCHAR
    -- duns_number: from DECIMAL to VARCHAR
    -- email_bounced_date: from DECIMAL to VARCHAR
    -- email_bounced_reason: from DECIMAL to VARCHAR
    -- email_opt_in: from DECIMAL to VARCHAR
    -- email_opt_out_datetime: from DECIMAL to TIMESTAMP
    -- email_quality_catchall: from DECIMAL to VARCHAR
    -- employee_count: from DECIMAL to INT
    -- engagio_department: from DECIMAL to VARCHAR
    -- engagio_first_engagement_date: from DECIMAL to DATE
    -- engagio_match_time: from DECIMAL to TIMESTAMP
    -- engagio_matched_account: from DECIMAL to VARCHAR
    -- engagio_role: from DECIMAL to VARCHAR
    -- enriched_timestamp: from DECIMAL to TIMESTAMP
    -- es_app_escity_c: from DECIMAL to VARCHAR
    -- es_app_escountry_c: from DECIMAL to VARCHAR
    -- es_app_esecid_c: from DECIMAL to VARCHAR
    -- es_app_esindustry_c: from DECIMAL to VARCHAR
    -- es_app_eslinked_in_c: from DECIMAL to VARCHAR
    -- es_app_essource_c: from DECIMAL to VARCHAR
    -- es_app_esstate_c: from DECIMAL to VARCHAR
    -- facebook_url: from DECIMAL to VARCHAR
    -- fax: from DECIMAL to VARCHAR
    -- feature_requests: from DECIMAL to VARCHAR
    -- first_activity: from DECIMAL to TIMESTAMP
    -- first_lead_source: from DECIMAL to VARCHAR
    -- first_lead_source_category: from DECIMAL to VARCHAR
    -- first_lead_source_detail: from DECIMAL to VARCHAR
    -- first_mql_date: from DECIMAL to DATE
    -- first_search_term: from DECIMAL to VARCHAR
    -- first_search_type: from DECIMAL to VARCHAR
    -- first_touch_url: from DECIMAL to VARCHAR
    -- first_touchpoint_date: from DECIMAL to DATE
    -- first_touchpoint_source: from DECIMAL to VARCHAR
    -- first_utm_campaign: from DECIMAL to VARCHAR
    -- first_utm_content: from DECIMAL to VARCHAR
    -- first_utm_id: from DECIMAL to VARCHAR
    -- first_utm_medium: from DECIMAL to VARCHAR
    -- first_utm_source: from DECIMAL to VARCHAR
    -- first_utm_term: from DECIMAL to VARCHAR
    -- fivetran_account_id: from DECIMAL to VARCHAR
    -- fivetran_account_stage: from DECIMAL to VARCHAR
    -- fivetran_association_date: from DECIMAL to DATE
    -- fivetran_sync_status: from DECIMAL to VARCHAR
    -- fivetran_user_id: from DECIMAL to VARCHAR
    -- fivetran_user_roles: from DECIMAL to VARCHAR
    -- free_trial_confirmation_date: from DECIMAL to DATE
    -- geo_country_c: from DECIMAL to VARCHAR
    -- geo_state_c: from DECIMAL to VARCHAR
    -- geocode_accuracy: from DECIMAL to VARCHAR
    -- google_click_id: from DECIMAL to VARCHAR
    -- has_changed_job: from DECIMAL to BOOLEAN
    -- hvr_channel: from DECIMAL to VARCHAR
    -- individual_id: from DECIMAL to VARCHAR
    -- inferred_city: from DECIMAL to VARCHAR
    -- inferred_company: from DECIMAL to VARCHAR
    -- inferred_country: from DECIMAL to VARCHAR
    -- inferred_metro_area: from DECIMAL to VARCHAR
    -- inferred_phone_area_code: from DECIMAL to VARCHAR
    -- inferred_postal_code: from DECIMAL to VARCHAR
    -- inferred_state_region: from DECIMAL to VARCHAR
    -- intent_timestamp: from DECIMAL to TIMESTAMP
    -- intent_topics: from DECIMAL to ARRAY
    -- is_enriched: from DECIMAL to BOOLEAN
    -- is_previous_customer: from DECIMAL to BOOLEAN
    -- is_startup: from DECIMAL to BOOLEAN
    -- isell_os_key_id: from DECIMAL to UUID
    -- jigsaw_contact_id: from DECIMAL to VARCHAR
    -- job_title: from DECIMAL to VARCHAR
    -- keywords: from DECIMAL to ARRAY
    -- last_activity: from DECIMAL to VARCHAR
    -- last_activity_date: from DECIMAL to DATE
    -- last_completed_salesloft_step: from DECIMAL to VARCHAR
    -- last_interesting_moment_date: from VARCHAR to TIMESTAMP
    -- last_lead_source: from DECIMAL to VARCHAR
    -- last_lead_source_category: from DECIMAL to VARCHAR
    -- last_lead_source_detail: from DECIMAL to VARCHAR
    -- last_marketing_channel: from DECIMAL to VARCHAR
    -- last_modified_date: from VARCHAR to TIMESTAMP
    -- last_modified_timestamp: from VARCHAR to TIMESTAMP
    -- last_referenced_date: from DECIMAL to TIMESTAMP
    -- last_touchpoint_date: from DECIMAL to TIMESTAMP
    -- last_touchpoint_source: from DECIMAL to VARCHAR
    -- last_utm_id: from DECIMAL to VARCHAR
    -- last_viewed_date: from DECIMAL to TIMESTAMP
    -- latest_salesloft_cadence_name: from DECIMAL to VARCHAR
    -- lead_city: from DECIMAL to VARCHAR
    -- lead_comments: from DECIMAL to VARCHAR
    -- lead_country_code: from DECIMAL to VARCHAR
    -- lead_creation_date: from DECIMAL to DATE
    -- lead_creation_datetime: from VARCHAR to TIMESTAMP
    -- lead_grade: from DECIMAL to VARCHAR
    -- lead_iq_country_c: from DECIMAL to VARCHAR
    -- lead_iq_state_c: from DECIMAL to VARCHAR
    -- lead_keyword: from DECIMAL to VARCHAR
    -- lead_notes: from DECIMAL to VARCHAR
    -- lead_number_c: from INT to VARCHAR
    -- lead_postal_code: from DECIMAL to VARCHAR
    -- lead_relative_score: from DECIMAL to VARCHAR
    -- lead_segment: from DECIMAL to VARCHAR
    -- lead_source: from DECIMAL to VARCHAR
    -- lead_source_details: from DECIMAL to VARCHAR
    -- lead_state_acton: from DECIMAL to VARCHAR
    -- lead_tag: from DECIMAL to VARCHAR
    -- lead_type: from DECIMAL to VARCHAR
    -- lead_url: from DECIMAL to VARCHAR
    -- lead_zip_code: from DECIMAL to VARCHAR
    -- legacy_id: from DECIMAL to VARCHAR
    -- linked_in_url_c: from DECIMAL to VARCHAR
    -- linkedin_company_id: from DECIMAL to VARCHAR
    -- linkedin_member_token: from DECIMAL to VARCHAR
    -- linkedin_profile: from DECIMAL to VARCHAR
    -- marketing_cloud_subscriber: from DECIMAL to VARCHAR
    -- marketing_connector_interest: from DECIMAL to VARCHAR
    -- marketing_contact_id: from DECIMAL to VARCHAR
    -- marketing_process_stage: from DECIMAL to VARCHAR
    -- marketing_system_creation_date: from DECIMAL to TIMESTAMP
    -- marketo_sync_disabled_reason: from DECIMAL to VARCHAR
    -- master_record_id: from DECIMAL to VARCHAR
    -- match_type: from DECIMAL to VARCHAR
    -- matched_account: from DECIMAL to VARCHAR
    -- matched_buyer_persona: from DECIMAL to VARCHAR
    -- matched_lead: from DECIMAL to VARCHAR
    -- metadata_creation_date: from VARCHAR to TIMESTAMP
    -- mkto_71_lead_score_c: from DECIMAL to VARCHAR
    -- mobile_phone: from DECIMAL to VARCHAR
    -- modified_lead_score: from DECIMAL to VARCHAR
    -- mql_date: from DECIMAL to DATE
    -- needs_score_sync: from DECIMAL to BOOLEAN
    -- network: from DECIMAL to VARCHAR
    -- next_salesloft_step_due_date: from DECIMAL to DATE
    -- notes: from DECIMAL to VARCHAR
    -- number_of_employees: from DECIMAL to INT
    -- opportunity_competitors: from DECIMAL to VARCHAR
    -- opportunity_products: from DECIMAL to VARCHAR
    -- original_referrer: from DECIMAL to VARCHAR
    -- original_search_engine: from DECIMAL to VARCHAR
    -- original_search_phrase: from DECIMAL to VARCHAR
    -- original_source_info: from DECIMAL to VARCHAR
    -- original_source_type: from DECIMAL to VARCHAR
    -- original_utm_campaign: from DECIMAL to VARCHAR
    -- original_utm_content: from DECIMAL to VARCHAR
    -- original_utm_medium: from DECIMAL to VARCHAR
    -- original_utm_source: from DECIMAL to VARCHAR
    -- original_utm_term: from DECIMAL to VARCHAR
    -- pardot_hard_bounced: from DECIMAL to BOOLEAN
    -- pardot_last_scored_at: from DECIMAL to TIMESTAMP
    -- partner_rep_email: from DECIMAL to VARCHAR
    -- partner_rep_name: from DECIMAL to VARCHAR
    -- partner_type: from DECIMAL to VARCHAR
    -- past_account: from DECIMAL to VARCHAR
    -- past_user_gems_info: from DECIMAL to JSON
    -- phone: from DECIMAL to VARCHAR
    -- phone_number_misc: from DECIMAL to VARCHAR
    -- pi_campaign_c: from DECIMAL to VARCHAR
    -- pi_utm_campaign_c: from DECIMAL to VARCHAR
    -- pi_utm_content_c: from DECIMAL to VARCHAR
    -- pi_utm_medium_c: from DECIMAL to VARCHAR
    -- pi_utm_source_c: from DECIMAL to VARCHAR
    -- pi_utm_term_c: from DECIMAL to VARCHAR
    -- postal_code: from DECIMAL to VARCHAR
    -- previous_company: from DECIMAL to VARCHAR
    -- previous_contact_info: from DECIMAL to VARCHAR
    -- previous_job_title: from DECIMAL to VARCHAR
    -- previous_lead_source: from DECIMAL to VARCHAR
    -- previous_lead_source_detail: from DECIMAL to VARCHAR
    -- promotion_id: from DECIMAL to VARCHAR
    -- recent_campaign_status: from DECIMAL to VARCHAR
    -- referral_account: from DECIMAL to VARCHAR
    -- referral_contact: from DECIMAL to VARCHAR
    -- referral_contact_email: from DECIMAL to VARCHAR
    -- referral_first_name: from DECIMAL to VARCHAR
    -- referral_last_name: from DECIMAL to VARCHAR
    -- region_c: from DECIMAL to VARCHAR
    -- reporting_timestamp: from VARCHAR to TIMESTAMP
    -- rerouting_status: from DECIMAL to VARCHAR
    -- router_status: from DECIMAL to VARCHAR
    -- sales_email_opt_out_datetime: from DECIMAL to TIMESTAMP
    -- sales_insight_hide_date: from DECIMAL to DATE
    -- salesloft_cadence_trigger: from DECIMAL to VARCHAR
    -- salutation: from DECIMAL to VARCHAR
    -- search_criteria: from DECIMAL to VARCHAR
    -- secondary_email: from DECIMAL to VARCHAR
    -- source_detail: from DECIMAL to VARCHAR
    -- state: from DECIMAL to VARCHAR
    -- state_code: from DECIMAL to VARCHAR
    -- state_custom: from DECIMAL to VARCHAR
    -- status_info: from DECIMAL to VARCHAR
    -- street: from DECIMAL to VARCHAR
    -- street_address: from DECIMAL to VARCHAR
    -- technologies: from DECIMAL to VARCHAR
    -- territory: from DECIMAL to VARCHAR
    -- timeframe: from DECIMAL to VARCHAR
    -- trial_start_date: from DECIMAL to DATE
    -- twitter_url: from DECIMAL to VARCHAR
    -- unique_email: from DECIMAL to VARCHAR
    -- up_region_c: from DECIMAL to VARCHAR
    -- user_gems_id: from DECIMAL to VARCHAR
    -- utm_campaign_c: from DECIMAL to VARCHAR
    -- utm_content_c: from DECIMAL to VARCHAR
    -- utm_id: from DECIMAL to VARCHAR
    -- utm_medium_c: from DECIMAL to VARCHAR
    -- utm_source_c: from DECIMAL to VARCHAR
    -- utm_term_c: from DECIMAL to VARCHAR
    -- volume_in_millions: from INT to DECIMAL
    -- website: from DECIMAL to VARCHAR
    -- zipcode: from DECIMAL to VARCHAR
    -- zoominfo_company_id: from DECIMAL to VARCHAR
    -- zoominfo_contact_id: from DECIMAL to VARCHAR
    -- zoominfo_country: from DECIMAL to VARCHAR
    -- zoominfo_employee_count: from DECIMAL to INT
    -- zoominfo_first_updated: from DECIMAL to TIMESTAMP
    -- zoominfo_last_updated: from DECIMAL to TIMESTAMP
    -- zoominfo_state: from DECIMAL to VARCHAR
    -- zoominfo_technologies: from DECIMAL to ARRAY
    -- zoominfo_zip_code: from DECIMAL to VARCHAR
    SELECT
        "name",
        "search_index",
        "last_utm_source",
        "last_utm_medium",
        "routing_action",
        "photo_url",
        "is_converted",
        "email_explicit_opt_in",
        "is_emea_event_routing",
        "email_quality",
        "active_in_sequence",
        "is_user_gem",
        "do_not_route_lead",
        "fit_score",
        "status",
        "email_implicit_opt_in",
        "email_opt_out",
        "manual_routing_trigger",
        "email_double_opt_in",
        "clearbit_ready",
        "last_interaction_description",
        "contact_stage",
        "enrichment_requested",
        "demo_scheduled_calendly",
        "engagio_engagement_minutes_3m",
        "last_name",
        "converted_account_id",
        "id",
        "lead_urgency_value",
        "last_utm_term",
        "email",
        "last_modified_by_id",
        "is_verified",
        "last_interaction_source",
        "behavioral_score",
        "pi_score_c",
        "last_interaction_type",
        "startup_eligibility_certified",
        "marketo_sync_disabled",
        "sales_email_opt_out",
        "reporting_matched_account",
        "created_by_clearbit",
        "created_by_user_gems",
        "last_utm_content",
        "longitude",
        "is_unread_by_owner",
        "routing_status",
        "bombora_total_composite_score",
        "created_by_id",
        "attended_event",
        "mql_reason",
        "email_bounced_c",
        "prospect_routing_rules",
        "lead_priority_score",
        "latitude",
        "converted_contact_id",
        "owner_id",
        "is_deleted",
        "industry",
        "annual_revenue",
        "first_name",
        "fivetran_use_case",
        "engagio_intent_minutes_30d",
        "intent_score",
        "is_to_delete",
        "is_competitor",
        "company",
        "last_utm_campaign",
        "engagio_engagement_minutes_7d",
        "gdpr_opt_in_status",
        "csi_description",
        COALESCE("account_all_products", ARRAY[]) AS "account_all_products",
        COALESCE(STRING_SPLIT("account_bi_tools", ','), ARRAY[]) AS "account_bi_tools",
        ARRAY["account_data_warehouses"] AS "account_data_warehouses",
        CAST("account_id" AS VARCHAR) AS "account_id",
        CAST("acquisition_date" AS DATE) AS "acquisition_date",
        CAST("acquisition_program" AS VARCHAR) AS "acquisition_program",
        CAST("acquisition_program_id" AS VARCHAR) AS "acquisition_program_id",
        CAST("act_on_lead_score" AS INT) AS "act_on_lead_score",
        CAST("acton_city" AS VARCHAR) AS "acton_city",
        CAST("acton_country" AS VARCHAR) AS "acton_country",
        CAST("acton_country_code" AS VARCHAR) AS "acton_country_code",
        CAST("acton_postal_code" AS VARCHAR) AS "acton_postal_code",
        CAST("acton_referrer" AS VARCHAR) AS "acton_referrer",
        CAST("acton_state" AS VARCHAR) AS "acton_state",
        CAST("ad_group_id" AS VARCHAR) AS "ad_group_id",
        CAST("alexa_rank" AS INT) AS "alexa_rank",
        ARRAY["all_connectors"] AS "all_connectors",
        COALESCE(STRING_SPLIT("all_data_warehouses", ','), ARRAY[]) AS "all_data_warehouses",
        ARRAY["all_lead_source_categories"] AS "all_lead_source_categories",
        COALESCE(STRING_SPLIT("all_lead_source_details", ','), ARRAY[]) AS "all_lead_source_details",
        CAST("all_lead_sources" AS VARCHAR[]) AS "all_lead_sources",
        string_split("all_utm_campaigns", ',') AS "all_utm_campaigns",
        COALESCE(string_split("all_utm_content", '|'), ARRAY[]) AS "all_utm_content",
        JSON_ARRAY("all_utm_ids") AS "all_utm_ids",
        string_split("all_utm_mediums", ',') AS "all_utm_mediums",
        JSON_ARRAY("all_utm_sources") AS "all_utm_sources",
        CAST("all_utm_terms" AS VARCHAR[]) AS "all_utm_terms",
        CAST("allbound_id" AS VARCHAR) AS "allbound_id",
        CAST("alt_city" AS VARCHAR) AS "alt_city",
        CAST("associated_account" AS VARCHAR) AS "associated_account",
        CAST("associated_group" AS VARCHAR) AS "associated_group",
        CAST("audience_names" AS VARCHAR) AS "audience_names",
        CAST("automation_tracking_status" AS VARCHAR) AS "automation_tracking_status",
        CAST("beta_connector_interest" AS VARCHAR) AS "beta_connector_interest",
        CAST("bi_tools" AS VARCHAR) AS "bi_tools",
        CAST("bizible_2_account" AS VARCHAR) AS "bizible_2_account",
        CAST("bizible_2_ad_campaign_name_first_touch" AS VARCHAR) AS "bizible_2_ad_campaign_name_first_touch",
        CAST("bizible_2_ad_campaign_name_last_touch" AS VARCHAR) AS "bizible_2_ad_campaign_name_last_touch",
        CAST("bizible_2_id" AS VARCHAR) AS "bizible_2_id",
        CAST("bizible_2_landing_page_first_touch" AS VARCHAR) AS "bizible_2_landing_page_first_touch",
        CAST("bizible_2_landing_page_last_touch" AS VARCHAR) AS "bizible_2_landing_page_last_touch",
        CAST("bizible_2_marketing_channel_first_touch" AS VARCHAR) AS "bizible_2_marketing_channel_first_touch",
        CAST("bombora_last_update_date" AS DATE) AS "bombora_last_update_date",
        CAST("bombora_surge_record_count" AS INT) AS "bombora_surge_record_count",
        CAST("bounced_email_c" AS VARCHAR) AS "bounced_email_c",
        CAST("calendly_creation_date" AS DATE) AS "calendly_creation_date",
        CAST("campaignid_c" AS VARCHAR) AS "campaignid_c",
        CAST("city" AS VARCHAR) AS "city",
        CAST("clarus_date" AS DATE) AS "clarus_date",
        CAST("clarus_editor" AS VARCHAR) AS "clarus_editor",
        CAST("clarus_notes" AS VARCHAR) AS "clarus_notes",
        CAST("clarus_project" AS VARCHAR) AS "clarus_project",
        CAST("clarus_status" AS VARCHAR) AS "clarus_status",
        CAST("clearbit_status" AS VARCHAR) AS "clearbit_status",
        CAST("cloudingo_agent_ar" AS VARCHAR) AS "cloudingo_agent_ar",
        CAST("cloudingo_agent_ardi" AS VARCHAR) AS "cloudingo_agent_ardi",
        CAST("cloudingo_agent_as" AS VARCHAR) AS "cloudingo_agent_as",
        CAST("cloudingo_agent_atz" AS VARCHAR) AS "cloudingo_agent_atz",
        CAST("cloudingo_agent_av" AS VARCHAR) AS "cloudingo_agent_av",
        CAST("cloudingo_agent_les" AS VARCHAR) AS "cloudingo_agent_les",
        CAST("company_employee_count" AS VARCHAR) AS "company_employee_count",
        CAST("company_employee_range" AS VARCHAR) AS "company_employee_range",
        CAST("company_phone" AS VARCHAR) AS "company_phone",
        CAST("company_revenue" AS VARCHAR) AS "company_revenue",
        CAST("company_type" AS VARCHAR) AS "company_type",
        CAST("competitors" AS VARCHAR) AS "competitors",
        CAST("connector_products" AS VARCHAR) AS "connector_products",
        CAST("contact_info" AS VARCHAR) AS "contact_info",
        CAST("contact_owner_override" AS VARCHAR) AS "contact_owner_override",
        CAST("contact_status" AS VARCHAR) AS "contact_status",
        CAST("conversion_date" AS VARCHAR) AS "conversion_date",
        CAST("conversion_object_name" AS VARCHAR) AS "conversion_object_name",
        CAST("conversion_object_type" AS VARCHAR) AS "conversion_object_type",
        CAST("converted_date" AS TIMESTAMP) AS "converted_date",
        CAST("converted_datetime" AS TIMESTAMP) AS "converted_datetime",
        CAST("converted_opportunity_id" AS VARCHAR) AS "converted_opportunity_id",
        CAST("country" AS VARCHAR) AS "country",
        CAST("country_additional" AS VARCHAR) AS "country_additional",
        CAST("country_code" AS VARCHAR) AS "country_code",
        CAST("created_date" AS TIMESTAMP) AS "created_date",
        CAST("created_timestamp" AS VARCHAR) AS "created_timestamp",
        CAST("creative_assets" AS VARCHAR) AS "creative_assets",
        CAST("csi_code" AS VARCHAR) AS "csi_code",
        CAST("current_user_gems_info" AS VARCHAR) AS "current_user_gems_info",
        CAST("data_warehouse_products" AS VARCHAR) AS "data_warehouse_products",
        CAST("datawarehouse_used" AS VARCHAR) AS "datawarehouse_used",
        CAST("demographic_score" AS VARCHAR) AS "demographic_score",
        CAST("description" AS VARCHAR) AS "description",
        CAST("device_info" AS VARCHAR) AS "device_info",
        CAST("direct_office" AS VARCHAR) AS "direct_office",
        CAST("district" AS VARCHAR) AS "district",
        CAST("dnb_company_record" AS VARCHAR) AS "dnb_company_record",
        CAST("dnb_contact_record" AS VARCHAR) AS "dnb_contact_record",
        CAST("domain_exists" AS VARCHAR) AS "domain_exists",
        CAST("drift_cql_status" AS VARCHAR) AS "drift_cql_status",
        CAST("duns_number" AS VARCHAR) AS "duns_number",
        CAST("email_bounced_date" AS VARCHAR) AS "email_bounced_date",
        CAST("email_bounced_reason" AS VARCHAR) AS "email_bounced_reason",
        CAST("email_opt_in" AS VARCHAR) AS "email_opt_in",
        CAST("email_opt_out_datetime" AS TIMESTAMP) AS "email_opt_out_datetime",
        CAST("email_quality_catchall" AS VARCHAR) AS "email_quality_catchall",
        CAST("employee_count" AS INT) AS "employee_count",
        CAST("engagio_department" AS VARCHAR) AS "engagio_department",
        CAST("engagio_first_engagement_date" AS DATE) AS "engagio_first_engagement_date",
        CAST("engagio_match_time" AS TIMESTAMP) AS "engagio_match_time",
        CAST("engagio_matched_account" AS VARCHAR) AS "engagio_matched_account",
        CAST("engagio_role" AS VARCHAR) AS "engagio_role",
        CAST("enriched_timestamp" AS TIMESTAMP) AS "enriched_timestamp",
        CAST("es_app_escity_c" AS VARCHAR) AS "es_app_escity_c",
        CAST("es_app_escountry_c" AS VARCHAR) AS "es_app_escountry_c",
        CAST("es_app_esecid_c" AS VARCHAR) AS "es_app_esecid_c",
        CAST("es_app_esindustry_c" AS VARCHAR) AS "es_app_esindustry_c",
        CAST("es_app_eslinked_in_c" AS VARCHAR) AS "es_app_eslinked_in_c",
        CAST("es_app_essource_c" AS VARCHAR) AS "es_app_essource_c",
        CAST("es_app_esstate_c" AS VARCHAR) AS "es_app_esstate_c",
        CAST("facebook_url" AS VARCHAR) AS "facebook_url",
        CAST("fax" AS VARCHAR) AS "fax",
        CAST("feature_requests" AS VARCHAR) AS "feature_requests",
        CAST("first_activity" AS TIMESTAMP) AS "first_activity",
        CAST("first_lead_source" AS VARCHAR) AS "first_lead_source",
        CAST("first_lead_source_category" AS VARCHAR) AS "first_lead_source_category",
        CAST("first_lead_source_detail" AS VARCHAR) AS "first_lead_source_detail",
        CAST("first_mql_date" AS DATE) AS "first_mql_date",
        CAST("first_search_term" AS VARCHAR) AS "first_search_term",
        CAST("first_search_type" AS VARCHAR) AS "first_search_type",
        CAST("first_touch_url" AS VARCHAR) AS "first_touch_url",
        CAST("first_touchpoint_date" AS DATE) AS "first_touchpoint_date",
        CAST("first_touchpoint_source" AS VARCHAR) AS "first_touchpoint_source",
        CAST("first_utm_campaign" AS VARCHAR) AS "first_utm_campaign",
        CAST("first_utm_content" AS VARCHAR) AS "first_utm_content",
        CAST("first_utm_id" AS VARCHAR) AS "first_utm_id",
        CAST("first_utm_medium" AS VARCHAR) AS "first_utm_medium",
        CAST("first_utm_source" AS VARCHAR) AS "first_utm_source",
        CAST("first_utm_term" AS VARCHAR) AS "first_utm_term",
        CAST("fivetran_account_id" AS VARCHAR) AS "fivetran_account_id",
        CAST("fivetran_account_stage" AS VARCHAR) AS "fivetran_account_stage",
        CAST("fivetran_association_date" AS DATE) AS "fivetran_association_date",
        CAST("fivetran_sync_status" AS VARCHAR) AS "fivetran_sync_status",
        CAST("fivetran_user_id" AS VARCHAR) AS "fivetran_user_id",
        CAST("fivetran_user_roles" AS VARCHAR) AS "fivetran_user_roles",
        CAST("free_trial_confirmation_date" AS DATE) AS "free_trial_confirmation_date",
        CAST("geo_country_c" AS VARCHAR) AS "geo_country_c",
        CAST("geo_state_c" AS VARCHAR) AS "geo_state_c",
        CAST("geocode_accuracy" AS VARCHAR) AS "geocode_accuracy",
        CAST("google_click_id" AS VARCHAR) AS "google_click_id",
        CAST("has_changed_job" AS BOOLEAN) AS "has_changed_job",
        CAST("hvr_channel" AS VARCHAR) AS "hvr_channel",
        CAST("individual_id" AS VARCHAR) AS "individual_id",
        CAST("inferred_city" AS VARCHAR) AS "inferred_city",
        CAST("inferred_company" AS VARCHAR) AS "inferred_company",
        CAST("inferred_country" AS VARCHAR) AS "inferred_country",
        CAST("inferred_metro_area" AS VARCHAR) AS "inferred_metro_area",
        CAST("inferred_phone_area_code" AS VARCHAR) AS "inferred_phone_area_code",
        CAST("inferred_postal_code" AS VARCHAR) AS "inferred_postal_code",
        CAST("inferred_state_region" AS VARCHAR) AS "inferred_state_region",
        CAST("intent_timestamp" AS TIMESTAMP) AS "intent_timestamp",
        STRING_SPLIT("intent_topics", ',') AS "intent_topics",
        CAST("is_enriched" AS BOOLEAN) AS "is_enriched",
        CAST("is_previous_customer" AS BOOLEAN) AS "is_previous_customer",
        CAST("is_startup" AS BOOLEAN) AS "is_startup",
        CAST("isell_os_key_id" AS UUID) AS "isell_os_key_id",
        CAST("jigsaw_contact_id" AS VARCHAR) AS "jigsaw_contact_id",
        CAST("job_title" AS VARCHAR) AS "job_title",
        STRING_SPLIT("keywords", ',') AS "keywords",
        CAST("last_activity" AS VARCHAR) AS "last_activity",
        CAST("last_activity_date" AS DATE) AS "last_activity_date",
        CAST("last_completed_salesloft_step" AS VARCHAR) AS "last_completed_salesloft_step",
        CAST("last_interesting_moment_date" AS TIMESTAMP) AS "last_interesting_moment_date",
        CAST("last_lead_source" AS VARCHAR) AS "last_lead_source",
        CAST("last_lead_source_category" AS VARCHAR) AS "last_lead_source_category",
        CAST("last_lead_source_detail" AS VARCHAR) AS "last_lead_source_detail",
        CAST("last_marketing_channel" AS VARCHAR) AS "last_marketing_channel",
        CAST("last_modified_date" AS TIMESTAMP) AS "last_modified_date",
        CAST("last_modified_timestamp" AS TIMESTAMP) AS "last_modified_timestamp",
        CAST("last_referenced_date" AS TIMESTAMP) AS "last_referenced_date",
        CAST("last_touchpoint_date" AS TIMESTAMP) AS "last_touchpoint_date",
        CAST("last_touchpoint_source" AS VARCHAR) AS "last_touchpoint_source",
        CAST("last_utm_id" AS VARCHAR) AS "last_utm_id",
        CAST("last_viewed_date" AS TIMESTAMP) AS "last_viewed_date",
        CAST("latest_salesloft_cadence_name" AS VARCHAR) AS "latest_salesloft_cadence_name",
        CAST("lead_city" AS VARCHAR) AS "lead_city",
        CAST("lead_comments" AS VARCHAR) AS "lead_comments",
        CAST("lead_country_code" AS VARCHAR) AS "lead_country_code",
        CAST("lead_creation_date" AS DATE) AS "lead_creation_date",
        CAST("lead_creation_datetime" AS TIMESTAMP) AS "lead_creation_datetime",
        CAST("lead_grade" AS VARCHAR) AS "lead_grade",
        CAST("lead_iq_country_c" AS VARCHAR) AS "lead_iq_country_c",
        CAST("lead_iq_state_c" AS VARCHAR) AS "lead_iq_state_c",
        CAST("lead_keyword" AS VARCHAR) AS "lead_keyword",
        CAST("lead_notes" AS VARCHAR) AS "lead_notes",
        CAST("lead_number_c" AS VARCHAR) AS "lead_number_c",
        CAST("lead_postal_code" AS VARCHAR) AS "lead_postal_code",
        CAST("lead_relative_score" AS VARCHAR) AS "lead_relative_score",
        CAST("lead_segment" AS VARCHAR) AS "lead_segment",
        CAST("lead_source" AS VARCHAR) AS "lead_source",
        CAST("lead_source_details" AS VARCHAR) AS "lead_source_details",
        CAST("lead_state_acton" AS VARCHAR) AS "lead_state_acton",
        CAST("lead_tag" AS VARCHAR) AS "lead_tag",
        CAST("lead_type" AS VARCHAR) AS "lead_type",
        CAST("lead_url" AS VARCHAR) AS "lead_url",
        CAST("lead_zip_code" AS VARCHAR) AS "lead_zip_code",
        CAST("legacy_id" AS VARCHAR) AS "legacy_id",
        CAST("linked_in_url_c" AS VARCHAR) AS "linked_in_url_c",
        CAST("linkedin_company_id" AS VARCHAR) AS "linkedin_company_id",
        CAST("linkedin_member_token" AS VARCHAR) AS "linkedin_member_token",
        CAST("linkedin_profile" AS VARCHAR) AS "linkedin_profile",
        CAST("marketing_cloud_subscriber" AS VARCHAR) AS "marketing_cloud_subscriber",
        CAST("marketing_connector_interest" AS VARCHAR) AS "marketing_connector_interest",
        CAST("marketing_contact_id" AS VARCHAR) AS "marketing_contact_id",
        CAST("marketing_process_stage" AS VARCHAR) AS "marketing_process_stage",
        CAST("marketing_system_creation_date" AS TIMESTAMP) AS "marketing_system_creation_date",
        CAST("marketo_sync_disabled_reason" AS VARCHAR) AS "marketo_sync_disabled_reason",
        CAST("master_record_id" AS VARCHAR) AS "master_record_id",
        CAST("match_type" AS VARCHAR) AS "match_type",
        CAST("matched_account" AS VARCHAR) AS "matched_account",
        CAST("matched_buyer_persona" AS VARCHAR) AS "matched_buyer_persona",
        CAST("matched_lead" AS VARCHAR) AS "matched_lead",
        CAST("metadata_creation_date" AS TIMESTAMP) AS "metadata_creation_date",
        CAST("mkto_71_lead_score_c" AS VARCHAR) AS "mkto_71_lead_score_c",
        CAST("mobile_phone" AS VARCHAR) AS "mobile_phone",
        CAST("modified_lead_score" AS VARCHAR) AS "modified_lead_score",
        CAST("mql_date" AS DATE) AS "mql_date",
        CAST("needs_score_sync" AS BOOLEAN) AS "needs_score_sync",
        CAST("network" AS VARCHAR) AS "network",
        CAST("next_salesloft_step_due_date" AS DATE) AS "next_salesloft_step_due_date",
        CAST("notes" AS VARCHAR) AS "notes",
        CAST("number_of_employees" AS INT) AS "number_of_employees",
        CAST("opportunity_competitors" AS VARCHAR) AS "opportunity_competitors",
        CAST("opportunity_products" AS VARCHAR) AS "opportunity_products",
        CAST("original_referrer" AS VARCHAR) AS "original_referrer",
        CAST("original_search_engine" AS VARCHAR) AS "original_search_engine",
        CAST("original_search_phrase" AS VARCHAR) AS "original_search_phrase",
        CAST("original_source_info" AS VARCHAR) AS "original_source_info",
        CAST("original_source_type" AS VARCHAR) AS "original_source_type",
        CAST("original_utm_campaign" AS VARCHAR) AS "original_utm_campaign",
        CAST("original_utm_content" AS VARCHAR) AS "original_utm_content",
        CAST("original_utm_medium" AS VARCHAR) AS "original_utm_medium",
        CAST("original_utm_source" AS VARCHAR) AS "original_utm_source",
        CAST("original_utm_term" AS VARCHAR) AS "original_utm_term",
        CAST("pardot_hard_bounced" AS BOOLEAN) AS "pardot_hard_bounced",
        CAST("pardot_last_scored_at" AS TIMESTAMP) AS "pardot_last_scored_at",
        CAST("partner_rep_email" AS VARCHAR) AS "partner_rep_email",
        CAST("partner_rep_name" AS VARCHAR) AS "partner_rep_name",
        CAST("partner_type" AS VARCHAR) AS "partner_type",
        CAST("past_account" AS VARCHAR) AS "past_account",
        CAST("past_user_gems_info" AS JSON) AS "past_user_gems_info",
        CAST("phone" AS VARCHAR) AS "phone",
        CAST("phone_number_misc" AS VARCHAR) AS "phone_number_misc",
        CAST("pi_campaign_c" AS VARCHAR) AS "pi_campaign_c",
        CAST("pi_utm_campaign_c" AS VARCHAR) AS "pi_utm_campaign_c",
        CAST("pi_utm_content_c" AS VARCHAR) AS "pi_utm_content_c",
        CAST("pi_utm_medium_c" AS VARCHAR) AS "pi_utm_medium_c",
        CAST("pi_utm_source_c" AS VARCHAR) AS "pi_utm_source_c",
        CAST("pi_utm_term_c" AS VARCHAR) AS "pi_utm_term_c",
        CAST("postal_code" AS VARCHAR) AS "postal_code",
        CAST("previous_company" AS VARCHAR) AS "previous_company",
        CAST("previous_contact_info" AS VARCHAR) AS "previous_contact_info",
        CAST("previous_job_title" AS VARCHAR) AS "previous_job_title",
        CAST("previous_lead_source" AS VARCHAR) AS "previous_lead_source",
        CAST("previous_lead_source_detail" AS VARCHAR) AS "previous_lead_source_detail",
        CAST("promotion_id" AS VARCHAR) AS "promotion_id",
        CAST("recent_campaign_status" AS VARCHAR) AS "recent_campaign_status",
        CAST("referral_account" AS VARCHAR) AS "referral_account",
        CAST("referral_contact" AS VARCHAR) AS "referral_contact",
        CAST("referral_contact_email" AS VARCHAR) AS "referral_contact_email",
        CAST("referral_first_name" AS VARCHAR) AS "referral_first_name",
        CAST("referral_last_name" AS VARCHAR) AS "referral_last_name",
        CAST("region_c" AS VARCHAR) AS "region_c",
        CAST("reporting_timestamp" AS TIMESTAMP) AS "reporting_timestamp",
        CAST("rerouting_status" AS VARCHAR) AS "rerouting_status",
        CAST("router_status" AS VARCHAR) AS "router_status",
        CAST("sales_email_opt_out_datetime" AS TIMESTAMP) AS "sales_email_opt_out_datetime",
        CAST("sales_insight_hide_date" AS DATE) AS "sales_insight_hide_date",
        CAST("salesloft_cadence_trigger" AS VARCHAR) AS "salesloft_cadence_trigger",
        CAST("salutation" AS VARCHAR) AS "salutation",
        CAST("search_criteria" AS VARCHAR) AS "search_criteria",
        CAST("secondary_email" AS VARCHAR) AS "secondary_email",
        CAST("source_detail" AS VARCHAR) AS "source_detail",
        CAST("state" AS VARCHAR) AS "state",
        CAST("state_code" AS VARCHAR) AS "state_code",
        CAST("state_custom" AS VARCHAR) AS "state_custom",
        CAST("status_info" AS VARCHAR) AS "status_info",
        CAST("street" AS VARCHAR) AS "street",
        CAST("street_address" AS VARCHAR) AS "street_address",
        CAST("technologies" AS VARCHAR) AS "technologies",
        CAST("territory" AS VARCHAR) AS "territory",
        CAST("timeframe" AS VARCHAR) AS "timeframe",
        CAST("trial_start_date" AS DATE) AS "trial_start_date",
        CAST("twitter_url" AS VARCHAR) AS "twitter_url",
        CAST("unique_email" AS VARCHAR) AS "unique_email",
        CAST("up_region_c" AS VARCHAR) AS "up_region_c",
        CAST("user_gems_id" AS VARCHAR) AS "user_gems_id",
        CAST("utm_campaign_c" AS VARCHAR) AS "utm_campaign_c",
        CAST("utm_content_c" AS VARCHAR) AS "utm_content_c",
        CAST("utm_id" AS VARCHAR) AS "utm_id",
        CAST("utm_medium_c" AS VARCHAR) AS "utm_medium_c",
        CAST("utm_source_c" AS VARCHAR) AS "utm_source_c",
        CAST("utm_term_c" AS VARCHAR) AS "utm_term_c",
        CAST("volume_in_millions" AS DECIMAL) AS "volume_in_millions",
        CAST("website" AS VARCHAR) AS "website",
        CAST("zipcode" AS VARCHAR) AS "zipcode",
        CAST("zoominfo_company_id" AS VARCHAR) AS "zoominfo_company_id",
        CAST("zoominfo_contact_id" AS VARCHAR) AS "zoominfo_contact_id",
        CAST("zoominfo_country" AS VARCHAR) AS "zoominfo_country",
        CAST("zoominfo_employee_count" AS INT) AS "zoominfo_employee_count",
        CAST("zoominfo_first_updated" AS TIMESTAMP) AS "zoominfo_first_updated",
        CAST("zoominfo_last_updated" AS TIMESTAMP) AS "zoominfo_last_updated",
        CAST("zoominfo_state" AS VARCHAR) AS "zoominfo_state",
        "zoominfo_technologies"::VARCHAR[] AS "zoominfo_technologies",
        CAST("zoominfo_zip_code" AS VARCHAR) AS "zoominfo_zip_code"
    FROM "sf_lead_data_projected_renamed_cleaned_null"
),

"sf_lead_data_projected_renamed_cleaned_null_casted_missing_handled" AS (
    -- Handling missing values: There are 210 columns with unacceptable missing values
    -- account_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- acquisition_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- acquisition_program has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- acquisition_program_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- acton_city has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- acton_country has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- acton_country_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- acton_postal_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- acton_referrer has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- acton_state has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- all_lead_sources has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- all_utm_campaigns has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- all_utm_mediums has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- all_utm_terms has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- alt_city has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- associated_account has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- associated_group has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- audience_names has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- automation_tracking_status has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- beta_connector_interest has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- bi_tools has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- campaignid_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- city has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- clearbit_status has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- cloudingo_agent_ar has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- cloudingo_agent_ardi has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- cloudingo_agent_atz has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- cloudingo_agent_av has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- company_employee_count has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- company_employee_range has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- company_phone has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- company_revenue has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- company_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- competitors has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- connector_products has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- contact_info has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- contact_owner_override has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- contact_status has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- country has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- country_additional has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- country_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- created_timestamp has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- csi_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- current_user_gems_info has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- demographic_score has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- description has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- device_info has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- direct_office has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- district has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- dnb_company_record has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- dnb_contact_record has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- domain_exists has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- drift_cql_status has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- duns_number has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- email_opt_in has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- email_quality_catchall has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- employee_count has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- engagio_department has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- engagio_engagement_minutes_3m has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- engagio_engagement_minutes_7d has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- engagio_intent_minutes_30d has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- engagio_match_time has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- engagio_matched_account has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- engagio_role has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- enriched_timestamp has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- es_app_escity_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- es_app_escountry_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- es_app_esecid_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- es_app_esindustry_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- es_app_eslinked_in_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- es_app_essource_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- es_app_esstate_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- facebook_url has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- fax has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- feature_requests has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- first_activity has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- first_lead_source has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- first_lead_source_category has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- first_lead_source_detail has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- fit_score has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- geo_country_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- geo_state_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- geocode_accuracy has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- hvr_channel has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- individual_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- inferred_city has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- inferred_company has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- inferred_country has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- inferred_metro_area has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- inferred_phone_area_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- inferred_postal_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- inferred_state_region has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- is_enriched has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- is_previous_customer has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- is_startup has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- isell_os_key_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- jigsaw_contact_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- job_title has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- keywords has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_activity has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_activity_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_lead_source has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_lead_source_category has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_lead_source_detail has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_marketing_channel has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_referenced_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_touchpoint_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_touchpoint_source has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_utm_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_utm_source has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_viewed_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- latitude has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_city has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_comments has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_country_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_creation_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_iq_country_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_iq_state_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_keyword has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_notes has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_postal_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_source has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_source_details has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_state_acton has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_tag has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_url has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_zip_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- legacy_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- linked_in_url_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- linkedin_company_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- linkedin_member_token has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- linkedin_profile has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- longitude has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- marketing_cloud_subscriber has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- marketing_connector_interest has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- marketing_contact_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- marketing_process_stage has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- marketing_system_creation_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- marketo_sync_disabled_reason has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- master_record_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- match_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- matched_account has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- matched_buyer_persona has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- matched_lead has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- mkto_71_lead_score_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- mobile_phone has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- modified_lead_score has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- name has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- needs_score_sync has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- network has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- notes has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- number_of_employees has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- original_source_info has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- original_source_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- phone has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- phone_number_misc has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- pi_campaign_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- pi_score_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- pi_utm_campaign_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- pi_utm_content_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- pi_utm_medium_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- pi_utm_source_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- pi_utm_term_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- postal_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- previous_company has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- previous_contact_info has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- previous_job_title has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- previous_lead_source has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- previous_lead_source_detail has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- promotion_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- recent_campaign_status has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- region_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- rerouting_status has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- router_status has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- sales_insight_hide_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- salutation has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- search_criteria has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- search_index has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- secondary_email has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- source_detail has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- state has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- state_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- state_custom has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- status_info has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- street has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- street_address has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- technologies has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- territory has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- timeframe has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- unique_email has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- up_region_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- user_gems_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- utm_campaign_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- utm_content_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- utm_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- utm_medium_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- utm_source_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- utm_term_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- website has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- zipcode has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- zoominfo_company_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- zoominfo_contact_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- zoominfo_country has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- zoominfo_employee_count has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- zoominfo_first_updated has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- zoominfo_last_updated has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- zoominfo_state has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- zoominfo_technologies has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- zoominfo_zip_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    SELECT
        "last_utm_medium",
        "routing_action",
        "photo_url",
        "is_converted",
        "email_explicit_opt_in",
        "is_emea_event_routing",
        "email_quality",
        "active_in_sequence",
        "is_user_gem",
        "do_not_route_lead",
        "status",
        "email_implicit_opt_in",
        "email_opt_out",
        "manual_routing_trigger",
        "email_double_opt_in",
        "clearbit_ready",
        "last_interaction_description",
        "contact_stage",
        "enrichment_requested",
        "demo_scheduled_calendly",
        "last_name",
        "converted_account_id",
        "id",
        "lead_urgency_value",
        "last_utm_term",
        "email",
        "last_modified_by_id",
        "is_verified",
        "last_interaction_source",
        "behavioral_score",
        "last_interaction_type",
        "startup_eligibility_certified",
        "marketo_sync_disabled",
        "sales_email_opt_out",
        "reporting_matched_account",
        "created_by_clearbit",
        "created_by_user_gems",
        "last_utm_content",
        "is_unread_by_owner",
        "routing_status",
        "bombora_total_composite_score",
        "created_by_id",
        "attended_event",
        "mql_reason",
        "email_bounced_c",
        "prospect_routing_rules",
        "lead_priority_score",
        "converted_contact_id",
        "owner_id",
        "is_deleted",
        "industry",
        "annual_revenue",
        "first_name",
        "fivetran_use_case",
        "intent_score",
        "is_to_delete",
        "is_competitor",
        "company",
        "last_utm_campaign",
        "gdpr_opt_in_status",
        "csi_description",
        "account_all_products",
        "account_bi_tools",
        "account_data_warehouses",
        "act_on_lead_score",
        "ad_group_id",
        "alexa_rank",
        "all_connectors",
        "all_data_warehouses",
        "all_lead_source_categories",
        "all_lead_source_details",
        "all_utm_content",
        "all_utm_ids",
        "all_utm_sources",
        "allbound_id",
        "bizible_2_account",
        "bizible_2_ad_campaign_name_first_touch",
        "bizible_2_ad_campaign_name_last_touch",
        "bizible_2_id",
        "bizible_2_landing_page_first_touch",
        "bizible_2_landing_page_last_touch",
        "bizible_2_marketing_channel_first_touch",
        "bombora_last_update_date",
        "bombora_surge_record_count",
        "bounced_email_c",
        "calendly_creation_date",
        "clarus_date",
        "clarus_editor",
        "clarus_notes",
        "clarus_project",
        "clarus_status",
        "cloudingo_agent_as",
        "cloudingo_agent_les",
        "conversion_date",
        "conversion_object_name",
        "conversion_object_type",
        "converted_date",
        "converted_datetime",
        "converted_opportunity_id",
        "created_date",
        "creative_assets",
        "data_warehouse_products",
        "datawarehouse_used",
        "email_bounced_date",
        "email_bounced_reason",
        "email_opt_out_datetime",
        "engagio_first_engagement_date",
        "first_mql_date",
        "first_search_term",
        "first_search_type",
        "first_touch_url",
        "first_touchpoint_date",
        "first_touchpoint_source",
        "first_utm_campaign",
        "first_utm_content",
        "first_utm_id",
        "first_utm_medium",
        "first_utm_source",
        "first_utm_term",
        "fivetran_account_id",
        "fivetran_account_stage",
        "fivetran_association_date",
        "fivetran_sync_status",
        "fivetran_user_id",
        "fivetran_user_roles",
        "free_trial_confirmation_date",
        "google_click_id",
        "has_changed_job",
        "intent_timestamp",
        "intent_topics",
        "last_completed_salesloft_step",
        "last_interesting_moment_date",
        "last_modified_date",
        "last_modified_timestamp",
        "latest_salesloft_cadence_name",
        "lead_creation_datetime",
        "lead_grade",
        "lead_number_c",
        "lead_relative_score",
        "lead_segment",
        "metadata_creation_date",
        "mql_date",
        "next_salesloft_step_due_date",
        "opportunity_competitors",
        "opportunity_products",
        "original_referrer",
        "original_search_engine",
        "original_search_phrase",
        "original_utm_campaign",
        "original_utm_content",
        "original_utm_medium",
        "original_utm_source",
        "original_utm_term",
        "pardot_hard_bounced",
        "pardot_last_scored_at",
        "partner_rep_email",
        "partner_rep_name",
        "partner_type",
        "past_account",
        "past_user_gems_info",
        "referral_account",
        "referral_contact",
        "referral_contact_email",
        "referral_first_name",
        "referral_last_name",
        "reporting_timestamp",
        "sales_email_opt_out_datetime",
        "salesloft_cadence_trigger",
        "trial_start_date",
        "twitter_url",
        "volume_in_millions"
    FROM "sf_lead_data_projected_renamed_cleaned_null_casted"
)

-- COCOON BLOCK END
SELECT * FROM "sf_lead_data_projected_renamed_cleaned_null_casted_missing_handled"

stg_sf_lead_data.yml (Document the table)

version: 2
models:
- name: stg_sf_lead_data
  description: The table is about leads in a sales/marketing context. It contains
    detailed information on potential customers, including personal details, contact
    information, lead source, conversion status, and various tracking and scoring
    metrics. The table also includes fields for marketing campaigns, account associations,
    and custom fields for specific business processes.
  columns:
  - name: last_utm_medium
    description: Most recent UTM medium
    tests:
    - not_null
    - accepted_values:
        values:
        - paid_social
        - paid_search
        - display
        - email
        - affiliate
        - referral
        - organic_social
        - organic_search
        - direct
        - video
        - cpc
        - ppc
        - banner
        - retargeting
        - push_notification
        - sms
        - qr_code
  - name: routing_action
    description: Routing action taken in LeanData
    tests:
    - not_null
    - accepted_values:
        values:
        - converted
        - routed
        - rejected
        - held
        - recycled
        - merged
        - ignored
        - assigned
        - round_robin
        - load_balanced
        - manual_assignment
  - name: photo_url
    description: URL of the lead's photo
    tests:
    - not_null
  - name: is_converted
    description: Indicates if the lead has been converted
    tests:
    - not_null
  - name: email_explicit_opt_in
    description: Explicit email opt-in status
    tests:
    - not_null
  - name: is_emea_event_routing
    description: EMEA event routing status
    tests:
    - not_null
  - name: email_quality
    description: Email quality indicator
    tests:
    - not_null
  - name: active_in_sequence
    description: Indicates if lead is active in a sequence
    tests:
    - not_null
  - name: is_user_gem
    description: Indicates if the lead is a user gem
    tests:
    - not_null
  - name: do_not_route_lead
    description: Indicates if lead should not be routed
    tests:
    - not_null
  - name: status
    description: Current status of the lead
    tests:
    - not_null
    - accepted_values:
        values:
        - New
        - Contacted
        - Qualified
        - Proposal Sent
        - Negotiation
        - Converted
        - Lost
        - On Hold
        - Nurturing
        - Unqualified
  - name: email_implicit_opt_in
    description: Implicit email opt-in status
    tests:
    - not_null
  - name: email_opt_out
    description: Indicates if lead opted out of emails
    tests:
    - not_null
  - name: manual_routing_trigger
    description: Manual routing trigger status
    tests:
    - not_null
  - name: email_double_opt_in
    description: Double opt-in status for email
    tests:
    - not_null
  - name: clearbit_ready
    description: Indicates if ready for Clearbit enrichment
    tests:
    - not_null
  - name: last_interaction_description
    description: Description of last significant lead interaction
    tests:
    - not_null
  - name: contact_stage
    description: Stage of contact in sales process
    tests:
    - not_null
    - accepted_values:
        values:
        - Prospect
        - Lead
        - Qualified Lead
        - Opportunity
        - Proposal
        - Negotiation
        - Closed Won/Lost
  - name: enrichment_requested
    description: Flag for data enrichment request
    tests:
    - not_null
  - name: demo_scheduled_calendly
    description: Demo scheduled via Calendly
    tests:
    - not_null
  - name: last_name
    description: Last name of the lead
    tests:
    - not_null
  - name: converted_account_id
    description: ID of account after lead conversion
    tests:
    - not_null
  - name: id
    description: ''
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column appears to be a unique identifier for each lead. For
        this table, each row represents a unique lead, and the id is likely to be
        unique across rows.
  - name: lead_urgency_value
    description: Urgency value of the lead
    tests:
    - not_null
  - name: last_utm_term
    description: Most recent UTM term
    tests:
    - not_null
  - name: email
    description: Email address of the lead
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: Email addresses are typically unique for each individual. In a lead
        management system, it's common to use email as a unique identifier. However,
        there's a small possibility of duplicate emails for different leads.
  - name: last_modified_by_id
    description: ID of user who last modified the lead
    tests:
    - not_null
  - name: is_verified
    description: Indicates if the lead is verified
    tests:
    - not_null
  - name: last_interaction_source
    description: Source of last significant lead interaction
    tests:
    - not_null
    - accepted_values:
        values:
        - Lead action
        - Email
        - Phone call
        - Meeting
        - Website visit
        - Social media
        - Webinar
        - Event
        - Chat
        - Form submission
        - Referral
        - Direct mail
        - SMS
        - Video call
        - Demo
        - Trial signup
        - Purchase
        - Support ticket
        - Survey response
        - Newsletter subscription
  - name: behavioral_score
    description: Behavioral score of the lead
    tests:
    - not_null
  - name: last_interaction_type
    description: Type of last significant lead interaction
    tests:
    - not_null
    - accepted_values:
        values:
        - Milestone
        - Phone Call
        - Email
        - Meeting
        - Demo
        - Proposal
        - Contract Sent
        - Contract Signed
        - Follow-up
        - Webinar
        - Trade Show
        - Social Media Interaction
        - Website Visit
        - Content Download
        - Referral
        - Customer Support Interaction
        - Survey Response
        - Product Trial
        - Quote Request
        - Abandoned Cart
  - name: startup_eligibility_certified
    description: Startup eligibility certification status
    tests:
    - not_null
  - name: marketo_sync_disabled
    description: Flag to prevent syncing with Marketo
    tests:
    - not_null
  - name: sales_email_opt_out
    description: Indicates if lead opted out of sales emails
    tests:
    - not_null
  - name: reporting_matched_account
    description: Matched account for reporting purposes
    tests:
    - not_null
  - name: created_by_clearbit
    description: Indicates if created by Clearbit
    tests:
    - not_null
  - name: created_by_user_gems
    description: Indicates if created by User Gems
    tests:
    - not_null
  - name: last_utm_content
    description: Most recent UTM content
    tests:
    - not_null
  - name: is_unread_by_owner
    description: Indicates if the lead is unread by owner
    tests:
    - not_null
  - name: routing_status
    description: Routing status in LeanData
    tests:
    - not_null
    - accepted_values:
        values:
        - converted
        - pending
        - in_progress
        - qualified
        - unqualified
        - routed
        - failed
        - on_hold
        - rejected
        - recycled
  - name: bombora_total_composite_score
    description: Total Bombora composite score
    cocoon_meta:
      missing_acceptable: Not applicable if not using Bombora intent data.
  - name: created_by_id
    description: ID of user who created the lead
    tests:
    - not_null
  - name: attended_event
    description: Indicates if lead attended an event
    tests:
    - not_null
  - name: mql_reason
    description: Reason for Marketing Qualified Lead status
    tests:
    - not_null
    - accepted_values:
        values:
        - Website
        - Email Campaign
        - Social Media
        - Webinar
        - Trade Show
        - Referral
        - Content Download
        - Free Trial
        - Demo Request
        - Contact Form
        - Phone Inquiry
        - Chat
        - Partner
        - Paid Advertisement
        - Organic Search
        - Blog
        - Whitepaper
        - Case Study
        - Newsletter Signup
        - Product Review
  - name: email_bounced_c
    description: ''
    tests:
    - not_null
  - name: prospect_routing_rules
    description: Routing rules for marketing prospects
    tests:
    - not_null
  - name: lead_priority_score
    description: Priority score of the lead
    tests:
    - not_null
  - name: converted_contact_id
    description: ID of contact after lead conversion
    tests:
    - not_null
  - name: owner_id
    description: ID of the lead owner
    tests:
    - not_null
  - name: is_deleted
    description: Indicates if the lead has been deleted
    tests:
    - not_null
  - name: industry
    description: Industry of the lead's company
    tests:
    - not_null
  - name: annual_revenue
    description: Annual revenue of the account
    tests:
    - not_null
  - name: first_name
    description: First name of the lead
    tests:
    - not_null
  - name: fivetran_use_case
    description: Potential use case for Fivetran
    tests:
    - not_null
  - name: intent_score
    description: Aggregate score of lead's intent
    cocoon_meta:
      missing_acceptable: No intent data available for this lead
  - name: is_to_delete
    description: Flag indicating if the record should be deleted
    tests:
    - not_null
  - name: is_competitor
    description: Indicates if company is a competitor
    tests:
    - not_null
  - name: company
    description: Company name of the lead
    tests:
    - not_null
  - name: last_utm_campaign
    description: Most recent UTM campaign
    tests:
    - not_null
  - name: gdpr_opt_in_status
    description: Explicit GDPR opt-in status
    tests:
    - not_null
  - name: csi_description
    description: Description of CSI code
    tests:
    - not_null
  - name: account_all_products
    description: All products associated with the account
    tests:
    - not_null
  - name: account_bi_tools
    description: Business Intelligence tools used by the account
    tests:
    - not_null
  - name: account_data_warehouses
    description: Data warehouses used by the account
    tests:
    - not_null
  - name: act_on_lead_score
    description: Lead score for Act-On marketing automation
    cocoon_meta:
      missing_acceptable: Not applicable if lead scoring system isn't used.
  - name: ad_group_id
    description: Ad group identifier for the lead
    cocoon_meta:
      missing_acceptable: Not applicable if not using paid advertising campaigns.
  - name: alexa_rank
    description: Alexa rank from external source
    cocoon_meta:
      missing_acceptable: Not applicable for websites not ranked by Alexa.
  - name: all_connectors
    description: All connectors associated with the account
    tests:
    - not_null
  - name: all_data_warehouses
    description: All data warehouses associated with the account
    tests:
    - not_null
  - name: all_lead_source_categories
    description: Categories of all lead sources
    tests:
    - not_null
  - name: all_lead_source_details
    description: Detailed information for all lead sources
    tests:
    - not_null
  - name: all_utm_content
    description: All UTM content values for lead
    tests:
    - not_null
  - name: all_utm_ids
    description: All UTM IDs associated with lead
    tests:
    - not_null
  - name: all_utm_sources
    description: All UTM sources associated with lead
    tests:
    - not_null
  - name: allbound_id
    description: Unique identifier in Allbound platform
    cocoon_meta:
      missing_acceptable: Not applicable if not using Allbound partner management
        platform.
  - name: bizible_2_account
    description: Bizible 2 associated account
    cocoon_meta:
      missing_acceptable: Not applicable if not using Bizible marketing analytics.
  - name: bizible_2_ad_campaign_name_first_touch
    description: Bizible 2 ad campaign name (first touch)
    cocoon_meta:
      missing_acceptable: Not applicable if no Bizible-tracked ad interactions.
  - name: bizible_2_ad_campaign_name_last_touch
    description: Bizible 2 ad campaign name (last touch)
    cocoon_meta:
      missing_acceptable: Not applicable if no Bizible-tracked ad interactions.
  - name: bizible_2_id
    description: Bizible 2 unique identifier
    cocoon_meta:
      missing_acceptable: Not applicable if not using Bizible marketing analytics.
  - name: bizible_2_landing_page_first_touch
    description: Bizible 2 landing page (first touch)
    cocoon_meta:
      missing_acceptable: Not applicable if no Bizible-tracked website visits.
  - name: bizible_2_landing_page_last_touch
    description: Bizible 2 landing page (last touch)
    cocoon_meta:
      missing_acceptable: Not applicable if no Bizible-tracked website visits.
  - name: bizible_2_marketing_channel_first_touch
    description: Bizible 2 marketing channel (first touch)
    cocoon_meta:
      missing_acceptable: Not applicable if no Bizible-tracked marketing interactions.
  - name: bombora_last_update_date
    description: Last update date from Bombora
    cocoon_meta:
      missing_acceptable: Not applicable if not using Bombora intent data.
  - name: bombora_surge_record_count
    description: Number of Bombora surge records
    cocoon_meta:
      missing_acceptable: Not applicable if not using Bombora intent data.
  - name: bounced_email_c
    description: ''
    cocoon_meta:
      missing_acceptable: Not applicable if no email campaigns sent.
  - name: calendly_creation_date
    description: Date created in Calendly
    cocoon_meta:
      missing_acceptable: Not applicable if Calendly wasn't used for scheduling.
  - name: clarus_date
    description: Date related to Clarus project
    cocoon_meta:
      missing_acceptable: Not applicable if Clarus project wasn't initiated.
  - name: clarus_editor
    description: Editor of Clarus project
    cocoon_meta:
      missing_acceptable: Not applicable if Clarus project wasn't initiated.
  - name: clarus_notes
    description: Notes for Clarus project
    cocoon_meta:
      missing_acceptable: Not applicable if Clarus project wasn't initiated.
  - name: clarus_project
    description: Associated Clarus project
    cocoon_meta:
      missing_acceptable: Not applicable if Clarus project wasn't initiated.
  - name: clarus_status
    description: Status of Clarus project
    cocoon_meta:
      missing_acceptable: Not applicable if Clarus project wasn't initiated.
  - name: cloudingo_agent_as
    description: Cloudingo agent AS field
    tests:
    - not_null
  - name: cloudingo_agent_les
    description: Cloudingo agent LES field
    tests:
    - not_null
    - accepted_values:
        values:
        - '0'
        - '1'
  - name: conversion_date
    description: Date when the lead converted
    cocoon_meta:
      missing_acceptable: Not applicable if lead hasn't been converted yet.
  - name: conversion_object_name
    description: Name of the object after conversion
    cocoon_meta:
      missing_acceptable: Not applicable if lead hasn't been converted yet.
  - name: conversion_object_type
    description: Type of object after conversion
    cocoon_meta:
      missing_acceptable: Not applicable if lead hasn't been converted yet.
  - name: converted_date
    description: Date of lead conversion
    tests:
    - not_null
  - name: converted_datetime
    description: Date and time of lead conversion
    tests:
    - not_null
  - name: converted_opportunity_id
    description: ID of opportunity after lead conversion
    cocoon_meta:
      missing_acceptable: Not applicable if lead hasn't been converted to opportunity.
  - name: created_date
    description: Date when the lead was created
    tests:
    - not_null
  - name: creative_assets
    description: Information about creative assets
    cocoon_meta:
      missing_acceptable: Not applicable if no creative assets were used.
  - name: data_warehouse_products
    description: Data warehouse products information
    cocoon_meta:
      missing_acceptable: Not applicable if no data warehouse products are used.
  - name: datawarehouse_used
    description: Indicates if data warehouse is used
    cocoon_meta:
      missing_acceptable: Not applicable if no data warehouse is used.
  - name: email_bounced_date
    description: Date when email bounced
    cocoon_meta:
      missing_acceptable: Not applicable if email hasn't bounced.
  - name: email_bounced_reason
    description: Reason for email bounce
    cocoon_meta:
      missing_acceptable: Not applicable if email hasn't bounced.
  - name: email_opt_out_datetime
    description: Date and time of email opt-out
    cocoon_meta:
      missing_acceptable: Not applicable if user hasn't opted out.
  - name: engagio_first_engagement_date
    description: Date of first engagement in Engagio
    cocoon_meta:
      missing_acceptable: Not applicable if no engagement has occurred yet.
  - name: first_mql_date
    description: Date when lead first became MQL
    cocoon_meta:
      missing_acceptable: Not applicable if lead hasn't become MQL yet.
  - name: first_search_term
    description: First search term used by the lead
    cocoon_meta:
      missing_acceptable: No search performed by the lead
  - name: first_search_type
    description: Type of first search performed by lead
    cocoon_meta:
      missing_acceptable: No search performed by the lead
  - name: first_touch_url
    description: First URL interacted with by lead
    cocoon_meta:
      missing_acceptable: No website interaction recorded for the lead
  - name: first_touchpoint_date
    description: First touchpoint date
    cocoon_meta:
      missing_acceptable: No first touchpoint recorded for the lead
  - name: first_touchpoint_source
    description: First touchpoint source
    cocoon_meta:
      missing_acceptable: No first touchpoint recorded for the lead
  - name: first_utm_campaign
    description: First UTM campaign associated with lead
    cocoon_meta:
      missing_acceptable: No UTM parameters used in lead acquisition
  - name: first_utm_content
    description: First UTM content value for lead
    cocoon_meta:
      missing_acceptable: No UTM parameters used in lead acquisition
  - name: first_utm_id
    description: First UTM ID associated with lead
    cocoon_meta:
      missing_acceptable: No UTM parameters used in lead acquisition
  - name: first_utm_medium
    description: First UTM medium used by the lead
    cocoon_meta:
      missing_acceptable: No UTM parameters used in lead acquisition
  - name: first_utm_source
    description: First UTM source used by the lead
    cocoon_meta:
      missing_acceptable: No UTM parameters used in lead acquisition
  - name: first_utm_term
    description: First UTM term used by the lead
    cocoon_meta:
      missing_acceptable: No UTM parameters used in lead acquisition
  - name: fivetran_account_id
    description: Fivetran account ID
    cocoon_meta:
      missing_acceptable: Lead not associated with a Fivetran account
  - name: fivetran_account_stage
    description: Stage of the Fivetran account
    cocoon_meta:
      missing_acceptable: Lead not associated with a Fivetran account
  - name: fivetran_association_date
    description: Date of Fivetran account association
    cocoon_meta:
      missing_acceptable: Lead not associated with a Fivetran account
  - name: fivetran_sync_status
    description: Fivetran sync status indicator
    cocoon_meta:
      missing_acceptable: Lead not associated with a Fivetran account
  - name: fivetran_user_id
    description: Fivetran user identifier
    cocoon_meta:
      missing_acceptable: Lead not associated with a Fivetran account
  - name: fivetran_user_roles
    description: User roles in Fivetran account
    cocoon_meta:
      missing_acceptable: Lead not associated with a Fivetran account
  - name: free_trial_confirmation_date
    description: Date when free trial email was confirmed
    cocoon_meta:
      missing_acceptable: Lead has not started a free trial
  - name: google_click_id
    description: Google Click ID for tracking ad clicks
    cocoon_meta:
      missing_acceptable: Lead not acquired through Google Ads
  - name: has_changed_job
    description: Indicates if the lead has changed jobs
    cocoon_meta:
      missing_acceptable: No job change information available for lead
  - name: intent_timestamp
    description: Timestamp of last intent score update
    cocoon_meta:
      missing_acceptable: No intent data available for this lead
  - name: intent_topics
    description: Topics of interest for the lead
    cocoon_meta:
      missing_acceptable: No intent data available for this lead
  - name: last_completed_salesloft_step
    description: Last completed step in SalesLoft cadence
    cocoon_meta:
      missing_acceptable: Not applicable if not using Salesloft platform
  - name: last_interesting_moment_date
    description: Date of last interesting moment in Sales Insight
    tests:
    - not_null
  - name: last_modified_date
    description: Date when the lead was last modified
    tests:
    - not_null
  - name: last_modified_timestamp
    description: Last modification timestamp
    tests:
    - not_null
  - name: latest_salesloft_cadence_name
    description: Name of most recent SalesLoft cadence
    cocoon_meta:
      missing_acceptable: Not applicable if not using Salesloft platform
  - name: lead_creation_datetime
    description: Date and time when the lead was created
    tests:
    - not_null
  - name: lead_grade
    description: Grade assigned to the lead
    cocoon_meta:
      missing_acceptable: Not applicable if lead grading system isn't used
  - name: lead_number_c
    description: ''
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This appears to be a custom field that might serve as a unique identifier
        for leads. If it's implemented as an auto-incrementing number or a unique
        code for each lead, it could be a candidate key.
  - name: lead_relative_score
    description: Relative score value of the lead
    cocoon_meta:
      missing_acceptable: Not applicable if lead scoring system isn't used
  - name: lead_segment
    description: Segment of the lead in LeanData
    cocoon_meta:
      missing_acceptable: Not applicable if lead segmentation isn't implemented
  - name: metadata_creation_date
    description: Date when the metadata was created
    tests:
    - not_null
  - name: mql_date
    description: Date when lead became Marketing Qualified
    cocoon_meta:
      missing_acceptable: Not applicable if lead hasn't become MQL yet.
  - name: next_salesloft_step_due_date
    description: Due date for next SalesLoft cadence step
    cocoon_meta:
      missing_acceptable: Not applicable if lead isn't in SalesLoft process.
  - name: opportunity_competitors
    description: Competitors associated with the opportunity
    cocoon_meta:
      missing_acceptable: Not applicable if no opportunity has been created yet.
  - name: opportunity_products
    description: Products associated with the opportunity
    cocoon_meta:
      missing_acceptable: Not applicable if no opportunity has been created yet.
  - name: original_referrer
    description: Original referrer of the lead
    cocoon_meta:
      missing_acceptable: Not applicable if lead didn't come from a referral.
  - name: original_search_engine
    description: Original search engine used by the lead
    cocoon_meta:
      missing_acceptable: Not applicable if lead didn't come from a search engine.
  - name: original_search_phrase
    description: Original search phrase used by the lead
    cocoon_meta:
      missing_acceptable: Not applicable if lead didn't come from a search.
  - name: original_utm_campaign
    description: Original UTM campaign parameter
    cocoon_meta:
      missing_acceptable: Not applicable if lead didn't come from UTM-tracked campaign.
  - name: original_utm_content
    description: Original UTM content parameter
    cocoon_meta:
      missing_acceptable: Not applicable if lead didn't come from UTM-tracked content.
  - name: original_utm_medium
    description: Original UTM medium parameter
    cocoon_meta:
      missing_acceptable: Not applicable if lead didn't come from UTM-tracked medium.
  - name: original_utm_source
    description: Original UTM source parameter
    cocoon_meta:
      missing_acceptable: Not applicable if lead didn't come from UTM-tracked source.
  - name: original_utm_term
    description: Original UTM term parameter
    cocoon_meta:
      missing_acceptable: Not applicable if lead didn't come from UTM-tracked term.
  - name: pardot_hard_bounced
    description: Indicator if Pardot email hard bounced
    cocoon_meta:
      missing_acceptable: Only applicable if email was sent and bounced
  - name: pardot_last_scored_at
    description: Last time lead was scored in Pardot
    cocoon_meta:
      missing_acceptable: Only applicable if Pardot scoring is used
  - name: partner_rep_email
    description: Email of partner representative
    cocoon_meta:
      missing_acceptable: Only applicable for partner-referred leads
  - name: partner_rep_name
    description: Name of partner representative
    cocoon_meta:
      missing_acceptable: Only applicable for partner-referred leads
  - name: partner_type
    description: Type of partner
    cocoon_meta:
      missing_acceptable: Only applicable for partner-referred leads
  - name: past_account
    description: Past account information of the lead
    cocoon_meta:
      missing_acceptable: Only applicable if contact had a previous account
  - name: past_user_gems_info
    description: Past information from User Gems
    cocoon_meta:
      missing_acceptable: Only applicable if user previously had gems
  - name: referral_account
    description: Account that referred the lead
    cocoon_meta:
      missing_acceptable: Only applicable for referred leads
  - name: referral_contact
    description: Contact who referred the lead
    cocoon_meta:
      missing_acceptable: Only applicable for referred leads
  - name: referral_contact_email
    description: Email of the contact who referred the lead
    cocoon_meta:
      missing_acceptable: Only applicable for referred leads
  - name: referral_first_name
    description: First name of the person who referred
    cocoon_meta:
      missing_acceptable: Only applicable for referred leads
  - name: referral_last_name
    description: Last name of the person who referred
    cocoon_meta:
      missing_acceptable: Only applicable for referred leads
  - name: reporting_timestamp
    description: Timestamp for reporting purposes
    tests:
    - not_null
  - name: sales_email_opt_out_datetime
    description: Date and time of sales email opt-out
    cocoon_meta:
      missing_acceptable: Only applicable if opted out of sales emails
  - name: salesloft_cadence_trigger
    description: Trigger for SalesLoft cadence
    cocoon_meta:
      missing_acceptable: Only applicable if SalesLoft integration is used
  - name: trial_start_date
    description: Start date of trial contact
    cocoon_meta:
      missing_acceptable: Company might not have started a trial.
  - name: twitter_url
    description: Twitter profile URL
    cocoon_meta:
      missing_acceptable: Company might not have a Twitter account.
  - name: volume_in_millions
    description: Volume in millions (possibly revenue or sales)
    tests:
    - not_null

stg_sf_user_data (first 100 rows)

full_name first_name phone manager_id small_banner_url community_nickname group_notification_frequency last_name forecast_enabled username user_alias banner_photo_url medium_banner_url email_encoding_key badge_text auto_bcc_enabled is_photo_active profile_id _fivetran_active locale_key role_id small_photo_url is_active receives_admin_emails user_type user_time_zone is_deleted user_id receives_info_emails email full_photo_url delegated_approver_id last_login last_referenced last_viewed secondary_id
0 Brandon Zinn VL0FVo9TB+culjkuqg52bQ== None tfjEwBIFrT7IKUXp/ObBNA== 2ERJSzi6mHg8kR1RS4zqig== zYOn49YYBw9z+c1AbjrzcA== jZwwfLfzxKMoIqUZItHOqg== 1NZWXYLqo5CiFyFOT2EBJA== True xv6xgJYOh/ZMPRNDPbzueQ== D4b1Qin+gQP3CpRZBVVTzw== +ZTO2mf2LuH+iHMMN5CTbA== Aah0gJhzMf8W4MSufRJi5w== Dku078MOwSnlADoY6iEDzw== 1B2M2Y8AsgTpgAmY7PhCfg== True False q+POjJLmN0AEkFmTx/DVmg== True cQlcVsZB8sSk8Ym53816OA== BK8ye8s2vCtRuIzk3Iy7Og== +Rxw9GW0v2EzZhKzJjofjA== True False 622K5vICg3VbM5wNwnOYiw== c8PRyKwR7IqEd0+3VZY6gQ== False 0051G00000600MlQAI False G5JZeErb0oYU8jQrAJylYw== fm397Qb0Cp93iLEx/qKV2g== None 2019-08-05 18:13:35 NaT NaT None
1 Eric Welsh d9zVVfOLll0iChOjuwgCYA== None TLZtnkcZltX8lijWYSQqRg== 2ERJSzi6mHg8kR1RS4zqig== busRLQgm3BlE5gft7AXW5Q== jZwwfLfzxKMoIqUZItHOqg== u7D6SbUlxCZPStegatw+Bw== True Iqqj3G/cliOsvvTCAdP+TA== gpl2aeOp9ql5nOAs+5gF9A== +ZTO2mf2LuH+iHMMN5CTbA== Aah0gJhzMf8W4MSufRJi5w== Dku078MOwSnlADoY6iEDzw== 1B2M2Y8AsgTpgAmY7PhCfg== True False 0XwCP3LN1EcBDVvCIK3NCw== True cQlcVsZB8sSk8Ym53816OA== aDWPUItc1uc9iqJvMkP82Q== +Rxw9GW0v2EzZhKzJjofjA== True False 622K5vICg3VbM5wNwnOYiw== eobciA3TwKWJw+xVP4bGaQ== False 0051G000005Mx8dQAC False cwB0dYdfvqwxMf4ilgNByw== fm397Qb0Cp93iLEx/qKV2g== TLZtnkcZltX8lijWYSQqRg== 2019-11-26 19:46:44 NaT NaT None
2 Saurabh Kapadia JMGykJnIdJGUeW3++LUKQA== None TLZtnkcZltX8lijWYSQqRg== 2ERJSzi6mHg8kR1RS4zqig== j74RDGGp6qpCT9+y75BpbQ== jZwwfLfzxKMoIqUZItHOqg== 89+z/rKPszB4G/pKIw1fAw== False yFjyN6ai5qiWqyS6fBWBkw== decEUNZtz8K0/rVaHGGx6w== +ZTO2mf2LuH+iHMMN5CTbA== Aah0gJhzMf8W4MSufRJi5w== Dku078MOwSnlADoY6iEDzw== 1B2M2Y8AsgTpgAmY7PhCfg== True False QvzqVksmGmwST2MANzS9Nw== True cQlcVsZB8sSk8Ym53816OA== aDWPUItc1uc9iqJvMkP82Q== +Rxw9GW0v2EzZhKzJjofjA== True False 622K5vICg3VbM5wNwnOYiw== eobciA3TwKWJw+xVP4bGaQ== False 00555000003F3Q6AAK False aJCyq0bMBmwFIa7BYuGaqg== fm397Qb0Cp93iLEx/qKV2g== None 2019-11-16 00:13:23 NaT NaT None
3 Jodie Navarre prRu04oqXV0uNf6Lo1Va6w== GiIWsKPHcUq7qMJlqOKAWQ== TLZtnkcZltX8lijWYSQqRg== 2ERJSzi6mHg8kR1RS4zqig== io7DTej1IHP8rPTJdKfOoA== jZwwfLfzxKMoIqUZItHOqg== HqQOq8TX4AO/sIuPSgR2Ug== True veeuTX4ZgDX/1UVD/ZGfpA== prRu04oqXV0uNf6Lo1Va6w== +ZTO2mf2LuH+iHMMN5CTbA== Aah0gJhzMf8W4MSufRJi5w== Dku078MOwSnlADoY6iEDzw== 1B2M2Y8AsgTpgAmY7PhCfg== True False QvzqVksmGmwST2MANzS9Nw== False cQlcVsZB8sSk8Ym53816OA== aDWPUItc1uc9iqJvMkP82Q== +Rxw9GW0v2EzZhKzJjofjA== True True 622K5vICg3VbM5wNwnOYiw== c8PRyKwR7IqEd0+3VZY6gQ== False 00537000004EpGKAA0 True ZLYqq+RDyk6Te7xVdheciA== fm397Qb0Cp93iLEx/qKV2g== None 2019-11-12 16:48:38 NaT NaT None
4 Nomadmktg /gHwN0rApZymtoP6fxl3XA== None TLZtnkcZltX8lijWYSQqRg== 2ERJSzi6mHg8kR1RS4zqig== abkaAGpuJILYJ9hOA4Be0g== jZwwfLfzxKMoIqUZItHOqg== /gHwN0rApZymtoP6fxl3XA== True A/y3WQRrjTc0Q6xbsGmujA== RghnQ3IiPoK6c2tbUocbPw== +ZTO2mf2LuH+iHMMN5CTbA== Aah0gJhzMf8W4MSufRJi5w== Dku078MOwSnlADoY6iEDzw== 1B2M2Y8AsgTpgAmY7PhCfg== True False QvzqVksmGmwST2MANzS9Nw== True cQlcVsZB8sSk8Ym53816OA== a21b1bWPBhKAAug5Jxk73g== +Rxw9GW0v2EzZhKzJjofjA== True True 622K5vICg3VbM5wNwnOYiw== eobciA3TwKWJw+xVP4bGaQ== False 00537000004jJQPAA2 True 7Q1bgZpigij+8LTy229aww== fm397Qb0Cp93iLEx/qKV2g== None 2019-11-12 20:09:24 NaT NaT None
5 Artyom Vasilyev tkqLcoeCxxgs6yI4gT/9yw== None None 2ERJSzi6mHg8kR1RS4zqig== tkqLcoeCxxgs6yI4gT/9yw== jZwwfLfzxKMoIqUZItHOqg== lmOrvYek51oJsBc+3v9rSA== False sfr1qhkoa01jph0cN406sA== hzoNezv89sMonh/jHBrCNg== +ZTO2mf2LuH+iHMMN5CTbA== Aah0gJhzMf8W4MSufRJi5w== Dku078MOwSnlADoY6iEDzw== 1B2M2Y8AsgTpgAmY7PhCfg== True False b/9XvWwwuZ6GthzYSc/fmg== True cQlcVsZB8sSk8Ym53816OA== None 2+OnpJlgo7jyGDcvqrluzA== True False 622K5vICg3VbM5wNwnOYiw== eobciA3TwKWJw+xVP4bGaQ== True 005q0000004XRtzAAG False 46l0uz6Yx0/A9LYo0WpgXg== M3gnKLhZJGDc/r8mEFKtKA== None 2019-03-14 19:00:29 NaT NaT None
6 None ouSCKpgzcoPjn3tgrPheyQ== None None 2ERJSzi6mHg8kR1RS4zqig== otDd6eocvI7CTXTEE6iX8Q== jZwwfLfzxKMoIqUZItHOqg== 4mhEPkPZPat+vvMDu+lkLw== False BrgwJpKXta8Zj4di1C7DFQ== 6OrI2Np3L4GCar2dFYxWZQ== +ZTO2mf2LuH+iHMMN5CTbA== Aah0gJhzMf8W4MSufRJi5w== Dku078MOwSnlADoY6iEDzw== 1B2M2Y8AsgTpgAmY7PhCfg== True False U4E6aqzPODD0RiUPm3B8rA== True cQlcVsZB8sSk8Ym53816OA== None 2+OnpJlgo7jyGDcvqrluzA== False False 622K5vICg3VbM5wNwnOYiw== c8PRyKwR7IqEd0+3VZY6gQ== True 005q0000004k6QEAAY False 6rfEElWza4sHeeyzP0TXBQ== M3gnKLhZJGDc/r8mEFKtKA== None NaT NaT NaT None
7 Justin Clark BkdRdNki59y7PtNMAjbb3w== None None 2ERJSzi6mHg8kR1RS4zqig== U92cYAXzzfxaacXAc4gBbQ== jZwwfLfzxKMoIqUZItHOqg== qX/tvOMOz7xfd/I3ibDuAA== False rzM8hF45+JLWxiSDOYlwUQ== Xax7nNae5oQ3kWF4QHq/rQ== +ZTO2mf2LuH+iHMMN5CTbA== Aah0gJhzMf8W4MSufRJi5w== Dku078MOwSnlADoY6iEDzw== 1B2M2Y8AsgTpgAmY7PhCfg== True False U4E6aqzPODD0RiUPm3B8rA== False cQlcVsZB8sSk8Ym53816OA== 7IHceHBUAWjctCBt2VZXiA== 2+OnpJlgo7jyGDcvqrluzA== True False 622K5vICg3VbM5wNwnOYiw== c8PRyKwR7IqEd0+3VZY6gQ== True 005q0000004k6NjAAI False scEwenaKqevd6yTLT1ltpw== M3gnKLhZJGDc/r8mEFKtKA== None NaT NaT NaT None
8 Christian Kletzl 22AXvR8nEY1ECDoXKoJAnw== None TLZtnkcZltX8lijWYSQqRg== 2ERJSzi6mHg8kR1RS4zqig== lG3Ke8bREpt0SeoDgN/3+g== jZwwfLfzxKMoIqUZItHOqg== E15NIN/JJbyu6RY90uJ5NQ== False AMmh7ibU+xNFUG7Q5Fc2Tw== HWRtNym1u++RiSIY/YATyg== +ZTO2mf2LuH+iHMMN5CTbA== Aah0gJhzMf8W4MSufRJi5w== Dku078MOwSnlADoY6iEDzw== 1B2M2Y8AsgTpgAmY7PhCfg== True False QvzqVksmGmwST2MANzS9Nw== True cQlcVsZB8sSk8Ym53816OA== aDWPUItc1uc9iqJvMkP82Q== 2+OnpJlgo7jyGDcvqrluzA== True False 622K5vICg3VbM5wNwnOYiw== eobciA3TwKWJw+xVP4bGaQ== True 005q00000053KTAAA2 False AMmh7ibU+xNFUG7Q5Fc2Tw== M3gnKLhZJGDc/r8mEFKtKA== None 2019-04-01 22:38:13 2019-03-11 22:30:18 2019-03-11 22:30:18 None
9 Andrey Lukyanov vWwLXUQeD7u9IvmI79ThcQ== None None 2ERJSzi6mHg8kR1RS4zqig== cpjVy4nqrYDiBsDMqUD08g== jZwwfLfzxKMoIqUZItHOqg== qwtVcSBsz2/Q9KWmP9i1jA== False c7ZgbZS/+xi/ESP1ey4+eA== +PsAbGnYCR23KLQiekSsJQ== +ZTO2mf2LuH+iHMMN5CTbA== Aah0gJhzMf8W4MSufRJi5w== Dku078MOwSnlADoY6iEDzw== 1B2M2Y8AsgTpgAmY7PhCfg== True False QvzqVksmGmwST2MANzS9Nw== True cQlcVsZB8sSk8Ym53816OA== aDWPUItc1uc9iqJvMkP82Q== 2+OnpJlgo7jyGDcvqrluzA== True False 622K5vICg3VbM5wNwnOYiw== eobciA3TwKWJw+xVP4bGaQ== True 005q00000053uuWAAQ False nU9FSqobhYTBGN9rJR2Khw== M3gnKLhZJGDc/r8mEFKtKA== None 2019-03-29 18:46:02 NaT NaT None

stg_sf_user_data.sql (clean the table)

-- COCOON BLOCK START: PLEASE DO NOT MODIFY THIS BLOCK FOR SELF-MAINTENANCE
WITH 
"sf_user_data_projected" AS (
    -- Projection: Selecting 65 out of 66 columns
    -- Columns projected out: ['_fivetran_synced']
    SELECT 
        "_fivetran_deleted",
        "about_me",
        "account_id",
        "alias",
        "badge_text",
        "banner_photo_url",
        "call_center_id",
        "city",
        "community_nickname",
        "company_name",
        "contact_id",
        "country",
        "country_code",
        "default_group_notification_frequency",
        "delegated_approver_id",
        "department",
        "digest_frequency",
        "division",
        "email",
        "email_encoding_key",
        "email_preferences_auto_bcc",
        "employee_number",
        "extension",
        "fax",
        "federation_identifier",
        "first_name",
        "forecast_enabled",
        "full_photo_url",
        "geocode_accuracy",
        "id",
        "individual_id",
        "is_active",
        "is_profile_photo_active",
        "language_locale_key",
        "last_login_date",
        "last_name",
        "last_referenced_date",
        "last_viewed_date",
        "latitude",
        "locale_sid_key",
        "longitude",
        "manager_id",
        "medium_banner_photo_url",
        "mobile_phone",
        "name",
        "offline_trial_expiration_date",
        "phone",
        "postal_code",
        "profile_id",
        "receives_admin_info_emails",
        "receives_info_emails",
        "sender_email",
        "sender_name",
        "signature",
        "small_banner_photo_url",
        "small_photo_url",
        "state",
        "state_code",
        "street",
        "time_zone_sid_key",
        "title",
        "user_role_id",
        "user_type",
        "username",
        "_fivetran_active"
    FROM "sf_user_data"
),

"sf_user_data_projected_renamed" AS (
    -- Rename: Renaming columns
    -- _fivetran_deleted -> is_deleted
    -- about_me -> user_bio
    -- alias -> user_alias
    -- default_group_notification_frequency -> group_notification_frequency
    -- email_preferences_auto_bcc -> auto_bcc_enabled
    -- extension -> phone_extension
    -- fax -> fax_number
    -- id -> user_id
    -- individual_id -> secondary_id
    -- is_profile_photo_active -> is_photo_active
    -- language_locale_key -> language_locale
    -- last_login_date -> last_login
    -- last_referenced_date -> last_referenced
    -- last_viewed_date -> last_viewed
    -- locale_sid_key -> locale_key
    -- medium_banner_photo_url -> medium_banner_url
    -- name -> full_name
    -- offline_trial_expiration_date -> offline_trial_expiration
    -- receives_admin_info_emails -> receives_admin_emails
    -- signature -> email_signature
    -- small_banner_photo_url -> small_banner_url
    -- street -> street_address
    -- time_zone_sid_key -> user_time_zone
    -- title -> job_title
    -- user_role_id -> role_id
    SELECT 
        "_fivetran_deleted" AS "is_deleted",
        "about_me" AS "user_bio",
        "account_id",
        "alias" AS "user_alias",
        "badge_text",
        "banner_photo_url",
        "call_center_id",
        "city",
        "community_nickname",
        "company_name",
        "contact_id",
        "country",
        "country_code",
        "default_group_notification_frequency" AS "group_notification_frequency",
        "delegated_approver_id",
        "department",
        "digest_frequency",
        "division",
        "email",
        "email_encoding_key",
        "email_preferences_auto_bcc" AS "auto_bcc_enabled",
        "employee_number",
        "extension" AS "phone_extension",
        "fax" AS "fax_number",
        "federation_identifier",
        "first_name",
        "forecast_enabled",
        "full_photo_url",
        "geocode_accuracy",
        "id" AS "user_id",
        "individual_id" AS "secondary_id",
        "is_active",
        "is_profile_photo_active" AS "is_photo_active",
        "language_locale_key" AS "language_locale",
        "last_login_date" AS "last_login",
        "last_name",
        "last_referenced_date" AS "last_referenced",
        "last_viewed_date" AS "last_viewed",
        "latitude",
        "locale_sid_key" AS "locale_key",
        "longitude",
        "manager_id",
        "medium_banner_photo_url" AS "medium_banner_url",
        "mobile_phone",
        "name" AS "full_name",
        "offline_trial_expiration_date" AS "offline_trial_expiration",
        "phone",
        "postal_code",
        "profile_id",
        "receives_admin_info_emails" AS "receives_admin_emails",
        "receives_info_emails",
        "sender_email",
        "sender_name",
        "signature" AS "email_signature",
        "small_banner_photo_url" AS "small_banner_url",
        "small_photo_url",
        "state",
        "state_code",
        "street" AS "street_address",
        "time_zone_sid_key" AS "user_time_zone",
        "title" AS "job_title",
        "user_role_id" AS "role_id",
        "user_type",
        "username",
        "_fivetran_active"
    FROM "sf_user_data_projected"
),

"sf_user_data_projected_renamed_cleaned" AS (
    -- Clean unusual string values: 
    -- country: The problem is that the country column contains an encoded string '8lPv4wLTKrJkp24M5lvnaQ==' instead of an actual country name. This value appears to be a Base64 encoded string, which is not a valid representation for a country. The correct value should be an actual country name, but without additional context or information about what this encoded string represents, it's impossible to determine the intended country. Therefore, the most appropriate action is to map this unusual value to an empty string. 
    -- country_code: The problem is that the value 'dRb9Q62qXguKZaZyw5hF0g==' is not a valid country code. Country codes are typically 2 or 3 letter alphabetic codes (like 'US' for United States or 'GBR' for Great Britain). The given value appears to be a Base64 encoded string, which is completely inappropriate for a country code field. Without additional context about what this encoded value represents, it's impossible to map it to a correct country code. The correct values for this field should be standard ISO country codes. 
    -- digest_frequency: The problem is that the digest_frequency column contains a Base64 encoded string instead of a clear frequency value. Base64 encoding is typically used for binary data or to obfuscate information, not for representing simple frequency values. The correct values for a digest frequency field would normally be clear text representations of time intervals like "daily", "weekly", "monthly", etc. 
    -- language_locale: The problem is that the value 'cQlcVsZB8sSk8Ym53816OA==' is not a standard language locale format. It appears to be an encoded string, possibly Base64, which is not appropriate for a language_locale column. Language locales typically follow patterns like 'en-US', 'fr-FR', 'de-DE', etc. The correct values should be actual language locales, but without more information about the intended locale, it's impossible to determine the correct mapping. 
    -- full_name: The problem is that 'Nomadmktg Nomadmktg' repeats a term, which is unusual for a full name. 'empty account' is not a name but a placeholder or system-generated entry. The other names appear to be in the correct format of 'First Last'. The correct values should maintain the proper name format and remove or replace placeholder entries. 
    -- job_title: The problem is that the job_title column contains an encoded or encrypted string rather than a readable job title. The value 'ieakxsZwGEBdpS1879Gv/Q==' appears to be a Base64 encoded string, which is not a meaningful job title. Since we don't have the key to decode this string and no other information about what the actual job title should be, the correct approach is to map this unusual value to an empty string. 
    SELECT
        "is_deleted",
        "user_bio",
        "account_id",
        "user_alias",
        "badge_text",
        "banner_photo_url",
        "call_center_id",
        "city",
        "community_nickname",
        "company_name",
        "contact_id",
        CASE
            WHEN "country" = '8lPv4wLTKrJkp24M5lvnaQ==' THEN ''
            ELSE "country"
        END AS "country",
        CASE
            WHEN "country_code" = 'dRb9Q62qXguKZaZyw5hF0g==' THEN ''
            ELSE "country_code"
        END AS "country_code",
        "group_notification_frequency",
        "delegated_approver_id",
        "department",
        CASE
            WHEN "digest_frequency" = '9iPnWvMOYrvXPW31tQu3tQ==' THEN ''
            ELSE "digest_frequency"
        END AS "digest_frequency",
        "division",
        "email",
        "email_encoding_key",
        "auto_bcc_enabled",
        "employee_number",
        "phone_extension",
        "fax_number",
        "federation_identifier",
        "first_name",
        "forecast_enabled",
        "full_photo_url",
        "geocode_accuracy",
        "user_id",
        "secondary_id",
        "is_active",
        "is_photo_active",
        CASE
            WHEN "language_locale" = 'cQlcVsZB8sSk8Ym53816OA==' THEN ''
            ELSE "language_locale"
        END AS "language_locale",
        "last_login",
        "last_name",
        "last_referenced",
        "last_viewed",
        "latitude",
        "locale_key",
        "longitude",
        "manager_id",
        "medium_banner_url",
        "mobile_phone",
        CASE
            WHEN "full_name" = 'Nomadmktg Nomadmktg' THEN 'Nomadmktg'
            WHEN "full_name" = 'empty account' THEN ''
            ELSE "full_name"
        END AS "full_name",
        "offline_trial_expiration",
        "phone",
        "postal_code",
        "profile_id",
        "receives_admin_emails",
        "receives_info_emails",
        "sender_email",
        "sender_name",
        "email_signature",
        "small_banner_url",
        "small_photo_url",
        "state",
        "state_code",
        "street_address",
        "user_time_zone",
        CASE
            WHEN "job_title" = 'ieakxsZwGEBdpS1879Gv/Q==' THEN ''
            ELSE "job_title"
        END AS "job_title",
        "role_id",
        "user_type",
        "username",
        "_fivetran_active"
    FROM "sf_user_data_projected_renamed"
),

"sf_user_data_projected_renamed_cleaned_null" AS (
    -- NULL Imputation: Impute Null to Disguised Missing Values
    -- country: ['']
    -- country_code: ['']
    -- digest_frequency: ['']
    -- language_locale: ['']
    -- full_name: ['']
    -- job_title: ['']
    SELECT 
        CASE
            WHEN "country" = '' THEN NULL
            ELSE "country"
        END AS "country",
        CASE
            WHEN "country_code" = '' THEN NULL
            ELSE "country_code"
        END AS "country_code",
        CASE
            WHEN "digest_frequency" = '' THEN NULL
            ELSE "digest_frequency"
        END AS "digest_frequency",
        CASE
            WHEN "language_locale" = '' THEN NULL
            ELSE "language_locale"
        END AS "language_locale",
        CASE
            WHEN "full_name" = '' THEN NULL
            ELSE "full_name"
        END AS "full_name",
        CASE
            WHEN "job_title" = '' THEN NULL
            ELSE "job_title"
        END AS "job_title",
        "first_name",
        "phone",
        "last_referenced",
        "mobile_phone",
        "account_id",
        "last_viewed",
        "manager_id",
        "secondary_id",
        "latitude",
        "call_center_id",
        "small_banner_url",
        "community_nickname",
        "longitude",
        "city",
        "group_notification_frequency",
        "last_name",
        "forecast_enabled",
        "employee_number",
        "username",
        "user_alias",
        "sender_name",
        "banner_photo_url",
        "last_login",
        "medium_banner_url",
        "email_signature",
        "email_encoding_key",
        "badge_text",
        "contact_id",
        "auto_bcc_enabled",
        "is_photo_active",
        "geocode_accuracy",
        "profile_id",
        "department",
        "street_address",
        "phone_extension",
        "sender_email",
        "_fivetran_active",
        "company_name",
        "fax_number",
        "locale_key",
        "state",
        "role_id",
        "offline_trial_expiration",
        "small_photo_url",
        "is_active",
        "receives_admin_emails",
        "user_type",
        "division",
        "user_time_zone",
        "postal_code",
        "is_deleted",
        "user_id",
        "receives_info_emails",
        "email",
        "full_photo_url",
        "state_code",
        "delegated_approver_id",
        "user_bio",
        "federation_identifier"
    FROM "sf_user_data_projected_renamed_cleaned"
),

"sf_user_data_projected_renamed_cleaned_null_casted" AS (
    -- Column Type Casting: 
    -- account_id: from DECIMAL to VARCHAR
    -- call_center_id: from DECIMAL to VARCHAR
    -- city: from DECIMAL to VARCHAR
    -- company_name: from DECIMAL to VARCHAR
    -- contact_id: from DECIMAL to VARCHAR
    -- department: from DECIMAL to VARCHAR
    -- division: from DECIMAL to VARCHAR
    -- email_signature: from DECIMAL to VARCHAR
    -- employee_number: from DECIMAL to VARCHAR
    -- fax_number: from DECIMAL to VARCHAR
    -- federation_identifier: from DECIMAL to VARCHAR
    -- geocode_accuracy: from DECIMAL to VARCHAR
    -- last_login: from VARCHAR to TIMESTAMP
    -- last_referenced: from VARCHAR to TIMESTAMP
    -- last_viewed: from VARCHAR to TIMESTAMP
    -- mobile_phone: from DECIMAL to VARCHAR
    -- offline_trial_expiration: from DECIMAL to TIMESTAMP
    -- phone_extension: from DECIMAL to VARCHAR
    -- postal_code: from DECIMAL to VARCHAR
    -- secondary_id: from DECIMAL to VARCHAR
    -- sender_email: from DECIMAL to VARCHAR
    -- sender_name: from DECIMAL to VARCHAR
    -- state: from DECIMAL to VARCHAR
    -- state_code: from DECIMAL to VARCHAR
    -- street_address: from DECIMAL to VARCHAR
    -- user_bio: from DECIMAL to VARCHAR
    SELECT
        "country",
        "country_code",
        "digest_frequency",
        "language_locale",
        "full_name",
        "job_title",
        "first_name",
        "phone",
        "manager_id",
        "latitude",
        "small_banner_url",
        "community_nickname",
        "longitude",
        "group_notification_frequency",
        "last_name",
        "forecast_enabled",
        "username",
        "user_alias",
        "banner_photo_url",
        "medium_banner_url",
        "email_encoding_key",
        "badge_text",
        "auto_bcc_enabled",
        "is_photo_active",
        "profile_id",
        "_fivetran_active",
        "locale_key",
        "role_id",
        "small_photo_url",
        "is_active",
        "receives_admin_emails",
        "user_type",
        "user_time_zone",
        "is_deleted",
        "user_id",
        "receives_info_emails",
        "email",
        "full_photo_url",
        "delegated_approver_id",
        CAST("account_id" AS VARCHAR) AS "account_id",
        CAST("call_center_id" AS VARCHAR) AS "call_center_id",
        CAST("city" AS VARCHAR) AS "city",
        CAST("company_name" AS VARCHAR) AS "company_name",
        CAST("contact_id" AS VARCHAR) AS "contact_id",
        CAST("department" AS VARCHAR) AS "department",
        CAST("division" AS VARCHAR) AS "division",
        CAST("email_signature" AS VARCHAR) AS "email_signature",
        CAST("employee_number" AS VARCHAR) AS "employee_number",
        CAST("fax_number" AS VARCHAR) AS "fax_number",
        CAST("federation_identifier" AS VARCHAR) AS "federation_identifier",
        CAST("geocode_accuracy" AS VARCHAR) AS "geocode_accuracy",
        CAST("last_login" AS TIMESTAMP) AS "last_login",
        CAST("last_referenced" AS TIMESTAMP) AS "last_referenced",
        CAST("last_viewed" AS TIMESTAMP) AS "last_viewed",
        CAST("mobile_phone" AS VARCHAR) AS "mobile_phone",
        CAST("offline_trial_expiration" AS TIMESTAMP) AS "offline_trial_expiration",
        CAST("phone_extension" AS VARCHAR) AS "phone_extension",
        CAST("postal_code" AS VARCHAR) AS "postal_code",
        CAST("secondary_id" AS VARCHAR) AS "secondary_id",
        CAST("sender_email" AS VARCHAR) AS "sender_email",
        CAST("sender_name" AS VARCHAR) AS "sender_name",
        CAST("state" AS VARCHAR) AS "state",
        CAST("state_code" AS VARCHAR) AS "state_code",
        CAST("street_address" AS VARCHAR) AS "street_address",
        CAST("user_bio" AS VARCHAR) AS "user_bio"
    FROM "sf_user_data_projected_renamed_cleaned_null"
),

"sf_user_data_projected_renamed_cleaned_null_casted_missing_handled" AS (
    -- Handling missing values: There are 32 columns with unacceptable missing values
    -- account_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- call_center_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- city has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- company_name has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- contact_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- country has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- country_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- department has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- digest_frequency has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- division has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- email_signature has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- employee_number has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- fax_number has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- federation_identifier has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- full_name has 10.0 percent missing. Strategy: 🔄 Unchanged
    -- geocode_accuracy has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- job_title has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- language_locale has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_login has 20.0 percent missing. Strategy: 🔄 Unchanged
    -- latitude has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- longitude has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- mobile_phone has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- offline_trial_expiration has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- phone_extension has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- postal_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- role_id has 20.0 percent missing. Strategy: 🔄 Unchanged
    -- sender_email has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- sender_name has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- state has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- state_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- street_address has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- user_bio has 100.0 percent missing. Strategy: 🗑️ Drop Column
    SELECT
        "full_name",
        "first_name",
        "phone",
        "manager_id",
        "small_banner_url",
        "community_nickname",
        "group_notification_frequency",
        "last_name",
        "forecast_enabled",
        "username",
        "user_alias",
        "banner_photo_url",
        "medium_banner_url",
        "email_encoding_key",
        "badge_text",
        "auto_bcc_enabled",
        "is_photo_active",
        "profile_id",
        "_fivetran_active",
        "locale_key",
        "role_id",
        "small_photo_url",
        "is_active",
        "receives_admin_emails",
        "user_type",
        "user_time_zone",
        "is_deleted",
        "user_id",
        "receives_info_emails",
        "email",
        "full_photo_url",
        "delegated_approver_id",
        "last_login",
        "last_referenced",
        "last_viewed",
        "secondary_id"
    FROM "sf_user_data_projected_renamed_cleaned_null_casted"
)

-- COCOON BLOCK END
SELECT * FROM "sf_user_data_projected_renamed_cleaned_null_casted_missing_handled"

stg_sf_user_data.yml (Document the table)

version: 2
models:
- name: stg_sf_user_data
  description: The table is about Salesforce user data. It contains personal and account
    details for users, including names, email addresses, roles, and preferences. Some
    fields are encrypted. The table tracks active status, login dates, and system
    settings for each user. It appears to be a comprehensive user profile database
    for a Salesforce instance.
  columns:
  - name: full_name
    description: User's full name
    tests:
    - not_null
  - name: first_name
    description: User's first name
    tests:
    - not_null
  - name: phone
    description: User's phone number
    cocoon_meta:
      missing_acceptable: Not all users may have or provide a phone number.
  - name: manager_id
    description: Identifier for the user's manager
    cocoon_meta:
      missing_acceptable: Not all employees have a manager in the system.
  - name: small_banner_url
    description: URL for small-sized banner photo
    tests:
    - not_null
  - name: community_nickname
    description: User's nickname in the community
    tests:
    - not_null
  - name: group_notification_frequency
    description: Frequency of group notifications
    tests:
    - not_null
    - accepted_values:
        values:
        - Never
        - Immediately
        - Daily
        - Weekly
        - Monthly
        - Custom
        - jZwwfLfzxKMoIqUZItHOqg==
  - name: last_name
    description: User's last name (encrypted)
    tests:
    - not_null
  - name: forecast_enabled
    description: Indicates if forecasting is enabled
    tests:
    - not_null
  - name: username
    description: Unique username for Salesforce login
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column represents the unique username for Salesforce login.
        In Salesforce, usernames are required to be unique across the entire organization.
  - name: user_alias
    description: User's alternate name or nickname
    tests:
    - not_null
  - name: banner_photo_url
    description: URL of user's banner photo
    tests:
    - not_null
  - name: medium_banner_url
    description: URL for medium-sized banner photo
    tests:
    - not_null
  - name: email_encoding_key
    description: Key for encoding user's emails
    tests:
    - not_null
  - name: badge_text
    description: Text displayed on user's badge
    tests:
    - not_null
  - name: auto_bcc_enabled
    description: Auto BCC preference for emails
    tests:
    - not_null
  - name: is_photo_active
    description: Indicates if user's profile photo is active
    tests:
    - not_null
  - name: profile_id
    description: Identifier for the user's profile
    tests:
    - not_null
  - name: _fivetran_active
    description: ''
    tests:
    - not_null
  - name: locale_key
    description: Locale-specific identifier key
    tests:
    - not_null
  - name: role_id
    description: Unique identifier for user's role in Salesforce
    tests:
    - not_null
  - name: small_photo_url
    description: URL for small-sized profile photo
    tests:
    - not_null
  - name: is_active
    description: Indicates if the user record is active
    tests:
    - not_null
  - name: receives_admin_emails
    description: Indicates if user receives admin emails
    tests:
    - not_null
  - name: user_type
    description: Category of user (e.g., standard, partner, customer)
    tests:
    - not_null
    - accepted_values:
        values:
        - standard
        - partner
        - customer
        - admin
        - guest
        - premium
        - free
        - business
        - enterprise
        - developer
        - 622K5vICg3VbM5wNwnOYiw==
  - name: user_time_zone
    description: User's preferred time zone setting
    tests:
    - not_null
  - name: is_deleted
    description: Indicates if the user record is deleted
    tests:
    - not_null
  - name: user_id
    description: Unique identifier for the user
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column represents a unique identifier for the user. User IDs
        in Salesforce are system-generated and guaranteed to be unique for each user.
  - name: receives_info_emails
    description: Indicates if user receives info emails
    tests:
    - not_null
  - name: email
    description: User's email address
    tests:
    - not_null
  - name: full_photo_url
    description: URL of user's full-size photo
    tests:
    - not_null
  - name: delegated_approver_id
    description: ID of user's delegated approver
    cocoon_meta:
      missing_acceptable: Not all users have or need a delegated approver.
  - name: last_login
    description: Date and time of user's last login
    tests:
    - not_null
  - name: last_referenced
    description: Date the user was last referenced
    cocoon_meta:
      missing_acceptable: New or inactive users may not have been referenced.
  - name: last_viewed
    description: Date the user last viewed content
    cocoon_meta:
      missing_acceptable: New or inactive users may not have been viewed.
  - name: secondary_id
    description: Secondary identifier for the individual
    cocoon_meta:
      missing_acceptable: Optional additional identifier, not always needed for users.

stg_sf_contact_history_data (first 100 rows)

mailing_country lead_source mailing_city contact_id last_name owner_id mailing_country_code mailing_state last_modified_by_id email full_name mailing_street account_id is_active description primary_phone job_title home_phone individual_id is_deleted last_activity_date last_modified_date last_referenced_date last_viewed_date mailing_postal_code master_record_id mobile_phone reports_to_id validity_end_date validity_start_date
0 None None None 0033700000JmrFPAA None None None None None None None None None True None None None None None NaN 2020-07-07 00:00:00 2019-11-11 17:23:34 NaT 2020-08-07 00:00:00 None None None None 9999-12-31 23:59:59 2020-07-07 12:51:56
1 United States ZoomInfo None 0031G00000q9jPQAQ G 0051G000005MreQAC US None 0051G000005MreQAC None Janet Yellen None 0011G00000eM9wvQAC True None (555) 555-5555 Data Science Director None None NaN 2018-11-12 19:53:00 2019-11-11 17:23:34 NaT 2018-11-13 19:53:00 None None None None 9999-12-31 23:59:59 2018-11-12 19:53:00
2 United States Vendor List None 0031G00000rfAvuQAE G 0051G000005MreQAC US None 0051G000005MreQAC None Jerome Powell None 0011G00000f8NwQAU True Buy our things. None Director, Business Insights & Strategy None None NaN 2019-04-04 17:44:47 2019-11-11 17:23:34 NaT 2019-04-13 17:44:47 None None None None 9999-12-31 23:59:59 2019-04-04 17:44:47
3 United States ZoomInfo Chicago 0031G00000qAfq1QAC G 0051G000005MreQAC US Illinois 0051G000005MreQAC hi@google.com Jerome Powell 123 Ave 0011G00000eNyiXQAS True Buy more. (555) 555-5555 Marketing Director None None NaN 2019-01-03 19:53:01 2019-11-11 17:23:34 NaT 2019-01-13 19:53:01 55555.0 None None None 9999-12-31 23:59:59 2019-01-03 19:53:01

stg_sf_contact_history_data.sql (clean the table)

-- COCOON BLOCK START: PLEASE DO NOT MODIFY THIS BLOCK FOR SELF-MAINTENANCE
WITH 
"sf_contact_history_data_projected" AS (
    -- Projection: Selecting 31 out of 32 columns
    -- Columns projected out: ['_fivetran_synced']
    SELECT 
        "_fivetran_active",
        "_fivetran_start",
        "_fivetran_end",
        "id",
        "account_id",
        "email",
        "first_name",
        "is_deleted",
        "last_activity_date",
        "last_modified_by_id",
        "last_modified_date",
        "last_name",
        "last_referenced_date",
        "last_viewed_date",
        "mailing_city",
        "mailing_country",
        "mailing_country_code",
        "mailing_postal_code",
        "mailing_state",
        "mailing_street",
        "master_record_id",
        "mobile_phone",
        "name",
        "owner_id",
        "phone",
        "reports_to_id",
        "title",
        "lead_source",
        "description",
        "individual_id",
        "home_phone"
    FROM "sf_contact_history_data"
),

"sf_contact_history_data_projected_renamed" AS (
    -- Rename: Renaming columns
    -- _fivetran_active -> is_active
    -- _fivetran_start -> validity_start_date
    -- _fivetran_end -> validity_end_date
    -- id -> contact_id
    -- name -> full_name
    -- phone -> primary_phone
    -- title -> job_title
    SELECT 
        "_fivetran_active" AS "is_active",
        "_fivetran_start" AS "validity_start_date",
        "_fivetran_end" AS "validity_end_date",
        "id" AS "contact_id",
        "account_id",
        "email",
        "first_name",
        "is_deleted",
        "last_activity_date",
        "last_modified_by_id",
        "last_modified_date",
        "last_name",
        "last_referenced_date",
        "last_viewed_date",
        "mailing_city",
        "mailing_country",
        "mailing_country_code",
        "mailing_postal_code",
        "mailing_state",
        "mailing_street",
        "master_record_id",
        "mobile_phone",
        "name" AS "full_name",
        "owner_id",
        "phone" AS "primary_phone",
        "reports_to_id",
        "title" AS "job_title",
        "lead_source",
        "description",
        "individual_id",
        "home_phone"
    FROM "sf_contact_history_data_projected"
),

"sf_contact_history_data_projected_renamed_cleaned" AS (
    -- Clean unusual string values: 
    -- first_name: The problem is that 'x' is not a typical first name and appears to be a placeholder or anonymized value. In data anonymization, 'x' is often used to replace actual names to protect privacy. The correct value would depend on the purpose of the dataset and privacy requirements. If maintaining anonymity is crucial, 'x' could be kept. If more meaningful placeholders are desired, options like 'Anonymous' or leaving it as an empty string could be considered. 
    -- last_name: The problem is that 'G' is indeed an unusual value for a last name, as it's a single letter. This could be due to various reasons: 1. It might be an abbreviation of a longer last name. 2. It could be a data entry error where only the first letter of the last name was recorded. 3. In some rare cases, it might actually be a person's full last name. Without more context or additional data, it's difficult to determine the correct full last name.  Given the limited information, the best approach is to keep the value as is, since changing it without more information could introduce errors. 
    -- mailing_country: The problem is that 'Unied Saes' is a misspelling of 'United States' with missing letters. The correct value should be 'United States'. 
    -- full_name: The problem is inconsistent representation of Jerome Powell's name. The full name "Jerome Powell" is the correct and complete representation, while "Jerome" is incomplete. The correct values should all be full names. 
    -- job_title: The problem is that all job titles contain misspellings. The correct values should be: 'Data Science Director' instead of 'Daa Science Direcor', 'Director, Business Insights & Strategy' instead of 'Direcor, Business Insighs & Sraegy', and 'Marketing Director' instead of 'Markeing Direcor'. These corrections fix the typos in each job title. 
    -- lead_source: The problem is that both values in the lead_source column are unusual. 'oominfo' is likely a typo for 'ZoomInfo', a popular B2B contact database. 'Vendor Lis' appears to be an incomplete entry, probably meant to be 'Vendor List'. The correct values should be 'ZoomInfo' and 'Vendor List' respectively. 
    SELECT
        "is_active",
        "validity_start_date",
        "validity_end_date",
        "contact_id",
        "account_id",
        "email",
        CASE
            WHEN "first_name" = 'x' THEN ''
            ELSE "first_name"
        END AS "first_name",
        "is_deleted",
        "last_activity_date",
        "last_modified_by_id",
        "last_modified_date",
        "last_name",
        "last_referenced_date",
        "last_viewed_date",
        "mailing_city",
        CASE
            WHEN "mailing_country" = 'Unied Saes' THEN 'United States'
            ELSE "mailing_country"
        END AS "mailing_country",
        "mailing_country_code",
        "mailing_postal_code",
        "mailing_state",
        "mailing_street",
        "master_record_id",
        "mobile_phone",
        CASE
            WHEN "full_name" = 'Jerome' THEN 'Jerome Powell'
            ELSE "full_name"
        END AS "full_name",
        "owner_id",
        "primary_phone",
        "reports_to_id",
        CASE
            WHEN "job_title" = 'Daa Science Direcor' THEN 'Data Science Director'
            WHEN "job_title" = 'Direcor, Business Insighs & Sraegy' THEN 'Director, Business Insights & Strategy'
            WHEN "job_title" = 'Markeing Direcor' THEN 'Marketing Director'
            ELSE "job_title"
        END AS "job_title",
        CASE
            WHEN "lead_source" = 'oominfo' THEN 'ZoomInfo'
            WHEN "lead_source" = 'Vendor Lis' THEN 'Vendor List'
            ELSE "lead_source"
        END AS "lead_source",
        "description",
        "individual_id",
        "home_phone"
    FROM "sf_contact_history_data_projected_renamed"
),

"sf_contact_history_data_projected_renamed_cleaned_null" AS (
    -- NULL Imputation: Impute Null to Disguised Missing Values
    -- first_name: ['']
    SELECT 
        CASE
            WHEN "first_name" = '' THEN NULL
            ELSE "first_name"
        END AS "first_name",
        "last_modified_date",
        "last_activity_date",
        "mailing_country",
        "is_deleted",
        "last_referenced_date",
        "lead_source",
        "mailing_city",
        "master_record_id",
        "contact_id",
        "last_name",
        "reports_to_id",
        "owner_id",
        "mailing_country_code",
        "mailing_state",
        "last_modified_by_id",
        "validity_start_date",
        "email",
        "mobile_phone",
        "full_name",
        "mailing_street",
        "account_id",
        "home_phone",
        "validity_end_date",
        "is_active",
        "last_viewed_date",
        "description",
        "primary_phone",
        "job_title",
        "individual_id",
        "mailing_postal_code"
    FROM "sf_contact_history_data_projected_renamed_cleaned"
),

"sf_contact_history_data_projected_renamed_cleaned_null_casted" AS (
    -- Column Type Casting: 
    -- home_phone: from DECIMAL to VARCHAR
    -- individual_id: from DECIMAL to VARCHAR
    -- is_deleted: from DECIMAL to BOOLEAN
    -- last_activity_date: from VARCHAR to TIMESTAMP
    -- last_modified_date: from VARCHAR to TIMESTAMP
    -- last_referenced_date: from DECIMAL to TIMESTAMP
    -- last_viewed_date: from VARCHAR to TIMESTAMP
    -- mailing_postal_code: from DECIMAL to VARCHAR
    -- master_record_id: from DECIMAL to VARCHAR
    -- mobile_phone: from DECIMAL to VARCHAR
    -- reports_to_id: from DECIMAL to VARCHAR
    -- validity_end_date: from VARCHAR to TIMESTAMP
    -- validity_start_date: from VARCHAR to TIMESTAMP
    SELECT
        "first_name",
        "mailing_country",
        "lead_source",
        "mailing_city",
        "contact_id",
        "last_name",
        "owner_id",
        "mailing_country_code",
        "mailing_state",
        "last_modified_by_id",
        "email",
        "full_name",
        "mailing_street",
        "account_id",
        "is_active",
        "description",
        "primary_phone",
        "job_title",
        CAST("home_phone" AS VARCHAR) AS "home_phone",
        CAST("individual_id" AS VARCHAR) AS "individual_id",
        CAST("is_deleted" AS BOOLEAN) AS "is_deleted",
        CAST("last_activity_date" AS TIMESTAMP) AS "last_activity_date",
        CAST("last_modified_date" AS TIMESTAMP) AS "last_modified_date",
        CAST("last_referenced_date" AS TIMESTAMP) AS "last_referenced_date",
        CAST("last_viewed_date" AS TIMESTAMP) AS "last_viewed_date",
        CAST("mailing_postal_code" AS VARCHAR) AS "mailing_postal_code",
        CAST("master_record_id" AS VARCHAR) AS "master_record_id",
        CAST("mobile_phone" AS VARCHAR) AS "mobile_phone",
        CAST("reports_to_id" AS VARCHAR) AS "reports_to_id",
        CAST("validity_end_date" AS VARCHAR) AS "validity_end_date",
        CAST("validity_start_date" AS TIMESTAMP) AS "validity_start_date"
    FROM "sf_contact_history_data_projected_renamed_cleaned_null"
),

"sf_contact_history_data_projected_renamed_cleaned_null_casted_missing_handled" AS (
    -- Handling missing values: There are 17 columns with unacceptable missing values
    -- account_id has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- description has 50.0 percent missing. Strategy: 🔄 Unchanged
    -- email has 75.0 percent missing. Strategy: 🔄 Unchanged
    -- first_name has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- full_name has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- job_title has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- last_modified_by_id has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- last_name has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- lead_source has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- mailing_city has 75.0 percent missing. Strategy: 🔄 Unchanged
    -- mailing_country has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- mailing_country_code has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- mailing_postal_code has 75.0 percent missing. Strategy: 🔄 Unchanged
    -- mailing_state has 75.0 percent missing. Strategy: 🔄 Unchanged
    -- mailing_street has 75.0 percent missing. Strategy: 🔄 Unchanged
    -- owner_id has 25.0 percent missing. Strategy: 🔄 Unchanged
    -- primary_phone has 50.0 percent missing. Strategy: 🔄 Unchanged
    SELECT
        "mailing_country",
        "lead_source",
        "mailing_city",
        "contact_id",
        "last_name",
        "owner_id",
        "mailing_country_code",
        "mailing_state",
        "last_modified_by_id",
        "email",
        "full_name",
        "mailing_street",
        "account_id",
        "is_active",
        "description",
        "primary_phone",
        "job_title",
        "home_phone",
        "individual_id",
        "is_deleted",
        "last_activity_date",
        "last_modified_date",
        "last_referenced_date",
        "last_viewed_date",
        "mailing_postal_code",
        "master_record_id",
        "mobile_phone",
        "reports_to_id",
        "validity_end_date",
        "validity_start_date"
    FROM "sf_contact_history_data_projected_renamed_cleaned_null_casted"
)

-- COCOON BLOCK END
SELECT * FROM "sf_contact_history_data_projected_renamed_cleaned_null_casted_missing_handled"

stg_sf_contact_history_data.yml (Document the table)

version: 2
models:
- name: stg_sf_contact_history_data
  description: The table is about contact history data. It contains personal and professional
    details of individuals. The information includes names, email addresses, phone
    numbers, mailing addresses, job titles, and account associations. It also tracks
    system-related data like last modified dates, owner IDs, and activity dates. The
    table appears to be used for customer relationship management purposes.
  columns:
  - name: mailing_country
    description: Country in the mailing address
    tests:
    - not_null
  - name: lead_source
    description: Source of the lead or contact
    tests:
    - not_null
  - name: mailing_city
    description: City in the mailing address
    tests:
    - not_null
  - name: contact_id
    description: Unique identifier for the contact record
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column is a unique identifier for the contact record. For this
        table, each row represents a contact, and the contact_id is designed to be
        unique for each contact.
  - name: last_name
    description: Last name of the contact
    tests:
    - not_null
  - name: owner_id
    description: ID of the user who owns the record
    tests:
    - not_null
  - name: mailing_country_code
    description: Country code in the mailing address
    tests:
    - not_null
  - name: mailing_state
    description: State in the mailing address
    tests:
    - not_null
    - accepted_values:
        values:
        - Alabama
        - Alaska
        - Arizona
        - Arkansas
        - California
        - Colorado
        - Connecticut
        - Delaware
        - Florida
        - Georgia
        - Hawaii
        - Idaho
        - Illinois
        - Indiana
        - Iowa
        - Kansas
        - Kentucky
        - Louisiana
        - Maine
        - Maryland
        - Massachusetts
        - Michigan
        - Minnesota
        - Mississippi
        - Missouri
        - Montana
        - Nebraska
        - Nevada
        - New Hampshire
        - New Jersey
        - New Mexico
        - New York
        - North Carolina
        - North Dakota
        - Ohio
        - Oklahoma
        - Oregon
        - Pennsylvania
        - Rhode Island
        - South Carolina
        - South Dakota
        - Tennessee
        - Texas
        - Utah
        - Vermont
        - Virginia
        - Washington
        - West Virginia
        - Wisconsin
        - Wyoming
  - name: last_modified_by_id
    description: ID of user who last modified the record
    tests:
    - not_null
  - name: email
    description: Email address of the contact
    tests:
    - not_null
  - name: full_name
    description: Full name of the contact
    tests:
    - not_null
  - name: mailing_street
    description: Street address in the mailing address
    tests:
    - not_null
  - name: account_id
    description: Unique identifier for the associated account
    tests:
    - not_null
  - name: is_active
    description: Indicates if the record is currently active
    tests:
    - not_null
  - name: description
    description: Additional notes or description about the contact
    tests:
    - not_null
  - name: primary_phone
    description: Primary phone number of the contact
    tests:
    - not_null
  - name: job_title
    description: Job title of the individual
    tests:
    - not_null
  - name: home_phone
    description: Home phone number of the contact
    cocoon_meta:
      missing_acceptable: Not all contacts may have a home phone.
  - name: individual_id
    description: Identifier for the individual (if different from contact)
    cocoon_meta:
      missing_acceptable: May not be applicable for business or organizational contacts.
  - name: is_deleted
    description: Indicates if the record has been deleted
    cocoon_meta:
      missing_acceptable: Record is active, so deletion status not applicable.
  - name: last_activity_date
    description: Date of the most recent activity
    tests:
    - not_null
  - name: last_modified_date
    description: Date and time of last modification
    tests:
    - not_null
  - name: last_referenced_date
    description: Date the record was last referenced
    cocoon_meta:
      missing_acceptable: New or unused records may not have been referenced.
  - name: last_viewed_date
    description: Date the record was last viewed
    tests:
    - not_null
  - name: mailing_postal_code
    description: Postal code in the mailing address
    tests:
    - not_null
  - name: master_record_id
    description: ID of the master record if duplicates exist
    cocoon_meta:
      missing_acceptable: Only applicable for merged or duplicate records.
  - name: mobile_phone
    description: Mobile phone number of the contact
    cocoon_meta:
      missing_acceptable: Not all contacts may have a mobile phone.
  - name: reports_to_id
    description: ID of the person this contact reports to
    cocoon_meta:
      missing_acceptable: May not have a superior or be part of hierarchy.
  - name: validity_end_date
    description: End date of record validity
    tests:
    - not_null
  - name: validity_start_date
    description: Start date of record validity
    tests:
    - not_null

stg_sf_task_data (first 100 rows)

account_id assigned_to_name associated_person_count subject created_by_id id is_archived last_modified_by_id priority record_type_id is_collections_hold associated_object_id meeting_type meeting_name description has_vidyard_video is_no_show status is_collections_plan_activity is_closed associated_object_count is_high_priority owner_id is_recurring is_deleted associated_person_id task_subtype has_reminder activity_date affect_layer_call_id attendance_number bizible_id bizible_touchpoint_date call_disposition call_disposition_custom call_disposition_secondary call_duration_seconds call_object call_recording call_type campaign chorus_call_id co_sell_partner_account completed_date_time created_date duration_minutes event_name invitee_uuid is_co_sell_activity is_co_selling_activity last_modified_date recurrence_activity_id recurrence_day_of_month recurrence_end_date recurrence_instance recurrence_interval recurrence_month recurrence_regeneration_type recurrence_start_date recurrence_timezone recurrence_type recurrence_weekday_mask sales_loft_cadence_id sales_loft_cadence_name sales_loft_click_count sales_loft_email_template_id sales_loft_email_template_title sales_loft_external_id sales_loft_reply_count sales_loft_step_day sales_loft_step_id sales_loft_step_name sales_loft_step_type sales_loft_view_count system_modstamp
0 0011G00000jWVWoQAO Fivetran Account Executive 1 subject 0051G000005Mun4QAC 0051G000005Mun4QAC 00T1G00003Ufap9UAB False 0051G000005Mun4QAC Normal 0121G000000g1SFQAY False 0061G00000N38JZQAZ None None description False False Completed False True 1 False 0051G000005Mun4QAC False False 0031G00001S3ckZQAR Task False 2019-11-11 17:23:34 None None None None None None None None None None None None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None NaN NaN NaN 2019-11-11 17:23:34 None NaN NaT None NaN NaN None NaT None None NaN None None NaN None None None NaN NaN None None None NaN 2019-11-11 17:23:34
1 0011G00000ugZ6HQAU Fivetran Account Executive 1 subject 0051G000005Mun4QAC 0051G000005Mun4QAC 00T1G00003UfepsUAB False 0051G000005Mun4QAC Normal 0121G000000g1SFQAY False 0061G00000N31HAQAZ None None description False False Completed False True 1 False 0051G000005Mun4QAC False False 0031G00001S3JniQAF Task False 2019-11-11 17:23:34 None None None None None None None None None None None None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None NaN NaN NaN 2019-11-11 17:23:34 None NaN NaT None NaN NaN None NaT None None NaN None None NaN None None None NaN NaN None None None NaN 2019-11-11 17:23:34
2 0011G00000hC8aMQAS Fivetran Account Executive 1 subject 0051G000005Mun4QAC 0051G000005Mun4QAC 00T1G00003UfRU9UAN False 0051G000005Mun4QAC Normal 0121G000000g1SFQAY False 0061G00000N32AHQAZ Default Personal Meeting sync description False False Completed False True 1 False 0051G000005Mun4QAC False False 0031G00000xOrznQAC Task False 2019-11-11 17:23:34 None None None None None None None None None None None None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None NaN NaN NaN 2019-11-11 17:23:34 None NaN NaT None NaN NaN None NaT None None NaN None None NaN None None None NaN NaN None None None NaN 2019-11-11 17:23:34
3 None Fivetran Account Executive 1 subject 0051G000005Mun4QAC 0051G000005Mun4QAC 00T1G00003UffGjUAJ False 0051G000005Mun4QAC Normal 0121G000000g1SFQAY False None None None description False False Completed False True 0 False 0051G000005Mun4QAC False False 00Q1G00000nOMcPUAW Task False 2019-11-11 17:23:34 None None None None None None None None None None None None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None NaN NaN NaN 2019-11-11 17:23:34 None NaN NaT None NaN NaN None NaT None None NaN None None NaN None None None NaN NaN None None None NaN 2019-11-11 17:23:34
4 0011G00000qFChkQAG Fivetran Account Executive 1 subject 0051G000005Mun4QAC 0051G000005Mun4QAC 00T1G00003UfZPYUA3 False 0051G000005Mun4QAC Normal 0121G000000g1SFQAY False 0061G00000N3DTUQA3 None None description False False Completed False True 1 False 0051G000005Mun4QAC False False 0031G00001S3oefQAB Task False 2019-11-11 17:23:34 None None None None None None None None None None None None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None NaN NaN NaN 2019-11-11 17:23:34 None NaN NaT None NaN NaN None NaT None None NaN None None NaN None None None NaN NaN None None None NaN 2019-11-11 17:23:34
5 0011G00000qFChkQAG Fivetran Account Executive 1 subject 0051G000005Mun4QAC 0051G000005Mun4QAC 00T1G00003UfZQ7UAN False 0051G000005Mun4QAC Normal 0121G000000g1SFQAY False 0061G00000N3DTUQA3 None None description False False Completed False True 1 False 0051G000005Mun4QAC False False 0031G00001S3oefQAB Task False 2019-11-11 17:23:34 None None None None None None None None None None None None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None NaN NaN NaN 2019-11-11 17:23:34 None NaN NaT None NaN NaN None NaT None None NaN None None NaN None None None NaN NaN None None None NaN 2019-11-11 17:23:34
6 0011G00000tM0pgQAC Fivetran Account Executive 1 subject 0051G000005Mun4QAC 0051G000005Mun4QAC 00T1G00003UfFY2UAN False 0051G000005Mun4QAC Normal 0121G000000g1SFQAY False None None None description False False Completed False True 0 False 0051G000005Mun4QAC False False 0031G00001NTqhqQAD Task False 2019-11-11 17:23:34 None None None None None None None None None None None None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None NaN NaN NaN 2019-11-11 17:23:34 None NaN NaT None NaN NaN None NaT None None NaN None None NaN None None None NaN NaN None None None NaN 2019-11-11 17:23:34
7 0011G00000gY18CQAS Fivetran Account Executive 1 subject 0051G000005Mun4QAC 0051G000005Mun4QAC 00T1G00003UffAmUAJ False 0051G000005Mun4QAC Normal 0121G000000g1SFQAY False 0061G00000O1zGuQAJ Default Personal Meeting reconnect description False False Completed False True 1 False 0051G000005Mun4QAC False False 0031G00001A2cSSQAZ Task False 2019-11-11 17:23:34 None None None None None None None None None None None None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None NaN NaN NaN 2019-11-11 17:23:34 None NaN NaT None NaN NaN None NaT None None NaN None None NaN None None None NaN NaN None None None NaN 2019-11-11 17:23:34
8 0011G00000qFChkQAG Fivetran Account Executive 1 subject 0051G000005Mun4QAC 0051G000005Mun4QAC 00T1G00003UfFP8UAN False 0051G000005Mun4QAC Normal 0121G000000g1SFQAY False 0061G00000N3D9UQAV None None description False False Completed False True 1 False 0051G000005Mun4QAC False False 0031G00001S3oefQAB Task False 2019-11-11 17:23:34 None None None None None None None None None None None None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None NaN NaN NaN 2019-11-11 17:23:34 None NaN NaT None NaN NaN None NaT None None NaN None None NaN None None None NaN NaN None None None NaN 2019-11-11 17:23:34
9 0011G00000tM0pgQAC Fivetran Account Executive 1 subject 0051G000005Mun4QAC 0051G000005Mun4QAC 00T1G00003UfFl8UAF False 0051G000005Mun4QAC Normal 0121G000000g1SFQAY False None None None description False False Completed False True 0 False 0051G000005Mun4QAC False False 0031G00001NTqhqQAD Task False 2019-11-11 17:23:34 None None None None None None None None None None None None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None NaN NaN NaN 2019-11-11 17:23:34 None NaN NaT None NaN NaN None NaT None None NaN None None NaN None None None NaN NaN None None None NaN 2019-11-11 17:23:34

stg_sf_task_data.sql (clean the table)

-- COCOON BLOCK START: PLEASE DO NOT MODIFY THIS BLOCK FOR SELF-MAINTENANCE
WITH 
"sf_task_data_removeWideColumns" AS (
    -- Remove wide columns with pattern. The regex and columns are:
    -- ^sales_loft_\d+_.*$: sales_loft_1_call_disposition_c, sales_loft_1_call_sentiment_c, sales_loft_1_sales_loft_cadence_name_c, sales_loft_1_sales_loft_clicked_count_c, sales_loft_1_sales_loft_email_template_title_c, sales_loft_1_sales_loft_replies_count_c, sales_loft_1_sales_loft_step_day_c, sales_loft_1_sales_loft_view_count_c
    SELECT 
        "_fivetran_active",
        "_fivetran_synced",
        "account_id",
        "activity_date",
        "affectlayer_affect_layer_call_id_c",
        "affectlayer_chorus_call_id_c",
        "assigned_to_name_c",
        "assigned_to_role_c",
        "associated_sdr_c",
        "attendance_number_c",
        "bizible_2_bizible_id_c",
        "bizible_2_bizible_touchpoint_date_c",
        "call_disposition",
        "call_disposition_2_c",
        "call_disposition_c",
        "call_duration_in_seconds",
        "call_object",
        "call_recording_c",
        "call_type",
        "campaign_c",
        "co_sell_partner_account_c",
        "co_selling_activity_c",
        "collections_hold_c",
        "completed_date_time",
        "created_by_id",
        "created_date",
        "description",
        "description_c",
        "duration_in_minutes_c",
        "event_name_c",
        "execute_collections_plan_activity_c",
        "expected_payment_date_c",
        "first_meeting_c",
        "first_meeting_held_c",
        "how_did_you_bring_value_or_create_trust_c",
        "how_did_you_bring_value_or_earn_trust_c",
        "id",
        "invitee_uuid_c",
        "is_a_co_sell_activity_c",
        "is_archived",
        "is_closed",
        "is_deleted",
        "is_high_priority",
        "is_recurrence",
        "is_reminder_set",
        "last_modified_by_id",
        "last_modified_date",
        "last_rep_activity_date_c",
        "legacy_hvr_id_c",
        "lid_date_sent_c",
        "lid_url_c",
        "meeting_name_c",
        "meeting_type_c",
        "no_show_c",
        "opportunity_c",
        "owner_id",
        "partner_account_c",
        "partner_activity_type_c",
        "partner_contact_c",
        "priority",
        "proof_of_referral_c",
        "record_type_id",
        "recurrence_activity_id",
        "recurrence_day_of_month",
        "recurrence_day_of_week_mask",
        "recurrence_end_date_only",
        "recurrence_instance",
        "recurrence_interval",
        "recurrence_month_of_year",
        "recurrence_regenerated_type",
        "recurrence_start_date_only",
        "recurrence_time_zone_sid_key",
        "recurrence_type",
        "referral_account_c",
        "referral_contact_c",
        "reminder_date_time",
        "sales_loft_cadence_id_c",
        "sales_loft_cadence_name_c",
        "sales_loft_clicked_count_c",
        "sales_loft_email_template_id_c",
        "sales_loft_email_template_title_c",
        "sales_loft_external_identifier_c",
        "sales_loft_reply_count_c",
        "sales_loft_step_day_new_c",
        "sales_loft_step_id_c",
        "sales_loft_step_name_c",
        "sales_loft_step_type_c",
        "sales_loft_viewed_count_c",
        "status",
        "subject",
        "system_modstamp",
        "task_subtype",
        "topic_c",
        "type",
        "vidyard_c",
        "what_count",
        "what_id",
        "who_count",
        "who_id"
    FROM "sf_task_data"
),

"sf_task_data_removeWideColumns_projected" AS (
    -- Projection: Selecting 98 out of 99 columns
    -- Columns projected out: ['_fivetran_synced']
    SELECT 
        "_fivetran_active",
        "account_id",
        "activity_date",
        "affectlayer_affect_layer_call_id_c",
        "affectlayer_chorus_call_id_c",
        "assigned_to_name_c",
        "assigned_to_role_c",
        "associated_sdr_c",
        "attendance_number_c",
        "bizible_2_bizible_id_c",
        "bizible_2_bizible_touchpoint_date_c",
        "call_disposition",
        "call_disposition_2_c",
        "call_disposition_c",
        "call_duration_in_seconds",
        "call_object",
        "call_recording_c",
        "call_type",
        "campaign_c",
        "co_sell_partner_account_c",
        "co_selling_activity_c",
        "collections_hold_c",
        "completed_date_time",
        "created_by_id",
        "created_date",
        "description",
        "description_c",
        "duration_in_minutes_c",
        "event_name_c",
        "execute_collections_plan_activity_c",
        "expected_payment_date_c",
        "first_meeting_c",
        "first_meeting_held_c",
        "how_did_you_bring_value_or_create_trust_c",
        "how_did_you_bring_value_or_earn_trust_c",
        "id",
        "invitee_uuid_c",
        "is_a_co_sell_activity_c",
        "is_archived",
        "is_closed",
        "is_deleted",
        "is_high_priority",
        "is_recurrence",
        "is_reminder_set",
        "last_modified_by_id",
        "last_modified_date",
        "last_rep_activity_date_c",
        "legacy_hvr_id_c",
        "lid_date_sent_c",
        "lid_url_c",
        "meeting_name_c",
        "meeting_type_c",
        "no_show_c",
        "opportunity_c",
        "owner_id",
        "partner_account_c",
        "partner_activity_type_c",
        "partner_contact_c",
        "priority",
        "proof_of_referral_c",
        "record_type_id",
        "recurrence_activity_id",
        "recurrence_day_of_month",
        "recurrence_day_of_week_mask",
        "recurrence_end_date_only",
        "recurrence_instance",
        "recurrence_interval",
        "recurrence_month_of_year",
        "recurrence_regenerated_type",
        "recurrence_start_date_only",
        "recurrence_time_zone_sid_key",
        "recurrence_type",
        "referral_account_c",
        "referral_contact_c",
        "reminder_date_time",
        "sales_loft_cadence_id_c",
        "sales_loft_cadence_name_c",
        "sales_loft_clicked_count_c",
        "sales_loft_email_template_id_c",
        "sales_loft_email_template_title_c",
        "sales_loft_external_identifier_c",
        "sales_loft_reply_count_c",
        "sales_loft_step_day_new_c",
        "sales_loft_step_id_c",
        "sales_loft_step_name_c",
        "sales_loft_step_type_c",
        "sales_loft_viewed_count_c",
        "status",
        "subject",
        "system_modstamp",
        "task_subtype",
        "topic_c",
        "type",
        "vidyard_c",
        "what_count",
        "what_id",
        "who_count",
        "who_id"
    FROM "sf_task_data_removeWideColumns"
),

"sf_task_data_removeWideColumns_projected_renamed" AS (
    -- Rename: Renaming columns
    -- _fivetran_active -> is_active
    -- affectlayer_affect_layer_call_id_c -> affect_layer_call_id
    -- affectlayer_chorus_call_id_c -> chorus_call_id
    -- assigned_to_name_c -> assigned_to_name
    -- assigned_to_role_c -> assigned_to_role
    -- associated_sdr_c -> associated_sdr
    -- attendance_number_c -> attendance_number
    -- bizible_2_bizible_id_c -> bizible_id
    -- bizible_2_bizible_touchpoint_date_c -> bizible_touchpoint_date
    -- call_disposition_2_c -> call_disposition_secondary
    -- call_disposition_c -> call_disposition_custom
    -- call_duration_in_seconds -> call_duration_seconds
    -- call_recording_c -> call_recording
    -- campaign_c -> campaign
    -- co_sell_partner_account_c -> co_sell_partner_account
    -- co_selling_activity_c -> is_co_selling_activity
    -- collections_hold_c -> is_collections_hold
    -- description_c -> description_custom
    -- duration_in_minutes_c -> duration_minutes
    -- event_name_c -> event_name
    -- execute_collections_plan_activity_c -> is_collections_plan_activity
    -- expected_payment_date_c -> expected_payment_date
    -- first_meeting_c -> first_meeting_date
    -- first_meeting_held_c -> first_meeting_held
    -- how_did_you_bring_value_or_create_trust_c -> value_creation_description
    -- how_did_you_bring_value_or_earn_trust_c -> trust_earning_description
    -- invitee_uuid_c -> invitee_uuid
    -- is_a_co_sell_activity_c -> is_co_sell_activity
    -- is_recurrence -> is_recurring
    -- is_reminder_set -> has_reminder
    -- last_rep_activity_date_c -> last_rep_activity_date
    -- legacy_hvr_id_c -> legacy_hvr_id
    -- lid_date_sent_c -> lid_sent_date
    -- lid_url_c -> lid_url
    -- meeting_name_c -> meeting_name
    -- meeting_type_c -> meeting_type
    -- no_show_c -> is_no_show
    -- opportunity_c -> opportunity_id
    -- partner_account_c -> partner_account_id
    -- partner_activity_type_c -> partner_activity_type
    -- partner_contact_c -> partner_contact_id
    -- proof_of_referral_c -> proof_of_referral
    -- recurrence_day_of_week_mask -> recurrence_weekday_mask
    -- recurrence_end_date_only -> recurrence_end_date
    -- recurrence_month_of_year -> recurrence_month
    -- recurrence_regenerated_type -> recurrence_regeneration_type
    -- recurrence_start_date_only -> recurrence_start_date
    -- recurrence_time_zone_sid_key -> recurrence_timezone
    -- referral_account_c -> referral_account_id
    -- referral_contact_c -> referral_contact_id
    -- reminder_date_time -> reminder_datetime
    -- sales_loft_cadence_id_c -> sales_loft_cadence_id
    -- sales_loft_cadence_name_c -> sales_loft_cadence_name
    -- sales_loft_clicked_count_c -> sales_loft_click_count
    -- sales_loft_email_template_id_c -> sales_loft_email_template_id
    -- sales_loft_email_template_title_c -> sales_loft_email_template_title
    -- sales_loft_external_identifier_c -> sales_loft_external_id
    -- sales_loft_reply_count_c -> sales_loft_reply_count
    -- sales_loft_step_day_new_c -> sales_loft_step_day
    -- sales_loft_step_id_c -> sales_loft_step_id
    -- sales_loft_step_name_c -> sales_loft_step_name
    -- sales_loft_step_type_c -> sales_loft_step_type
    -- sales_loft_viewed_count_c -> sales_loft_view_count
    -- topic_c -> task_topic
    -- type -> task_type
    -- vidyard_c -> has_vidyard_video
    -- what_count -> associated_object_count
    -- what_id -> associated_object_id
    -- who_count -> associated_person_count
    -- who_id -> associated_person_id
    SELECT 
        "_fivetran_active" AS "is_active",
        "account_id",
        "activity_date",
        "affectlayer_affect_layer_call_id_c" AS "affect_layer_call_id",
        "affectlayer_chorus_call_id_c" AS "chorus_call_id",
        "assigned_to_name_c" AS "assigned_to_name",
        "assigned_to_role_c" AS "assigned_to_role",
        "associated_sdr_c" AS "associated_sdr",
        "attendance_number_c" AS "attendance_number",
        "bizible_2_bizible_id_c" AS "bizible_id",
        "bizible_2_bizible_touchpoint_date_c" AS "bizible_touchpoint_date",
        "call_disposition",
        "call_disposition_2_c" AS "call_disposition_secondary",
        "call_disposition_c" AS "call_disposition_custom",
        "call_duration_in_seconds" AS "call_duration_seconds",
        "call_object",
        "call_recording_c" AS "call_recording",
        "call_type",
        "campaign_c" AS "campaign",
        "co_sell_partner_account_c" AS "co_sell_partner_account",
        "co_selling_activity_c" AS "is_co_selling_activity",
        "collections_hold_c" AS "is_collections_hold",
        "completed_date_time",
        "created_by_id",
        "created_date",
        "description",
        "description_c" AS "description_custom",
        "duration_in_minutes_c" AS "duration_minutes",
        "event_name_c" AS "event_name",
        "execute_collections_plan_activity_c" AS "is_collections_plan_activity",
        "expected_payment_date_c" AS "expected_payment_date",
        "first_meeting_c" AS "first_meeting_date",
        "first_meeting_held_c" AS "first_meeting_held",
        "how_did_you_bring_value_or_create_trust_c" AS "value_creation_description",
        "how_did_you_bring_value_or_earn_trust_c" AS "trust_earning_description",
        "id",
        "invitee_uuid_c" AS "invitee_uuid",
        "is_a_co_sell_activity_c" AS "is_co_sell_activity",
        "is_archived",
        "is_closed",
        "is_deleted",
        "is_high_priority",
        "is_recurrence" AS "is_recurring",
        "is_reminder_set" AS "has_reminder",
        "last_modified_by_id",
        "last_modified_date",
        "last_rep_activity_date_c" AS "last_rep_activity_date",
        "legacy_hvr_id_c" AS "legacy_hvr_id",
        "lid_date_sent_c" AS "lid_sent_date",
        "lid_url_c" AS "lid_url",
        "meeting_name_c" AS "meeting_name",
        "meeting_type_c" AS "meeting_type",
        "no_show_c" AS "is_no_show",
        "opportunity_c" AS "opportunity_id",
        "owner_id",
        "partner_account_c" AS "partner_account_id",
        "partner_activity_type_c" AS "partner_activity_type",
        "partner_contact_c" AS "partner_contact_id",
        "priority",
        "proof_of_referral_c" AS "proof_of_referral",
        "record_type_id",
        "recurrence_activity_id",
        "recurrence_day_of_month",
        "recurrence_day_of_week_mask" AS "recurrence_weekday_mask",
        "recurrence_end_date_only" AS "recurrence_end_date",
        "recurrence_instance",
        "recurrence_interval",
        "recurrence_month_of_year" AS "recurrence_month",
        "recurrence_regenerated_type" AS "recurrence_regeneration_type",
        "recurrence_start_date_only" AS "recurrence_start_date",
        "recurrence_time_zone_sid_key" AS "recurrence_timezone",
        "recurrence_type",
        "referral_account_c" AS "referral_account_id",
        "referral_contact_c" AS "referral_contact_id",
        "reminder_date_time" AS "reminder_datetime",
        "sales_loft_cadence_id_c" AS "sales_loft_cadence_id",
        "sales_loft_cadence_name_c" AS "sales_loft_cadence_name",
        "sales_loft_clicked_count_c" AS "sales_loft_click_count",
        "sales_loft_email_template_id_c" AS "sales_loft_email_template_id",
        "sales_loft_email_template_title_c" AS "sales_loft_email_template_title",
        "sales_loft_external_identifier_c" AS "sales_loft_external_id",
        "sales_loft_reply_count_c" AS "sales_loft_reply_count",
        "sales_loft_step_day_new_c" AS "sales_loft_step_day",
        "sales_loft_step_id_c" AS "sales_loft_step_id",
        "sales_loft_step_name_c" AS "sales_loft_step_name",
        "sales_loft_step_type_c" AS "sales_loft_step_type",
        "sales_loft_viewed_count_c" AS "sales_loft_view_count",
        "status",
        "subject",
        "system_modstamp",
        "task_subtype",
        "topic_c" AS "task_topic",
        "type" AS "task_type",
        "vidyard_c" AS "has_vidyard_video",
        "what_count" AS "associated_object_count",
        "what_id" AS "associated_object_id",
        "who_count" AS "associated_person_count",
        "who_id" AS "associated_person_id"
    FROM "sf_task_data_removeWideColumns_projected"
),

"sf_task_data_removeWideColumns_projected_renamed_cleaned" AS (
    -- Clean unusual string values: 
    -- assigned_to_name: The problem is that 'fivetran ae' is in all lowercase and uses an uncommon abbreviation 'ae'. In a professional context, it's likely that this should be properly capitalized and the abbreviation expanded. 'AE' typically stands for 'Account Executive' in business contexts. The correct value should be properly capitalized and use the full job title. 
    -- assigned_to_role: The problem is that 'X' is a non-descriptive placeholder value that doesn't indicate a specific role assignment. It's likely being used to denote that a role has not been assigned or the assignment is unknown. The correct value for an unassigned or unknown role would be an empty string or null value. 
    -- task_type: The problem is that 'X' is the only value present in the task_type column, and it's not descriptive of any typical task type. 'X' is likely a placeholder or an error code, rather than a meaningful task type. Without more context about the nature of the tasks in the dataset, it's impossible to determine what the correct task types should be. In this case, the best approach is to map this placeholder to an empty string, indicating that the true task type is unknown or not specified. 
    SELECT
        "is_active",
        "account_id",
        "activity_date",
        "affect_layer_call_id",
        "chorus_call_id",
        CASE
            WHEN "assigned_to_name" = 'fivetran ae' THEN 'Fivetran Account Executive'
            ELSE "assigned_to_name"
        END AS "assigned_to_name",
        CASE
            WHEN "assigned_to_role" = 'X' THEN ''
            ELSE "assigned_to_role"
        END AS "assigned_to_role",
        "associated_sdr",
        "attendance_number",
        "bizible_id",
        "bizible_touchpoint_date",
        "call_disposition",
        "call_disposition_secondary",
        "call_disposition_custom",
        "call_duration_seconds",
        "call_object",
        "call_recording",
        "call_type",
        "campaign",
        "co_sell_partner_account",
        "is_co_selling_activity",
        "is_collections_hold",
        "completed_date_time",
        "created_by_id",
        "created_date",
        "description",
        "description_custom",
        "duration_minutes",
        "event_name",
        "is_collections_plan_activity",
        "expected_payment_date",
        "first_meeting_date",
        "first_meeting_held",
        "value_creation_description",
        "trust_earning_description",
        "id",
        "invitee_uuid",
        "is_co_sell_activity",
        "is_archived",
        "is_closed",
        "is_deleted",
        "is_high_priority",
        "is_recurring",
        "has_reminder",
        "last_modified_by_id",
        "last_modified_date",
        "last_rep_activity_date",
        "legacy_hvr_id",
        "lid_sent_date",
        "lid_url",
        "meeting_name",
        "meeting_type",
        "is_no_show",
        "opportunity_id",
        "owner_id",
        "partner_account_id",
        "partner_activity_type",
        "partner_contact_id",
        "priority",
        "proof_of_referral",
        "record_type_id",
        "recurrence_activity_id",
        "recurrence_day_of_month",
        "recurrence_weekday_mask",
        "recurrence_end_date",
        "recurrence_instance",
        "recurrence_interval",
        "recurrence_month",
        "recurrence_regeneration_type",
        "recurrence_start_date",
        "recurrence_timezone",
        "recurrence_type",
        "referral_account_id",
        "referral_contact_id",
        "reminder_datetime",
        "sales_loft_cadence_id",
        "sales_loft_cadence_name",
        "sales_loft_click_count",
        "sales_loft_email_template_id",
        "sales_loft_email_template_title",
        "sales_loft_external_id",
        "sales_loft_reply_count",
        "sales_loft_step_day",
        "sales_loft_step_id",
        "sales_loft_step_name",
        "sales_loft_step_type",
        "sales_loft_view_count",
        "status",
        "subject",
        "system_modstamp",
        "task_subtype",
        "task_topic",
        CASE
            WHEN "task_type" = 'X' THEN ''
            ELSE "task_type"
        END AS "task_type",
        "has_vidyard_video",
        "associated_object_count",
        "associated_object_id",
        "associated_person_count",
        "associated_person_id"
    FROM "sf_task_data_removeWideColumns_projected_renamed"
),

"sf_task_data_removeWideColumns_projected_renamed_cleaned_null" AS (
    -- NULL Imputation: Impute Null to Disguised Missing Values
    -- assigned_to_role: ['']
    -- task_type: ['']
    SELECT 
        CASE
            WHEN "assigned_to_role" = '' THEN NULL
            ELSE "assigned_to_role"
        END AS "assigned_to_role",
        CASE
            WHEN "task_type" = '' THEN NULL
            ELSE "task_type"
        END AS "task_type",
        "is_co_sell_activity",
        "recurrence_day_of_month",
        "account_id",
        "legacy_hvr_id",
        "duration_minutes",
        "value_creation_description",
        "recurrence_regeneration_type",
        "chorus_call_id",
        "assigned_to_name",
        "recurrence_timezone",
        "recurrence_end_date",
        "affect_layer_call_id",
        "associated_person_count",
        "recurrence_activity_id",
        "recurrence_weekday_mask",
        "subject",
        "recurrence_interval",
        "call_type",
        "associated_sdr",
        "trust_earning_description",
        "first_meeting_date",
        "call_disposition",
        "call_duration_seconds",
        "created_by_id",
        "partner_account_id",
        "sales_loft_step_name",
        "id",
        "lid_url",
        "partner_contact_id",
        "is_archived",
        "sales_loft_step_id",
        "sales_loft_cadence_name",
        "sales_loft_external_id",
        "description_custom",
        "activity_date",
        "sales_loft_view_count",
        "partner_activity_type",
        "referral_account_id",
        "opportunity_id",
        "last_modified_by_id",
        "priority",
        "sales_loft_reply_count",
        "system_modstamp",
        "sales_loft_email_template_title",
        "reminder_datetime",
        "invitee_uuid",
        "record_type_id",
        "is_collections_hold",
        "call_recording",
        "is_active",
        "associated_object_id",
        "meeting_type",
        "meeting_name",
        "description",
        "attendance_number",
        "sales_loft_step_type",
        "has_vidyard_video",
        "last_modified_date",
        "is_no_show",
        "sales_loft_step_day",
        "status",
        "recurrence_month",
        "event_name",
        "sales_loft_click_count",
        "call_disposition_custom",
        "is_collections_plan_activity",
        "completed_date_time",
        "is_closed",
        "referral_contact_id",
        "expected_payment_date",
        "last_rep_activity_date",
        "recurrence_instance",
        "campaign",
        "associated_object_count",
        "call_disposition_secondary",
        "is_co_selling_activity",
        "recurrence_start_date",
        "task_topic",
        "is_high_priority",
        "proof_of_referral",
        "sales_loft_email_template_id",
        "bizible_id",
        "recurrence_type",
        "owner_id",
        "co_sell_partner_account",
        "bizible_touchpoint_date",
        "is_recurring",
        "is_deleted",
        "associated_person_id",
        "task_subtype",
        "call_object",
        "first_meeting_held",
        "has_reminder",
        "created_date",
        "sales_loft_cadence_id",
        "lid_sent_date"
    FROM "sf_task_data_removeWideColumns_projected_renamed_cleaned"
),

"sf_task_data_removeWideColumns_projected_renamed_cleaned_null_casted" AS (
    -- Column Type Casting: 
    -- activity_date: from VARCHAR to TIMESTAMP
    -- affect_layer_call_id: from DECIMAL to VARCHAR
    -- associated_sdr: from DECIMAL to VARCHAR
    -- attendance_number: from DECIMAL to VARCHAR
    -- bizible_id: from DECIMAL to VARCHAR
    -- bizible_touchpoint_date: from DECIMAL to VARCHAR
    -- call_disposition: from DECIMAL to VARCHAR
    -- call_disposition_custom: from DECIMAL to VARCHAR
    -- call_disposition_secondary: from DECIMAL to VARCHAR
    -- call_duration_seconds: from DECIMAL to VARCHAR
    -- call_object: from DECIMAL to VARCHAR
    -- call_recording: from DECIMAL to VARCHAR
    -- call_type: from DECIMAL to VARCHAR
    -- campaign: from DECIMAL to VARCHAR
    -- chorus_call_id: from DECIMAL to VARCHAR
    -- co_sell_partner_account: from DECIMAL to VARCHAR
    -- completed_date_time: from VARCHAR to TIMESTAMP
    -- created_date: from VARCHAR to TIMESTAMP
    -- description_custom: from DECIMAL to VARCHAR
    -- duration_minutes: from DECIMAL to VARCHAR
    -- event_name: from DECIMAL to VARCHAR
    -- expected_payment_date: from DECIMAL to DATE
    -- first_meeting_date: from DECIMAL to DATE
    -- first_meeting_held: from DECIMAL to TIMESTAMP
    -- invitee_uuid: from DECIMAL to UUID
    -- is_active: from DECIMAL to BOOLEAN
    -- is_co_sell_activity: from DECIMAL to BOOLEAN
    -- is_co_selling_activity: from DECIMAL to BOOLEAN
    -- last_modified_date: from VARCHAR to TIMESTAMP
    -- last_rep_activity_date: from DECIMAL to DATE
    -- legacy_hvr_id: from DECIMAL to VARCHAR
    -- lid_sent_date: from DECIMAL to DATE
    -- lid_url: from DECIMAL to VARCHAR
    -- opportunity_id: from DECIMAL to VARCHAR
    -- partner_account_id: from DECIMAL to VARCHAR
    -- partner_activity_type: from DECIMAL to VARCHAR
    -- partner_contact_id: from DECIMAL to VARCHAR
    -- proof_of_referral: from DECIMAL to VARCHAR
    -- recurrence_activity_id: from DECIMAL to VARCHAR
    -- recurrence_day_of_month: from DECIMAL to INT
    -- recurrence_end_date: from DECIMAL to DATE
    -- recurrence_instance: from DECIMAL to VARCHAR
    -- recurrence_interval: from DECIMAL to INT
    -- recurrence_month: from DECIMAL to INT
    -- recurrence_regeneration_type: from DECIMAL to VARCHAR
    -- recurrence_start_date: from DECIMAL to DATE
    -- recurrence_timezone: from DECIMAL to VARCHAR
    -- recurrence_type: from DECIMAL to VARCHAR
    -- recurrence_weekday_mask: from DECIMAL to INT
    -- referral_account_id: from DECIMAL to VARCHAR
    -- referral_contact_id: from DECIMAL to VARCHAR
    -- reminder_datetime: from DECIMAL to TIMESTAMP
    -- sales_loft_cadence_id: from DECIMAL to VARCHAR
    -- sales_loft_cadence_name: from DECIMAL to VARCHAR
    -- sales_loft_click_count: from DECIMAL to INT
    -- sales_loft_email_template_id: from DECIMAL to VARCHAR
    -- sales_loft_email_template_title: from DECIMAL to VARCHAR
    -- sales_loft_external_id: from DECIMAL to VARCHAR
    -- sales_loft_reply_count: from DECIMAL to INT
    -- sales_loft_step_day: from DECIMAL to INT
    -- sales_loft_step_id: from DECIMAL to VARCHAR
    -- sales_loft_step_name: from DECIMAL to VARCHAR
    -- sales_loft_step_type: from DECIMAL to VARCHAR
    -- sales_loft_view_count: from DECIMAL to INT
    -- system_modstamp: from VARCHAR to TIMESTAMP
    -- task_topic: from DECIMAL to VARCHAR
    -- trust_earning_description: from DECIMAL to VARCHAR
    -- value_creation_description: from DECIMAL to VARCHAR
    SELECT
        "assigned_to_role",
        "task_type",
        "account_id",
        "assigned_to_name",
        "associated_person_count",
        "subject",
        "created_by_id",
        "id",
        "is_archived",
        "last_modified_by_id",
        "priority",
        "record_type_id",
        "is_collections_hold",
        "associated_object_id",
        "meeting_type",
        "meeting_name",
        "description",
        "has_vidyard_video",
        "is_no_show",
        "status",
        "is_collections_plan_activity",
        "is_closed",
        "associated_object_count",
        "is_high_priority",
        "owner_id",
        "is_recurring",
        "is_deleted",
        "associated_person_id",
        "task_subtype",
        "has_reminder",
        CAST("activity_date" AS TIMESTAMP) AS "activity_date",
        CAST("affect_layer_call_id" AS VARCHAR) AS "affect_layer_call_id",
        CAST("associated_sdr" AS VARCHAR) AS "associated_sdr",
        CAST("attendance_number" AS VARCHAR) AS "attendance_number",
        CAST("bizible_id" AS VARCHAR) AS "bizible_id",
        CAST("bizible_touchpoint_date" AS VARCHAR) AS "bizible_touchpoint_date",
        CAST("call_disposition" AS VARCHAR) AS "call_disposition",
        CAST("call_disposition_custom" AS VARCHAR) AS "call_disposition_custom",
        CAST("call_disposition_secondary" AS VARCHAR) AS "call_disposition_secondary",
        CAST("call_duration_seconds" AS VARCHAR) AS "call_duration_seconds",
        CAST("call_object" AS VARCHAR) AS "call_object",
        CAST("call_recording" AS VARCHAR) AS "call_recording",
        CAST("call_type" AS VARCHAR) AS "call_type",
        CAST("campaign" AS VARCHAR) AS "campaign",
        CAST("chorus_call_id" AS VARCHAR) AS "chorus_call_id",
        CAST("co_sell_partner_account" AS VARCHAR) AS "co_sell_partner_account",
        CAST("completed_date_time" AS TIMESTAMP) AS "completed_date_time",
        CAST("created_date" AS TIMESTAMP) AS "created_date",
        CAST("description_custom" AS VARCHAR) AS "description_custom",
        CAST("duration_minutes" AS VARCHAR) AS "duration_minutes",
        CAST("event_name" AS VARCHAR) AS "event_name",
        CAST("expected_payment_date" AS DATE) AS "expected_payment_date",
        CAST("first_meeting_date" AS DATE) AS "first_meeting_date",
        CAST("first_meeting_held" AS TIMESTAMP) AS "first_meeting_held",
        CAST("invitee_uuid" AS UUID) AS "invitee_uuid",
        CAST("is_active" AS BOOLEAN) AS "is_active",
        CAST("is_co_sell_activity" AS BOOLEAN) AS "is_co_sell_activity",
        CAST("is_co_selling_activity" AS BOOLEAN) AS "is_co_selling_activity",
        CAST("last_modified_date" AS TIMESTAMP) AS "last_modified_date",
        CAST("last_rep_activity_date" AS DATE) AS "last_rep_activity_date",
        CAST("legacy_hvr_id" AS VARCHAR) AS "legacy_hvr_id",
        CAST("lid_sent_date" AS DATE) AS "lid_sent_date",
        CAST("lid_url" AS VARCHAR) AS "lid_url",
        CAST("opportunity_id" AS VARCHAR) AS "opportunity_id",
        CAST("partner_account_id" AS VARCHAR) AS "partner_account_id",
        CAST("partner_activity_type" AS VARCHAR) AS "partner_activity_type",
        CAST("partner_contact_id" AS VARCHAR) AS "partner_contact_id",
        CAST("proof_of_referral" AS VARCHAR) AS "proof_of_referral",
        CAST("recurrence_activity_id" AS VARCHAR) AS "recurrence_activity_id",
        CAST("recurrence_day_of_month" AS INT) AS "recurrence_day_of_month",
        CAST("recurrence_end_date" AS DATE) AS "recurrence_end_date",
        CAST("recurrence_instance" AS VARCHAR) AS "recurrence_instance",
        CAST("recurrence_interval" AS INT) AS "recurrence_interval",
        CAST("recurrence_month" AS INT) AS "recurrence_month",
        CAST("recurrence_regeneration_type" AS VARCHAR) AS "recurrence_regeneration_type",
        CAST("recurrence_start_date" AS DATE) AS "recurrence_start_date",
        CAST("recurrence_timezone" AS VARCHAR) AS "recurrence_timezone",
        CAST("recurrence_type" AS VARCHAR) AS "recurrence_type",
        CAST("recurrence_weekday_mask" AS INT) AS "recurrence_weekday_mask",
        CAST("referral_account_id" AS VARCHAR) AS "referral_account_id",
        CAST("referral_contact_id" AS VARCHAR) AS "referral_contact_id",
        CAST("reminder_datetime" AS TIMESTAMP) AS "reminder_datetime",
        CAST("sales_loft_cadence_id" AS VARCHAR) AS "sales_loft_cadence_id",
        CAST("sales_loft_cadence_name" AS VARCHAR) AS "sales_loft_cadence_name",
        CAST("sales_loft_click_count" AS INT) AS "sales_loft_click_count",
        CAST("sales_loft_email_template_id" AS VARCHAR) AS "sales_loft_email_template_id",
        CAST("sales_loft_email_template_title" AS VARCHAR) AS "sales_loft_email_template_title",
        CAST("sales_loft_external_id" AS VARCHAR) AS "sales_loft_external_id",
        CAST("sales_loft_reply_count" AS INT) AS "sales_loft_reply_count",
        CAST("sales_loft_step_day" AS INT) AS "sales_loft_step_day",
        CAST("sales_loft_step_id" AS VARCHAR) AS "sales_loft_step_id",
        CAST("sales_loft_step_name" AS VARCHAR) AS "sales_loft_step_name",
        CAST("sales_loft_step_type" AS VARCHAR) AS "sales_loft_step_type",
        CAST("sales_loft_view_count" AS INT) AS "sales_loft_view_count",
        CAST("system_modstamp" AS TIMESTAMP) AS "system_modstamp",
        CAST("task_topic" AS VARCHAR) AS "task_topic",
        CAST("trust_earning_description" AS VARCHAR) AS "trust_earning_description",
        CAST("value_creation_description" AS VARCHAR) AS "value_creation_description"
    FROM "sf_task_data_removeWideColumns_projected_renamed_cleaned_null"
),

"sf_task_data_removeWideColumns_projected_renamed_cleaned_null_casted_missing_handled" AS (
    -- Handling missing values: There are 25 columns with unacceptable missing values
    -- account_id has 10.0 percent missing. Strategy: 🔄 Unchanged
    -- assigned_to_role has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- associated_object_id has 30.0 percent missing. Strategy: 🔄 Unchanged
    -- associated_sdr has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- description_custom has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- expected_payment_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- first_meeting_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- first_meeting_held has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- is_active has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_rep_activity_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- legacy_hvr_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lid_sent_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lid_url has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- opportunity_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- partner_account_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- partner_activity_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- partner_contact_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- proof_of_referral has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- referral_account_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- referral_contact_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- reminder_datetime has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- task_topic has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- task_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- trust_earning_description has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- value_creation_description has 100.0 percent missing. Strategy: 🗑️ Drop Column
    SELECT
        "account_id",
        "assigned_to_name",
        "associated_person_count",
        "subject",
        "created_by_id",
        "id",
        "is_archived",
        "last_modified_by_id",
        "priority",
        "record_type_id",
        "is_collections_hold",
        "associated_object_id",
        "meeting_type",
        "meeting_name",
        "description",
        "has_vidyard_video",
        "is_no_show",
        "status",
        "is_collections_plan_activity",
        "is_closed",
        "associated_object_count",
        "is_high_priority",
        "owner_id",
        "is_recurring",
        "is_deleted",
        "associated_person_id",
        "task_subtype",
        "has_reminder",
        "activity_date",
        "affect_layer_call_id",
        "attendance_number",
        "bizible_id",
        "bizible_touchpoint_date",
        "call_disposition",
        "call_disposition_custom",
        "call_disposition_secondary",
        "call_duration_seconds",
        "call_object",
        "call_recording",
        "call_type",
        "campaign",
        "chorus_call_id",
        "co_sell_partner_account",
        "completed_date_time",
        "created_date",
        "duration_minutes",
        "event_name",
        "invitee_uuid",
        "is_co_sell_activity",
        "is_co_selling_activity",
        "last_modified_date",
        "recurrence_activity_id",
        "recurrence_day_of_month",
        "recurrence_end_date",
        "recurrence_instance",
        "recurrence_interval",
        "recurrence_month",
        "recurrence_regeneration_type",
        "recurrence_start_date",
        "recurrence_timezone",
        "recurrence_type",
        "recurrence_weekday_mask",
        "sales_loft_cadence_id",
        "sales_loft_cadence_name",
        "sales_loft_click_count",
        "sales_loft_email_template_id",
        "sales_loft_email_template_title",
        "sales_loft_external_id",
        "sales_loft_reply_count",
        "sales_loft_step_day",
        "sales_loft_step_id",
        "sales_loft_step_name",
        "sales_loft_step_type",
        "sales_loft_view_count",
        "system_modstamp"
    FROM "sf_task_data_removeWideColumns_projected_renamed_cleaned_null_casted"
)

-- COCOON BLOCK END
SELECT * FROM "sf_task_data_removeWideColumns_projected_renamed_cleaned_null_casted_missing_handled"

stg_sf_task_data.yml (Document the table)

version: 2
models:
- name: stg_sf_task_data
  description: The table is about task data, likely from a CRM system. It contains
    details such as task ID, account ID, assigned user, task type, status, creation
    date, and completion date. The table also includes information about task priority,
    description, and associated contacts or opportunities. Some fields suggest integration
    with external tools like Sales Loft or Vidyard.
  columns:
  - name: account_id
    description: Unique identifier for the associated account
    tests:
    - not_null
  - name: assigned_to_name
    description: Name of the person assigned to the task
    tests:
    - not_null
  - name: associated_person_count
    description: Count of associated persons (e.g., contacts)
    tests:
    - not_null
  - name: subject
    description: Subject or title of the task
    tests:
    - not_null
  - name: created_by_id
    description: ID of the user who created the task
    tests:
    - not_null
  - name: id
    description: Unique identifier for the task
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column represents a unique identifier for each task. For this
        table, each row is a distinct task, and the id appears to be unique across
        rows.
  - name: is_archived
    description: Indicates if the task is archived
    tests:
    - not_null
  - name: last_modified_by_id
    description: ID of user who last modified
    tests:
    - not_null
  - name: priority
    description: Priority level of the task
    tests:
    - not_null
    - accepted_values:
        values:
        - Low
        - Normal
        - High
        - Urgent
        - Critical
  - name: record_type_id
    description: Unique identifier for the record type
    tests:
    - not_null
  - name: is_collections_hold
    description: Indicates if collections are on hold
    tests:
    - not_null
  - name: associated_object_id
    description: ID of the associated object (e.g., opportunity)
    tests:
    - not_null
  - name: meeting_type
    description: Type of meeting
    tests:
    - accepted_values:
        values:
        - Default Personal Meeting
        - Team Meeting
        - Client Meeting
        - Project Review
        - Brainstorming Session
        - One-on-One
        - Board Meeting
        - All-Hands Meeting
        - Training Session
        - Interview
        - Performance Review
        - Sales Pitch
        - Conference Call
        - Webinar
        - Workshop
    cocoon_meta:
      missing_acceptable: Not applicable for activities that aren't meetings
  - name: meeting_name
    description: Name of the meeting
    tests:
    - accepted_values:
        values:
        - sync
        - reconnect
        - brainstorm
        - planning
        - review
        - kickoff
        - status update
        - training
        - onboarding
        - interview
        - performance review
        - project update
        - client meeting
        - team building
        - strategy session
        - decision making
        - problem solving
        - presentation
        - workshop
        - retrospective
    cocoon_meta:
      missing_acceptable: Not applicable for activities that aren't meetings
  - name: description
    description: Description of the task
    tests:
    - not_null
  - name: has_vidyard_video
    description: Indicates if Vidyard video is associated
    tests:
    - not_null
  - name: is_no_show
    description: Indicates if there was a no-show
    tests:
    - not_null
  - name: status
    description: Current status of the task
    tests:
    - not_null
    - accepted_values:
        values:
        - Not Started
        - In Progress
        - On Hold
        - Completed
        - Cancelled
  - name: is_collections_plan_activity
    description: Indicates if it's a collections plan activity
    tests:
    - not_null
  - name: is_closed
    description: Indicates if the task is closed
    tests:
    - not_null
  - name: associated_object_count
    description: Count of associated objects (e.g., opportunities)
    tests:
    - not_null
  - name: is_high_priority
    description: Indicates if the task is high priority
    tests:
    - not_null
  - name: owner_id
    description: ID of the task owner
    tests:
    - not_null
  - name: is_recurring
    description: Indicates if the task is recurring
    tests:
    - not_null
  - name: is_deleted
    description: Indicates if the task is deleted
    tests:
    - not_null
  - name: associated_person_id
    description: ID of the associated person (e.g., contact)
    tests:
    - not_null
  - name: task_subtype
    description: Specific category or subtype of the task
    tests:
    - not_null
  - name: has_reminder
    description: Indicates if a reminder is set
    tests:
    - not_null
  - name: activity_date
    description: Date and time of the activity
    tests:
    - not_null
  - name: affect_layer_call_id
    description: Identifier for AffectLayer call
    cocoon_meta:
      missing_acceptable: Not applicable for non-call activities.
  - name: attendance_number
    description: Number of attendees for the activity
    cocoon_meta:
      missing_acceptable: Not applicable for non-event activities.
  - name: bizible_id
    description: Bizible identifier
    cocoon_meta:
      missing_acceptable: Not applicable for activities without marketing attribution.
  - name: bizible_touchpoint_date
    description: Date of Bizible touchpoint
    cocoon_meta:
      missing_acceptable: Not applicable for activities without marketing attribution.
  - name: call_disposition
    description: Outcome or result of the call
    cocoon_meta:
      missing_acceptable: Not applicable for non-call activities.
  - name: call_disposition_custom
    description: Custom call disposition field
    cocoon_meta:
      missing_acceptable: Not applicable for non-call activities.
  - name: call_disposition_secondary
    description: Secondary call disposition
    cocoon_meta:
      missing_acceptable: Not applicable for non-call activities.
  - name: call_duration_seconds
    description: Duration of the call in seconds
    cocoon_meta:
      missing_acceptable: Not applicable for non-call activities.
  - name: call_object
    description: Object related to the call
    cocoon_meta:
      missing_acceptable: Not applicable for non-call activities.
  - name: call_recording
    description: Link or identifier for call recording
    cocoon_meta:
      missing_acceptable: Not applicable for non-call activities.
  - name: call_type
    description: Type or category of the call
    cocoon_meta:
      missing_acceptable: Not applicable for non-call activities.
  - name: campaign
    description: Associated campaign
    cocoon_meta:
      missing_acceptable: Not applicable for activities not associated with campaigns.
  - name: chorus_call_id
    description: Identifier for Chorus call
    cocoon_meta:
      missing_acceptable: Not applicable for non-call activities.
  - name: co_sell_partner_account
    description: Co-sell partner account
    cocoon_meta:
      missing_acceptable: Not applicable for non-co-sell activities.
  - name: completed_date_time
    description: Date and time when the task was completed
    tests:
    - not_null
  - name: created_date
    description: Date and time when the task was created
    tests:
    - not_null
  - name: duration_minutes
    description: Duration of the activity in minutes
    cocoon_meta:
      missing_acceptable: Not applicable for non-timed activities.
  - name: event_name
    description: Name of the associated event
    cocoon_meta:
      missing_acceptable: Not applicable for non-event activities.
  - name: invitee_uuid
    description: Unique identifier for the invitee
    cocoon_meta:
      missing_acceptable: Not applicable for activities without external invitees.
  - name: is_co_sell_activity
    description: Indicates if it's a co-sell activity
    cocoon_meta:
      missing_acceptable: Not applicable for standard (non-co-sell) activities.
  - name: is_co_selling_activity
    description: Indicates if it's a co-selling activity
    cocoon_meta:
      missing_acceptable: Not applicable for standard (non-co-sell) activities.
  - name: last_modified_date
    description: Date of last modification
    tests:
    - not_null
  - name: recurrence_activity_id
    description: ID of the recurring activity
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring activities
  - name: recurrence_day_of_month
    description: Day of the month for recurring tasks
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring activities
  - name: recurrence_end_date
    description: End date for recurring tasks
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring activities
  - name: recurrence_instance
    description: Instance of the recurring task
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring activities
  - name: recurrence_interval
    description: Interval between recurring tasks
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring activities
  - name: recurrence_month
    description: Month of the year for yearly tasks
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring activities
  - name: recurrence_regeneration_type
    description: Type of regeneration for recurring tasks
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring activities
  - name: recurrence_start_date
    description: Start date for recurring tasks
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring activities
  - name: recurrence_timezone
    description: Time zone identifier for recurring tasks
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring activities
  - name: recurrence_type
    description: Type of recurrence pattern
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring activities
  - name: recurrence_weekday_mask
    description: Bitmask for days of the week
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring activities
  - name: sales_loft_cadence_id
    description: Sales Loft cadence ID
    cocoon_meta:
      missing_acceptable: Not applicable for activities not in Sales Loft
  - name: sales_loft_cadence_name
    description: Name of Sales Loft cadence
    cocoon_meta:
      missing_acceptable: Not applicable for activities not in Sales Loft
  - name: sales_loft_click_count
    description: Number of clicks in Sales Loft
    cocoon_meta:
      missing_acceptable: Not applicable for activities not in Sales Loft
  - name: sales_loft_email_template_id
    description: Sales Loft email template ID
    cocoon_meta:
      missing_acceptable: Not applicable for activities not in Sales Loft
  - name: sales_loft_email_template_title
    description: Title of Sales Loft email template
    cocoon_meta:
      missing_acceptable: Not applicable for activities not in Sales Loft
  - name: sales_loft_external_id
    description: External identifier for Sales Loft
    cocoon_meta:
      missing_acceptable: Not applicable for activities not in Sales Loft
  - name: sales_loft_reply_count
    description: Number of replies in Sales Loft
    cocoon_meta:
      missing_acceptable: Not applicable for activities not in Sales Loft
  - name: sales_loft_step_day
    description: Day of Sales Loft step
    cocoon_meta:
      missing_acceptable: Not applicable for activities not in Sales Loft
  - name: sales_loft_step_id
    description: Sales Loft step ID
    cocoon_meta:
      missing_acceptable: Not applicable for activities not in Sales Loft
  - name: sales_loft_step_name
    description: Name of Sales Loft step
    cocoon_meta:
      missing_acceptable: Not applicable for activities not in Sales Loft
  - name: sales_loft_step_type
    description: Type of Sales Loft step
    cocoon_meta:
      missing_acceptable: Not applicable for activities not in Sales Loft
  - name: sales_loft_view_count
    description: Number of views in Sales Loft
    cocoon_meta:
      missing_acceptable: Not applicable for activities not in Sales Loft
  - name: system_modstamp
    description: System modification timestamp
    tests:
    - not_null

stg_sf_product_2_data (first 100 rows)

is_active record_type_id is_deleted last_modified_by_id product_name product_id created_by_id product_family netsuite_sync_in_progress netsuite_celigo_update netsuite_sync_error push_to_netsuite netsuite_item_type netsuite_subtype is_new asset_amendment_behavior asset_conversion billing_frequency billing_type block_pricing_field charge_type is_component is_cost_editable is_custom_configuration_required is_description_locked exclude_from_maintenance exclude_from_opportunity is_externally_configurable has_configuration_attributes has_consumption_schedule is_hidden hide_price_in_search_results include_in_maintenance create_new_quote_group is_non_discountable is_non_partner_discountable option_selection_method is_optional is_price_editable pricing_method is_pricing_method_editable is_quantity_editable is_reconfiguration_disabled subscription_base subscription_pricing_model subscription_term subscription_type is_taxable connector_type pro_type_discount dimension connector_status is_complimentary external_product_id billing_rule_id revenue_recognition_rule_id tax_rule_id is_proration_disabled enable_large_configuration is_test_mode_record skip_netsuite_export is_non_recurring is_archived celigo_last_modified_date created_date last_modified_at last_modified_date product_code sbqq_default_quantity_c
0 True 012370000005lzhAAA False 0051G0000060rE7QAI X 01t1G000002Uf3MQAS 0051G0000060rE7QAI X False False X False Non Inventory Sale noninventory-Sale False Default One per quote line Annual Advance Quantity Recurring False False False False False False False False False False False False False False False Click False False List False True False List Fixed Price 1.0 Renewable False chat False Function Alpha False 12345.0 a1L1G000002t4LAUAY a951G000000TQsMQAW a9D1G000000TefyUAC False NaN False False True False 2019-11-11 17:23:34 2019-11-11 17:23:34 2019-11-11 17:23:34 2019-11-11 17:23:34 1 1.0
1 False 012370000005lzhAAA False 00537000004EpGKAA0 X 01t1G000000bOtkQAE 0051G000005MzwaQAC None False False None False Non Inventory Sale noninventory-Sale False Default One per quote line None None Quantity None False False False False False False False False False False False False False False False Click False True List False True False List None NaN Renewable False finance False Connector General Availability False NaN None None None False False False False NaN NaN 2019-11-11 17:23:34 2019-11-11 17:23:34 2019-11-11 17:23:34 2019-11-11 17:23:34 2 1.0

stg_sf_product_2_data.sql (clean the table)

-- COCOON BLOCK START: PLEASE DO NOT MODIFY THIS BLOCK FOR SELF-MAINTENANCE
WITH 
"sf_product_2_data_projected" AS (
    -- Projection: Selecting 155 out of 156 columns
    -- Columns projected out: ['_fivetran_synced']
    SELECT 
        "last_referenced_date",
        "is_active",
        "description",
        "last_modified_date",
        "record_type_id",
        "product_code",
        "last_viewed_date",
        "is_deleted",
        "last_modified_by_id",
        "system_modstamp",
        "name",
        "id",
        "created_by_id",
        "created_date",
        "family",
        "max_volume_c",
        "min_volume_c",
        "request_name_c",
        "default_quantity_c",
        "account_c",
        "related_product_c",
        "picklist_value_c",
        "as_input_c",
        "as_output_c",
        "status_c",
        "number_of_quantity_installments",
        "number_of_revenue_installments",
        "quantity_installment_period",
        "quantity_schedule_type",
        "revenue_installment_period",
        "revenue_schedule_type",
        "connections_c",
        "event_volume_c",
        "roadmap_connections_c",
        "row_volume_c",
        "display_url",
        "external_data_source_id",
        "external_id",
        "quantity_unit_of_measure",
        "stock_keeping_unit",
        "features_c",
        "tier_3_price_c",
        "tier_2_price_c",
        "tier_4_price_c",
        "tier_1_price_c",
        "netsuite_conn_sync_in_progress_c",
        "netsuite_conn_celigo_update_c",
        "netsuite_conn_term_contract_pricing_type_c",
        "netsuite_conn_net_suite_id_c",
        "netsuite_conn_net_suite_sync_err_c",
        "netsuite_conn_push_to_net_suite_c",
        "netsuite_conn_item_category_c",
        "netsuite_conn_net_suite_item_type_c",
        "netsuite_conn_sub_type_c",
        "is_new_c",
        "product_metadata_c",
        "product_metadata_del_c",
        "sbqq_asset_amendment_behavior_c",
        "sbqq_asset_conversion_c",
        "sbqq_batch_quantity_c",
        "sbqq_billing_frequency_c",
        "sbqq_billing_type_c",
        "sbqq_block_pricing_field_c",
        "sbqq_charge_type_c",
        "sbqq_component_c",
        "sbqq_compound_discount_rate_c",
        "sbqq_configuration_event_c",
        "sbqq_configuration_field_set_c",
        "sbqq_configuration_fields_c",
        "sbqq_configuration_form_title_c",
        "sbqq_configuration_type_c",
        "sbqq_configuration_validator_c",
        "sbqq_configured_code_pattern_c",
        "sbqq_configured_description_pattern_c",
        "sbqq_cost_editable_c",
        "sbqq_cost_schedule_c",
        "sbqq_custom_configuration_page_c",
        "sbqq_custom_configuration_required_c",
        "sbqq_customer_community_availability_c",
        "sbqq_default_pricing_table_c",
        "sbqq_default_quantity_c",
        "sbqq_description_locked_c",
        "sbqq_discount_category_c",
        "sbqq_discount_schedule_c",
        "sbqq_dynamic_pricing_constraint_c",
        "sbqq_exclude_from_maintenance_c",
        "sbqq_exclude_from_opportunity_c",
        "sbqq_externally_configurable_c",
        "sbqq_generate_contracted_price_c",
        "sbqq_has_configuration_attributes_c",
        "sbqq_has_consumption_schedule_c",
        "sbqq_hidden_c",
        "sbqq_hide_price_in_search_results_c",
        "sbqq_include_in_maintenance_c",
        "sbqq_new_quote_group_c",
        "sbqq_non_discountable_c",
        "sbqq_non_partner_discountable_c",
        "sbqq_option_layout_c",
        "sbqq_option_selection_method_c",
        "sbqq_optional_c",
        "sbqq_price_editable_c",
        "sbqq_pricing_method_c",
        "sbqq_pricing_method_editable_c",
        "sbqq_product_picture_id_c",
        "sbqq_quantity_editable_c",
        "sbqq_quantity_scale_c",
        "sbqq_reconfiguration_disabled_c",
        "sbqq_renewal_product_c",
        "sbqq_sort_order_c",
        "sbqq_specifications_c",
        "sbqq_subscription_base_c",
        "sbqq_subscription_category_c",
        "sbqq_subscription_percent_c",
        "sbqq_subscription_pricing_c",
        "sbqq_subscription_target_c",
        "sbqq_subscription_term_c",
        "sbqq_subscription_type_c",
        "sbqq_tax_code_c",
        "sbqq_taxable_c",
        "sbqq_term_discount_level_c",
        "sbqq_term_discount_schedule_c",
        "sbqq_upgrade_credit_c",
        "sbqq_upgrade_ratio_c",
        "sbqq_upgrade_source_c",
        "sbqq_upgrade_target_c",
        "connector_type_c",
        "pbf_pro_type_discount_c",
        "dimension_c",
        "connector_status_c",
        "dimension_definition_c",
        "ava_sfcpq_tax_code_c",
        "paid_consumption_c",
        "is_complimentary_c",
        "product_external_id_c",
        "blng_billing_rule_c",
        "blng_revenue_recognition_rule_c",
        "blng_tax_rule_c",
        "deployment_date_c",
        "do_not_prorate_c",
        "celigo_sfnsio_netsuite_id_c",
        "sbqq_enable_large_configuration_c",
        "sbqq_pricing_guidance_c",
        "celigo_sfnsio_item_pricing_type_c",
        "celigo_sfnsio_test_mode_record_c",
        "celigo_sfnsio_celigo_last_modified_date_c",
        "celigo_sfnsio_net_suite_record_c",
        "celigo_sfnsio_skip_export_to_net_suite_c",
        "celigo_sfnsio_net_suite_item_type_c",
        "celigo_sfnsio_net_suite_id_c",
        "promo_code_c",
        "product_category_c",
        "product_source_c",
        "non_recurring_c",
        "is_archived",
        "_fivetran_active"
    FROM "sf_product_2_data"
),

"sf_product_2_data_projected_renamed" AS (
    -- Rename: Renaming columns
    -- system_modstamp -> last_modified_at
    -- name -> product_name
    -- id -> product_id
    -- family -> product_family
    -- max_volume_c -> max_volume
    -- min_volume_c -> min_volume
    -- request_name_c -> request_name
    -- account_c -> account_id
    -- related_product_c -> related_product_id
    -- picklist_value_c -> custom_picklist_value
    -- as_input_c -> accounting_system_input
    -- as_output_c -> accounting_system_output
    -- status_c -> product_status
    -- number_of_quantity_installments -> quantity_installments
    -- number_of_revenue_installments -> revenue_installments
    -- connections_c -> connection_count
    -- event_volume_c -> event_volume
    -- roadmap_connections_c -> roadmap_connections
    -- row_volume_c -> row_volume
    -- quantity_unit_of_measure -> quantity_unit
    -- features_c -> product_features
    -- tier_3_price_c -> tier_3_price
    -- tier_2_price_c -> tier_2_price
    -- tier_4_price_c -> tier_4_price
    -- tier_1_price_c -> tier_1_price
    -- netsuite_conn_sync_in_progress_c -> netsuite_sync_in_progress
    -- netsuite_conn_celigo_update_c -> netsuite_celigo_update
    -- netsuite_conn_term_contract_pricing_type_c -> netsuite_contract_pricing_type
    -- netsuite_conn_net_suite_id_c -> netsuite_id
    -- netsuite_conn_net_suite_sync_err_c -> netsuite_sync_error
    -- netsuite_conn_push_to_net_suite_c -> push_to_netsuite
    -- netsuite_conn_item_category_c -> netsuite_item_category
    -- netsuite_conn_net_suite_item_type_c -> netsuite_item_type
    -- netsuite_conn_sub_type_c -> netsuite_subtype
    -- is_new_c -> is_new
    -- product_metadata_c -> product_metadata
    -- product_metadata_del_c -> deleted_product_metadata
    -- sbqq_asset_amendment_behavior_c -> asset_amendment_behavior
    -- sbqq_asset_conversion_c -> asset_conversion
    -- sbqq_batch_quantity_c -> batch_quantity
    -- sbqq_billing_frequency_c -> billing_frequency
    -- sbqq_billing_type_c -> billing_type
    -- sbqq_block_pricing_field_c -> block_pricing_field
    -- sbqq_charge_type_c -> charge_type
    -- sbqq_component_c -> is_component
    -- sbqq_compound_discount_rate_c -> compound_discount_rate
    -- sbqq_configuration_event_c -> configuration_event
    -- sbqq_configuration_field_set_c -> configuration_field_set
    -- sbqq_configuration_fields_c -> configuration_fields
    -- sbqq_configuration_form_title_c -> configuration_form_title
    -- sbqq_configuration_type_c -> configuration_type
    -- sbqq_configuration_validator_c -> configuration_validator
    -- sbqq_configured_code_pattern_c -> configured_code_pattern
    -- sbqq_configured_description_pattern_c -> configured_description_pattern
    -- sbqq_cost_editable_c -> is_cost_editable
    -- sbqq_cost_schedule_c -> cost_schedule
    -- sbqq_custom_configuration_page_c -> custom_configuration_page
    -- sbqq_custom_configuration_required_c -> is_custom_configuration_required
    -- sbqq_customer_community_availability_c -> customer_community_availability
    -- sbqq_default_pricing_table_c -> default_pricing_table
    -- sbqq_description_locked_c -> is_description_locked
    -- sbqq_discount_category_c -> discount_category
    -- sbqq_discount_schedule_c -> discount_schedule
    -- sbqq_dynamic_pricing_constraint_c -> dynamic_pricing_constraint
    -- sbqq_exclude_from_maintenance_c -> exclude_from_maintenance
    -- sbqq_exclude_from_opportunity_c -> exclude_from_opportunity
    -- sbqq_externally_configurable_c -> is_externally_configurable
    -- sbqq_generate_contracted_price_c -> generate_contracted_price
    -- sbqq_has_configuration_attributes_c -> has_configuration_attributes
    -- sbqq_has_consumption_schedule_c -> has_consumption_schedule
    -- sbqq_hidden_c -> is_hidden
    -- sbqq_hide_price_in_search_results_c -> hide_price_in_search_results
    -- sbqq_include_in_maintenance_c -> include_in_maintenance
    -- sbqq_new_quote_group_c -> create_new_quote_group
    -- sbqq_non_discountable_c -> is_non_discountable
    -- sbqq_non_partner_discountable_c -> is_non_partner_discountable
    -- sbqq_option_layout_c -> option_layout
    -- sbqq_option_selection_method_c -> option_selection_method
    -- sbqq_optional_c -> is_optional
    -- sbqq_price_editable_c -> is_price_editable
    -- sbqq_pricing_method_c -> pricing_method
    -- sbqq_pricing_method_editable_c -> is_pricing_method_editable
    -- sbqq_product_picture_id_c -> product_picture_id
    -- sbqq_quantity_editable_c -> is_quantity_editable
    -- sbqq_quantity_scale_c -> quantity_scale
    -- sbqq_reconfiguration_disabled_c -> is_reconfiguration_disabled
    -- sbqq_renewal_product_c -> renewal_product
    -- sbqq_sort_order_c -> sort_order
    -- sbqq_specifications_c -> specifications
    -- sbqq_subscription_base_c -> subscription_base
    -- sbqq_subscription_category_c -> subscription_category
    -- sbqq_subscription_percent_c -> subscription_percent
    -- sbqq_subscription_pricing_c -> subscription_pricing_model
    -- sbqq_subscription_target_c -> subscription_target
    -- sbqq_subscription_term_c -> subscription_term
    -- sbqq_subscription_type_c -> subscription_type
    -- sbqq_tax_code_c -> tax_code
    -- sbqq_taxable_c -> is_taxable
    -- sbqq_term_discount_level_c -> term_discount_level
    -- sbqq_term_discount_schedule_c -> term_discount_schedule
    -- sbqq_upgrade_credit_c -> upgrade_credit
    -- sbqq_upgrade_ratio_c -> upgrade_ratio
    -- sbqq_upgrade_source_c -> upgrade_source
    -- sbqq_upgrade_target_c -> upgrade_target
    -- connector_type_c -> connector_type
    -- pbf_pro_type_discount_c -> pro_type_discount
    -- dimension_c -> dimension
    -- connector_status_c -> connector_status
    -- dimension_definition_c -> dimension_definition
    -- ava_sfcpq_tax_code_c -> avalara_tax_code
    -- paid_consumption_c -> paid_consumption
    -- is_complimentary_c -> is_complimentary
    -- product_external_id_c -> external_product_id
    -- blng_billing_rule_c -> billing_rule_id
    -- blng_revenue_recognition_rule_c -> revenue_recognition_rule_id
    -- blng_tax_rule_c -> tax_rule_id
    -- deployment_date_c -> deployment_date
    -- do_not_prorate_c -> is_proration_disabled
    -- celigo_sfnsio_netsuite_id_c -> celigo_netsuite_id_alt
    -- sbqq_enable_large_configuration_c -> enable_large_configuration
    -- sbqq_pricing_guidance_c -> pricing_guidance
    -- celigo_sfnsio_item_pricing_type_c -> celigo_pricing_type
    -- celigo_sfnsio_test_mode_record_c -> is_test_mode_record
    -- celigo_sfnsio_celigo_last_modified_date_c -> celigo_last_modified_date
    -- celigo_sfnsio_net_suite_record_c -> celigo_netsuite_record
    -- celigo_sfnsio_skip_export_to_net_suite_c -> skip_netsuite_export
    -- celigo_sfnsio_net_suite_item_type_c -> celigo_netsuite_item_type
    -- celigo_sfnsio_net_suite_id_c -> celigo_netsuite_id
    -- promo_code_c -> promo_code
    -- product_category_c -> product_category
    -- product_source_c -> product_source
    -- non_recurring_c -> is_non_recurring
    -- _fivetran_active -> is_fivetran_active
    SELECT 
        "last_referenced_date",
        "is_active",
        "description",
        "last_modified_date",
        "record_type_id",
        "product_code",
        "last_viewed_date",
        "is_deleted",
        "last_modified_by_id",
        "system_modstamp" AS "last_modified_at",
        "name" AS "product_name",
        "id" AS "product_id",
        "created_by_id",
        "created_date",
        "family" AS "product_family",
        "max_volume_c" AS "max_volume",
        "min_volume_c" AS "min_volume",
        "request_name_c" AS "request_name",
        "default_quantity_c",
        "account_c" AS "account_id",
        "related_product_c" AS "related_product_id",
        "picklist_value_c" AS "custom_picklist_value",
        "as_input_c" AS "accounting_system_input",
        "as_output_c" AS "accounting_system_output",
        "status_c" AS "product_status",
        "number_of_quantity_installments" AS "quantity_installments",
        "number_of_revenue_installments" AS "revenue_installments",
        "quantity_installment_period",
        "quantity_schedule_type",
        "revenue_installment_period",
        "revenue_schedule_type",
        "connections_c" AS "connection_count",
        "event_volume_c" AS "event_volume",
        "roadmap_connections_c" AS "roadmap_connections",
        "row_volume_c" AS "row_volume",
        "display_url",
        "external_data_source_id",
        "external_id",
        "quantity_unit_of_measure" AS "quantity_unit",
        "stock_keeping_unit",
        "features_c" AS "product_features",
        "tier_3_price_c" AS "tier_3_price",
        "tier_2_price_c" AS "tier_2_price",
        "tier_4_price_c" AS "tier_4_price",
        "tier_1_price_c" AS "tier_1_price",
        "netsuite_conn_sync_in_progress_c" AS "netsuite_sync_in_progress",
        "netsuite_conn_celigo_update_c" AS "netsuite_celigo_update",
        "netsuite_conn_term_contract_pricing_type_c" AS "netsuite_contract_pricing_type",
        "netsuite_conn_net_suite_id_c" AS "netsuite_id",
        "netsuite_conn_net_suite_sync_err_c" AS "netsuite_sync_error",
        "netsuite_conn_push_to_net_suite_c" AS "push_to_netsuite",
        "netsuite_conn_item_category_c" AS "netsuite_item_category",
        "netsuite_conn_net_suite_item_type_c" AS "netsuite_item_type",
        "netsuite_conn_sub_type_c" AS "netsuite_subtype",
        "is_new_c" AS "is_new",
        "product_metadata_c" AS "product_metadata",
        "product_metadata_del_c" AS "deleted_product_metadata",
        "sbqq_asset_amendment_behavior_c" AS "asset_amendment_behavior",
        "sbqq_asset_conversion_c" AS "asset_conversion",
        "sbqq_batch_quantity_c" AS "batch_quantity",
        "sbqq_billing_frequency_c" AS "billing_frequency",
        "sbqq_billing_type_c" AS "billing_type",
        "sbqq_block_pricing_field_c" AS "block_pricing_field",
        "sbqq_charge_type_c" AS "charge_type",
        "sbqq_component_c" AS "is_component",
        "sbqq_compound_discount_rate_c" AS "compound_discount_rate",
        "sbqq_configuration_event_c" AS "configuration_event",
        "sbqq_configuration_field_set_c" AS "configuration_field_set",
        "sbqq_configuration_fields_c" AS "configuration_fields",
        "sbqq_configuration_form_title_c" AS "configuration_form_title",
        "sbqq_configuration_type_c" AS "configuration_type",
        "sbqq_configuration_validator_c" AS "configuration_validator",
        "sbqq_configured_code_pattern_c" AS "configured_code_pattern",
        "sbqq_configured_description_pattern_c" AS "configured_description_pattern",
        "sbqq_cost_editable_c" AS "is_cost_editable",
        "sbqq_cost_schedule_c" AS "cost_schedule",
        "sbqq_custom_configuration_page_c" AS "custom_configuration_page",
        "sbqq_custom_configuration_required_c" AS "is_custom_configuration_required",
        "sbqq_customer_community_availability_c" AS "customer_community_availability",
        "sbqq_default_pricing_table_c" AS "default_pricing_table",
        "sbqq_default_quantity_c",
        "sbqq_description_locked_c" AS "is_description_locked",
        "sbqq_discount_category_c" AS "discount_category",
        "sbqq_discount_schedule_c" AS "discount_schedule",
        "sbqq_dynamic_pricing_constraint_c" AS "dynamic_pricing_constraint",
        "sbqq_exclude_from_maintenance_c" AS "exclude_from_maintenance",
        "sbqq_exclude_from_opportunity_c" AS "exclude_from_opportunity",
        "sbqq_externally_configurable_c" AS "is_externally_configurable",
        "sbqq_generate_contracted_price_c" AS "generate_contracted_price",
        "sbqq_has_configuration_attributes_c" AS "has_configuration_attributes",
        "sbqq_has_consumption_schedule_c" AS "has_consumption_schedule",
        "sbqq_hidden_c" AS "is_hidden",
        "sbqq_hide_price_in_search_results_c" AS "hide_price_in_search_results",
        "sbqq_include_in_maintenance_c" AS "include_in_maintenance",
        "sbqq_new_quote_group_c" AS "create_new_quote_group",
        "sbqq_non_discountable_c" AS "is_non_discountable",
        "sbqq_non_partner_discountable_c" AS "is_non_partner_discountable",
        "sbqq_option_layout_c" AS "option_layout",
        "sbqq_option_selection_method_c" AS "option_selection_method",
        "sbqq_optional_c" AS "is_optional",
        "sbqq_price_editable_c" AS "is_price_editable",
        "sbqq_pricing_method_c" AS "pricing_method",
        "sbqq_pricing_method_editable_c" AS "is_pricing_method_editable",
        "sbqq_product_picture_id_c" AS "product_picture_id",
        "sbqq_quantity_editable_c" AS "is_quantity_editable",
        "sbqq_quantity_scale_c" AS "quantity_scale",
        "sbqq_reconfiguration_disabled_c" AS "is_reconfiguration_disabled",
        "sbqq_renewal_product_c" AS "renewal_product",
        "sbqq_sort_order_c" AS "sort_order",
        "sbqq_specifications_c" AS "specifications",
        "sbqq_subscription_base_c" AS "subscription_base",
        "sbqq_subscription_category_c" AS "subscription_category",
        "sbqq_subscription_percent_c" AS "subscription_percent",
        "sbqq_subscription_pricing_c" AS "subscription_pricing_model",
        "sbqq_subscription_target_c" AS "subscription_target",
        "sbqq_subscription_term_c" AS "subscription_term",
        "sbqq_subscription_type_c" AS "subscription_type",
        "sbqq_tax_code_c" AS "tax_code",
        "sbqq_taxable_c" AS "is_taxable",
        "sbqq_term_discount_level_c" AS "term_discount_level",
        "sbqq_term_discount_schedule_c" AS "term_discount_schedule",
        "sbqq_upgrade_credit_c" AS "upgrade_credit",
        "sbqq_upgrade_ratio_c" AS "upgrade_ratio",
        "sbqq_upgrade_source_c" AS "upgrade_source",
        "sbqq_upgrade_target_c" AS "upgrade_target",
        "connector_type_c" AS "connector_type",
        "pbf_pro_type_discount_c" AS "pro_type_discount",
        "dimension_c" AS "dimension",
        "connector_status_c" AS "connector_status",
        "dimension_definition_c" AS "dimension_definition",
        "ava_sfcpq_tax_code_c" AS "avalara_tax_code",
        "paid_consumption_c" AS "paid_consumption",
        "is_complimentary_c" AS "is_complimentary",
        "product_external_id_c" AS "external_product_id",
        "blng_billing_rule_c" AS "billing_rule_id",
        "blng_revenue_recognition_rule_c" AS "revenue_recognition_rule_id",
        "blng_tax_rule_c" AS "tax_rule_id",
        "deployment_date_c" AS "deployment_date",
        "do_not_prorate_c" AS "is_proration_disabled",
        "celigo_sfnsio_netsuite_id_c" AS "celigo_netsuite_id_alt",
        "sbqq_enable_large_configuration_c" AS "enable_large_configuration",
        "sbqq_pricing_guidance_c" AS "pricing_guidance",
        "celigo_sfnsio_item_pricing_type_c" AS "celigo_pricing_type",
        "celigo_sfnsio_test_mode_record_c" AS "is_test_mode_record",
        "celigo_sfnsio_celigo_last_modified_date_c" AS "celigo_last_modified_date",
        "celigo_sfnsio_net_suite_record_c" AS "celigo_netsuite_record",
        "celigo_sfnsio_skip_export_to_net_suite_c" AS "skip_netsuite_export",
        "celigo_sfnsio_net_suite_item_type_c" AS "celigo_netsuite_item_type",
        "celigo_sfnsio_net_suite_id_c" AS "celigo_netsuite_id",
        "promo_code_c" AS "promo_code",
        "product_category_c" AS "product_category",
        "product_source_c" AS "product_source",
        "non_recurring_c" AS "is_non_recurring",
        "is_archived",
        "_fivetran_active" AS "is_fivetran_active"
    FROM "sf_product_2_data_projected"
),

"sf_product_2_data_projected_renamed_casted" AS (
    -- Column Type Casting: 
    -- account_id: from DECIMAL to VARCHAR
    -- accounting_system_input: from DECIMAL to VARCHAR
    -- accounting_system_output: from DECIMAL to VARCHAR
    -- avalara_tax_code: from DECIMAL to VARCHAR
    -- batch_quantity: from DECIMAL to VARCHAR
    -- celigo_last_modified_date: from VARCHAR to TIMESTAMP
    -- celigo_netsuite_id: from DECIMAL to VARCHAR
    -- celigo_netsuite_id_alt: from DECIMAL to VARCHAR
    -- celigo_netsuite_item_type: from DECIMAL to VARCHAR
    -- celigo_netsuite_record: from DECIMAL to VARCHAR
    -- celigo_pricing_type: from DECIMAL to VARCHAR
    -- compound_discount_rate: from DECIMAL to VARCHAR
    -- configuration_event: from DECIMAL to VARCHAR
    -- configuration_field_set: from DECIMAL to VARCHAR
    -- configuration_fields: from DECIMAL to VARCHAR
    -- configuration_form_title: from DECIMAL to VARCHAR
    -- configuration_type: from DECIMAL to VARCHAR
    -- configuration_validator: from DECIMAL to VARCHAR
    -- configured_code_pattern: from DECIMAL to VARCHAR
    -- configured_description_pattern: from DECIMAL to VARCHAR
    -- connection_count: from DECIMAL to VARCHAR
    -- cost_schedule: from DECIMAL to VARCHAR
    -- created_date: from VARCHAR to TIMESTAMP
    -- custom_configuration_page: from DECIMAL to VARCHAR
    -- custom_picklist_value: from DECIMAL to VARCHAR
    -- customer_community_availability: from DECIMAL to VARCHAR
    -- default_pricing_table: from DECIMAL to VARCHAR
    -- default_quantity_c: from DECIMAL to VARCHAR
    -- deleted_product_metadata: from DECIMAL to VARCHAR
    -- deployment_date: from DECIMAL to DATE
    -- description: from DECIMAL to VARCHAR
    -- dimension_definition: from DECIMAL to VARCHAR
    -- discount_category: from DECIMAL to VARCHAR
    -- discount_schedule: from DECIMAL to VARCHAR
    -- display_url: from DECIMAL to VARCHAR
    -- dynamic_pricing_constraint: from DECIMAL to VARCHAR
    -- event_volume: from DECIMAL to VARCHAR
    -- external_data_source_id: from DECIMAL to VARCHAR
    -- external_id: from DECIMAL to VARCHAR
    -- generate_contracted_price: from DECIMAL to VARCHAR
    -- is_fivetran_active: from DECIMAL to VARCHAR
    -- last_modified_at: from VARCHAR to TIMESTAMP
    -- last_modified_date: from VARCHAR to TIMESTAMP
    -- last_referenced_date: from DECIMAL to TIMESTAMP
    -- last_viewed_date: from DECIMAL to TIMESTAMP
    -- max_volume: from DECIMAL to VARCHAR
    -- min_volume: from DECIMAL to VARCHAR
    -- netsuite_contract_pricing_type: from DECIMAL to VARCHAR
    -- netsuite_id: from DECIMAL to VARCHAR
    -- netsuite_item_category: from DECIMAL to VARCHAR
    -- option_layout: from DECIMAL to VARCHAR
    -- paid_consumption: from DECIMAL to VARCHAR
    -- pricing_guidance: from DECIMAL to VARCHAR
    -- product_category: from DECIMAL to VARCHAR
    -- product_code: from INT to VARCHAR
    -- product_features: from DECIMAL to VARCHAR
    -- product_metadata: from DECIMAL to VARCHAR
    -- product_picture_id: from DECIMAL to VARCHAR
    -- product_source: from DECIMAL to VARCHAR
    -- product_status: from DECIMAL to VARCHAR
    -- promo_code: from DECIMAL to VARCHAR
    -- quantity_installment_period: from DECIMAL to VARCHAR
    -- quantity_installments: from DECIMAL to VARCHAR
    -- quantity_scale: from DECIMAL to VARCHAR
    -- quantity_schedule_type: from DECIMAL to VARCHAR
    -- quantity_unit: from DECIMAL to VARCHAR
    -- related_product_id: from DECIMAL to VARCHAR
    -- renewal_product: from DECIMAL to VARCHAR
    -- request_name: from DECIMAL to VARCHAR
    -- revenue_installment_period: from DECIMAL to VARCHAR
    -- revenue_installments: from DECIMAL to VARCHAR
    -- revenue_schedule_type: from DECIMAL to VARCHAR
    -- roadmap_connections: from DECIMAL to VARCHAR
    -- row_volume: from DECIMAL to VARCHAR
    -- sbqq_default_quantity_c: from INT to DECIMAL
    -- sort_order: from DECIMAL to VARCHAR
    -- specifications: from DECIMAL to VARCHAR
    -- stock_keeping_unit: from DECIMAL to VARCHAR
    -- subscription_category: from DECIMAL to VARCHAR
    -- subscription_percent: from DECIMAL to VARCHAR
    -- subscription_target: from DECIMAL to VARCHAR
    -- tax_code: from DECIMAL to VARCHAR
    -- term_discount_level: from DECIMAL to VARCHAR
    -- term_discount_schedule: from DECIMAL to VARCHAR
    -- tier_1_price: from DECIMAL to VARCHAR
    -- tier_2_price: from DECIMAL to VARCHAR
    -- tier_3_price: from DECIMAL to VARCHAR
    -- upgrade_source: from DECIMAL to VARCHAR
    -- upgrade_target: from DECIMAL to VARCHAR
    SELECT
        "is_active",
        "record_type_id",
        "is_deleted",
        "last_modified_by_id",
        "product_name",
        "product_id",
        "created_by_id",
        "product_family",
        "tier_4_price",
        "netsuite_sync_in_progress",
        "netsuite_celigo_update",
        "netsuite_sync_error",
        "push_to_netsuite",
        "netsuite_item_type",
        "netsuite_subtype",
        "is_new",
        "asset_amendment_behavior",
        "asset_conversion",
        "billing_frequency",
        "billing_type",
        "block_pricing_field",
        "charge_type",
        "is_component",
        "is_cost_editable",
        "is_custom_configuration_required",
        "is_description_locked",
        "exclude_from_maintenance",
        "exclude_from_opportunity",
        "is_externally_configurable",
        "has_configuration_attributes",
        "has_consumption_schedule",
        "is_hidden",
        "hide_price_in_search_results",
        "include_in_maintenance",
        "create_new_quote_group",
        "is_non_discountable",
        "is_non_partner_discountable",
        "option_selection_method",
        "is_optional",
        "is_price_editable",
        "pricing_method",
        "is_pricing_method_editable",
        "is_quantity_editable",
        "is_reconfiguration_disabled",
        "subscription_base",
        "subscription_pricing_model",
        "subscription_term",
        "subscription_type",
        "is_taxable",
        "upgrade_credit",
        "upgrade_ratio",
        "connector_type",
        "pro_type_discount",
        "dimension",
        "connector_status",
        "is_complimentary",
        "external_product_id",
        "billing_rule_id",
        "revenue_recognition_rule_id",
        "tax_rule_id",
        "is_proration_disabled",
        "enable_large_configuration",
        "is_test_mode_record",
        "skip_netsuite_export",
        "is_non_recurring",
        "is_archived",
        CAST("account_id" AS VARCHAR) AS "account_id",
        CAST("accounting_system_input" AS VARCHAR) AS "accounting_system_input",
        CAST("accounting_system_output" AS VARCHAR) AS "accounting_system_output",
        CAST("avalara_tax_code" AS VARCHAR) AS "avalara_tax_code",
        CAST("batch_quantity" AS VARCHAR) AS "batch_quantity",
        CAST("celigo_last_modified_date" AS TIMESTAMP) AS "celigo_last_modified_date",
        CAST("celigo_netsuite_id" AS VARCHAR) AS "celigo_netsuite_id",
        CAST("celigo_netsuite_id_alt" AS VARCHAR) AS "celigo_netsuite_id_alt",
        CAST("celigo_netsuite_item_type" AS VARCHAR) AS "celigo_netsuite_item_type",
        CAST("celigo_netsuite_record" AS VARCHAR) AS "celigo_netsuite_record",
        CAST("celigo_pricing_type" AS VARCHAR) AS "celigo_pricing_type",
        CAST("compound_discount_rate" AS VARCHAR) AS "compound_discount_rate",
        CAST("configuration_event" AS VARCHAR) AS "configuration_event",
        CAST("configuration_field_set" AS VARCHAR) AS "configuration_field_set",
        CAST("configuration_fields" AS VARCHAR) AS "configuration_fields",
        CAST("configuration_form_title" AS VARCHAR) AS "configuration_form_title",
        CAST("configuration_type" AS VARCHAR) AS "configuration_type",
        CAST("configuration_validator" AS VARCHAR) AS "configuration_validator",
        CAST("configured_code_pattern" AS VARCHAR) AS "configured_code_pattern",
        CAST("configured_description_pattern" AS VARCHAR) AS "configured_description_pattern",
        CAST("connection_count" AS VARCHAR) AS "connection_count",
        CAST("cost_schedule" AS VARCHAR) AS "cost_schedule",
        CAST("created_date" AS TIMESTAMP) AS "created_date",
        CAST("custom_configuration_page" AS VARCHAR) AS "custom_configuration_page",
        CAST("custom_picklist_value" AS VARCHAR) AS "custom_picklist_value",
        CAST("customer_community_availability" AS VARCHAR) AS "customer_community_availability",
        CAST("default_pricing_table" AS VARCHAR) AS "default_pricing_table",
        CAST("default_quantity_c" AS VARCHAR) AS "default_quantity_c",
        CAST("deleted_product_metadata" AS VARCHAR) AS "deleted_product_metadata",
        CAST("deployment_date" AS DATE) AS "deployment_date",
        CAST("description" AS VARCHAR) AS "description",
        CAST("dimension_definition" AS VARCHAR) AS "dimension_definition",
        CAST("discount_category" AS VARCHAR) AS "discount_category",
        CAST("discount_schedule" AS VARCHAR) AS "discount_schedule",
        CAST("display_url" AS VARCHAR) AS "display_url",
        CAST("dynamic_pricing_constraint" AS VARCHAR) AS "dynamic_pricing_constraint",
        CAST("event_volume" AS VARCHAR) AS "event_volume",
        CAST("external_data_source_id" AS VARCHAR) AS "external_data_source_id",
        CAST("external_id" AS VARCHAR) AS "external_id",
        CAST("generate_contracted_price" AS VARCHAR) AS "generate_contracted_price",
        CAST("is_fivetran_active" AS VARCHAR) AS "is_fivetran_active",
        CAST("last_modified_at" AS TIMESTAMP) AS "last_modified_at",
        CAST("last_modified_date" AS TIMESTAMP) AS "last_modified_date",
        CAST("last_referenced_date" AS TIMESTAMP) AS "last_referenced_date",
        CAST("last_viewed_date" AS TIMESTAMP) AS "last_viewed_date",
        CAST("max_volume" AS VARCHAR) AS "max_volume",
        CAST("min_volume" AS VARCHAR) AS "min_volume",
        CAST("netsuite_contract_pricing_type" AS VARCHAR) AS "netsuite_contract_pricing_type",
        CAST("netsuite_id" AS VARCHAR) AS "netsuite_id",
        CAST("netsuite_item_category" AS VARCHAR) AS "netsuite_item_category",
        CAST("option_layout" AS VARCHAR) AS "option_layout",
        CAST("paid_consumption" AS VARCHAR) AS "paid_consumption",
        CAST("pricing_guidance" AS VARCHAR) AS "pricing_guidance",
        CAST("product_category" AS VARCHAR) AS "product_category",
        CAST("product_code" AS VARCHAR) AS "product_code",
        CAST("product_features" AS VARCHAR) AS "product_features",
        CAST("product_metadata" AS VARCHAR) AS "product_metadata",
        CAST("product_picture_id" AS VARCHAR) AS "product_picture_id",
        CAST("product_source" AS VARCHAR) AS "product_source",
        CAST("product_status" AS VARCHAR) AS "product_status",
        CAST("promo_code" AS VARCHAR) AS "promo_code",
        CAST("quantity_installment_period" AS VARCHAR) AS "quantity_installment_period",
        CAST("quantity_installments" AS VARCHAR) AS "quantity_installments",
        CAST("quantity_scale" AS VARCHAR) AS "quantity_scale",
        CAST("quantity_schedule_type" AS VARCHAR) AS "quantity_schedule_type",
        CAST("quantity_unit" AS VARCHAR) AS "quantity_unit",
        CAST("related_product_id" AS VARCHAR) AS "related_product_id",
        CAST("renewal_product" AS VARCHAR) AS "renewal_product",
        CAST("request_name" AS VARCHAR) AS "request_name",
        CAST("revenue_installment_period" AS VARCHAR) AS "revenue_installment_period",
        CAST("revenue_installments" AS VARCHAR) AS "revenue_installments",
        CAST("revenue_schedule_type" AS VARCHAR) AS "revenue_schedule_type",
        CAST("roadmap_connections" AS VARCHAR) AS "roadmap_connections",
        CAST("row_volume" AS VARCHAR) AS "row_volume",
        CAST("sbqq_default_quantity_c" AS DECIMAL) AS "sbqq_default_quantity_c",
        CAST("sort_order" AS VARCHAR) AS "sort_order",
        CAST("specifications" AS VARCHAR) AS "specifications",
        CAST("stock_keeping_unit" AS VARCHAR) AS "stock_keeping_unit",
        CAST("subscription_category" AS VARCHAR) AS "subscription_category",
        CAST("subscription_percent" AS VARCHAR) AS "subscription_percent",
        CAST("subscription_target" AS VARCHAR) AS "subscription_target",
        CAST("tax_code" AS VARCHAR) AS "tax_code",
        CAST("term_discount_level" AS VARCHAR) AS "term_discount_level",
        CAST("term_discount_schedule" AS VARCHAR) AS "term_discount_schedule",
        CAST("tier_1_price" AS VARCHAR) AS "tier_1_price",
        CAST("tier_2_price" AS VARCHAR) AS "tier_2_price",
        CAST("tier_3_price" AS VARCHAR) AS "tier_3_price",
        CAST("upgrade_source" AS VARCHAR) AS "upgrade_source",
        CAST("upgrade_target" AS VARCHAR) AS "upgrade_target"
    FROM "sf_product_2_data_projected_renamed"
),

"sf_product_2_data_projected_renamed_casted_missing_handled" AS (
    -- Handling missing values: There are 89 columns with unacceptable missing values
    -- account_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- accounting_system_input has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- accounting_system_output has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- avalara_tax_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- batch_quantity has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- celigo_netsuite_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- celigo_netsuite_id_alt has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- celigo_netsuite_item_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- celigo_netsuite_record has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- celigo_pricing_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- compound_discount_rate has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- configuration_event has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- configuration_field_set has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- configuration_fields has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- configuration_form_title has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- configuration_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- configuration_validator has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- configured_code_pattern has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- configured_description_pattern has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- connection_count has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- cost_schedule has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- custom_configuration_page has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- custom_picklist_value has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- customer_community_availability has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- default_pricing_table has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- default_quantity_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- deleted_product_metadata has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- deployment_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- description has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- dimension_definition has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- discount_category has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- discount_schedule has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- display_url has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- dynamic_pricing_constraint has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- event_volume has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- external_data_source_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- external_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- generate_contracted_price has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- is_fivetran_active has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- is_non_recurring has 50.0 percent missing. Strategy: 🔄 Unchanged
    -- last_referenced_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_viewed_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- max_volume has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- min_volume has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- netsuite_contract_pricing_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- netsuite_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- netsuite_item_category has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- netsuite_sync_error has 50.0 percent missing. Strategy: 🔄 Unchanged
    -- option_layout has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- paid_consumption has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- pricing_guidance has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- product_category has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- product_family has 50.0 percent missing. Strategy: 🔄 Unchanged
    -- product_features has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- product_metadata has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- product_picture_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- product_source has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- product_status has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- promo_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- quantity_installment_period has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- quantity_installments has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- quantity_scale has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- quantity_schedule_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- quantity_unit has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- related_product_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- renewal_product has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- request_name has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- revenue_installment_period has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- revenue_installments has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- revenue_schedule_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- roadmap_connections has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- row_volume has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- sort_order has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- specifications has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- stock_keeping_unit has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- subscription_category has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- subscription_percent has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- subscription_target has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- tax_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- term_discount_level has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- term_discount_schedule has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- tier_1_price has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- tier_2_price has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- tier_3_price has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- tier_4_price has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- upgrade_credit has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- upgrade_ratio has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- upgrade_source has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- upgrade_target has 100.0 percent missing. Strategy: 🗑️ Drop Column
    SELECT
        "is_active",
        "record_type_id",
        "is_deleted",
        "last_modified_by_id",
        "product_name",
        "product_id",
        "created_by_id",
        "product_family",
        "netsuite_sync_in_progress",
        "netsuite_celigo_update",
        "netsuite_sync_error",
        "push_to_netsuite",
        "netsuite_item_type",
        "netsuite_subtype",
        "is_new",
        "asset_amendment_behavior",
        "asset_conversion",
        "billing_frequency",
        "billing_type",
        "block_pricing_field",
        "charge_type",
        "is_component",
        "is_cost_editable",
        "is_custom_configuration_required",
        "is_description_locked",
        "exclude_from_maintenance",
        "exclude_from_opportunity",
        "is_externally_configurable",
        "has_configuration_attributes",
        "has_consumption_schedule",
        "is_hidden",
        "hide_price_in_search_results",
        "include_in_maintenance",
        "create_new_quote_group",
        "is_non_discountable",
        "is_non_partner_discountable",
        "option_selection_method",
        "is_optional",
        "is_price_editable",
        "pricing_method",
        "is_pricing_method_editable",
        "is_quantity_editable",
        "is_reconfiguration_disabled",
        "subscription_base",
        "subscription_pricing_model",
        "subscription_term",
        "subscription_type",
        "is_taxable",
        "connector_type",
        "pro_type_discount",
        "dimension",
        "connector_status",
        "is_complimentary",
        "external_product_id",
        "billing_rule_id",
        "revenue_recognition_rule_id",
        "tax_rule_id",
        "is_proration_disabled",
        "enable_large_configuration",
        "is_test_mode_record",
        "skip_netsuite_export",
        "is_non_recurring",
        "is_archived",
        "celigo_last_modified_date",
        "created_date",
        "last_modified_at",
        "last_modified_date",
        "product_code",
        "sbqq_default_quantity_c"
    FROM "sf_product_2_data_projected_renamed_casted"
)

-- COCOON BLOCK END
SELECT * FROM "sf_product_2_data_projected_renamed_casted_missing_handled"

stg_sf_product_2_data.yml (Document the table)

version: 2
models:
- name: stg_sf_product_2_data
  description: The table is about product data. It contains fields for product identification,
    pricing, configuration, subscription details, and integration with external systems.
    Key attributes include product code, name, family, pricing tiers, billing frequency,
    and various flags for product behavior and characteristics. The table also includes
    metadata about record creation, modification, and system integration statuses.
  columns:
  - name: is_active
    description: Indicates if the product is currently active
    tests:
    - not_null
  - name: record_type_id
    description: ID of the record type
    tests:
    - not_null
  - name: is_deleted
    description: Indicates if the product is deleted
    tests:
    - not_null
  - name: last_modified_by_id
    description: ID of user who last modified the product
    tests:
    - not_null
  - name: product_name
    description: Name of the product
    tests:
    - not_null
  - name: product_id
    description: Unique identifier for the product
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column is a unique identifier for the product. For this table,
        where each row represents a product, product_id should be unique across rows.
  - name: created_by_id
    description: ID of the user who created the record
    tests:
    - not_null
  - name: product_family
    description: Product family or category
    tests:
    - not_null
  - name: netsuite_sync_in_progress
    description: NetSuite sync in progress status
    tests:
    - not_null
  - name: netsuite_celigo_update
    description: NetSuite Celigo update status
    tests:
    - not_null
  - name: netsuite_sync_error
    description: NetSuite sync error status
    tests:
    - not_null
    - accepted_values:
        values:
        - SUCCESS
        - FAILED
        - PENDING
        - CANCELED
        - PARTIALLY_PROCESSED
        - PROCESSING
        - NO_DATA
        - TIMED_OUT
        - AUTHENTICATION_ERROR
        - AUTHORIZATION_ERROR
        - INVALID_DATA
        - RATE_LIMIT_EXCEEDED
        - SERVER_ERROR
        - UNKNOWN_ERROR
        - X
  - name: push_to_netsuite
    description: Flag to push to NetSuite
    tests:
    - not_null
  - name: netsuite_item_type
    description: NetSuite item type
    tests:
    - not_null
    - accepted_values:
        values:
        - Inventory Item
        - Non-inventory Item
        - Service Item
        - Other Charge Item
        - Group Item
        - Kit/Package Item
        - Assembly Item
        - Serialized Inventory Item
        - Lot Numbered Inventory Item
        - Gift Certificate Item
        - Download Item
        - Subtotal Item
        - Discount Item
        - Payment Item
        - Non Inventory Sale Item
        - Non Inventory Purchase Item
        - Non Inventory Resale Item
        - Description Item
        - Non Inventory Sale
  - name: netsuite_subtype
    description: NetSuite subtype
    tests:
    - not_null
    - accepted_values:
        values:
        - noninventory-Sale
        - noninventory-Resale
        - noninventory-Purchase
        - inventory
        - assembly
        - kit
        - service
        - description
        - discount
        - markup
        - payment
        - othercharge
        - subtotal
        - group
  - name: is_new
    description: Custom field for new product status
    tests:
    - not_null
  - name: asset_amendment_behavior
    description: Behavior for asset amendments
    tests:
    - not_null
    - accepted_values:
        values:
        - Default
        - Overwrite
        - Append
        - Merge
        - Reject
        - Require Approval
        - Audit Trail
        - Version Control
        - Notification
        - Rollback
  - name: asset_conversion
    description: Asset conversion settings
    tests:
    - not_null
  - name: billing_frequency
    description: Frequency of billing
    tests:
    - accepted_values:
        values:
        - Annual
        - Monthly
        - Quarterly
        - Semi-Annual
        - Weekly
        - Bi-Weekly
        - Daily
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring charges
  - name: billing_type
    description: Type of billing
    tests:
    - accepted_values:
        values:
        - Advance
        - Arrears
        - Monthly
        - Quarterly
        - Annually
        - Pay-as-you-go
        - Prepaid
        - Postpaid
        - Recurring
        - One-time
        - Usage-based
        - Tiered
        - Flat-rate
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring charges
  - name: block_pricing_field
    description: Field for block pricing
    tests:
    - not_null
  - name: charge_type
    description: Type of charge for the product
    tests:
    - accepted_values:
        values:
        - Recurring
        - One-time
        - Usage-based
        - Tiered
        - Per-unit
        - Flat rate
        - Subscription
        - Pay-as-you-go
        - Freemium
        - Lifetime
    cocoon_meta:
      missing_acceptable: Not applicable for non-charge items
  - name: is_component
    description: Indicates if product is a component
    tests:
    - not_null
  - name: is_cost_editable
    description: Indicates if cost is editable
    tests:
    - not_null
  - name: is_custom_configuration_required
    description: Indicates if custom configuration is required
    tests:
    - not_null
  - name: is_description_locked
    description: Indicates if description is locked
    tests:
    - not_null
  - name: exclude_from_maintenance
    description: Excludes product from maintenance
    tests:
    - not_null
  - name: exclude_from_opportunity
    description: Excludes product from opportunities
    tests:
    - not_null
  - name: is_externally_configurable
    description: Indicates if externally configurable
    tests:
    - not_null
  - name: has_configuration_attributes
    description: Indicates if product has configuration attributes
    tests:
    - not_null
  - name: has_consumption_schedule
    description: Indicates if product has consumption schedule
    tests:
    - not_null
  - name: is_hidden
    description: Indicates if product is hidden
    tests:
    - not_null
  - name: hide_price_in_search_results
    description: Hides price in search results
    tests:
    - not_null
  - name: include_in_maintenance
    description: Includes product in maintenance
    tests:
    - not_null
  - name: create_new_quote_group
    description: Creates new quote group for product
    tests:
    - not_null
  - name: is_non_discountable
    description: Indicates if product is non-discountable
    tests:
    - not_null
  - name: is_non_partner_discountable
    description: Indicates if non-partner discountable
    tests:
    - not_null
  - name: option_selection_method
    description: Method for selecting product options
    tests:
    - not_null
    - accepted_values:
        values:
        - Click
        - Dropdown
        - Radio buttons
        - Checkboxes
        - Swatches
        - Text input
        - Slider
        - Hover
        - Drag and drop
        - Voice command
        - Gesture
        - Augmented reality
  - name: is_optional
    description: Indicates if the product is optional
    tests:
    - not_null
  - name: is_price_editable
    description: Indicates if the price can be edited
    tests:
    - not_null
  - name: pricing_method
    description: Method used for product pricing
    tests:
    - not_null
    - accepted_values:
        values:
        - List
        - Cost-plus
        - Value-based
        - Dynamic
        - Competitive
        - Bundle
        - Penetration
        - Skimming
        - Psychological
        - Premium
        - Economy
        - Freemium
        - Subscription
        - Pay-what-you-want
        - Auction
  - name: is_pricing_method_editable
    description: Indicates if pricing method can be edited
    tests:
    - not_null
  - name: is_quantity_editable
    description: Indicates if quantity can be edited
    tests:
    - not_null
  - name: is_reconfiguration_disabled
    description: Indicates if reconfiguration is disabled
    tests:
    - not_null
  - name: subscription_base
    description: Base for subscription pricing
    tests:
    - not_null
    - accepted_values:
        values:
        - Base
        - Standard
        - Premium
        - Pro
        - Enterprise
        - Free
        - Basic
        - Starter
        - Advanced
        - Ultimate
        - List
  - name: subscription_pricing_model
    description: Pricing model for subscriptions
    tests:
    - accepted_values:
        values:
        - Fixed Price
        - Usage-Based
        - Tiered
        - Per User
        - Freemium
        - Pay As You Go
        - Hybrid
        - Value-Based
        - Flat Rate
        - Per Feature
        - Per Device
        - Per Transaction
        - Subscription Box
    cocoon_meta:
      missing_acceptable: Not applicable for non-subscription products
  - name: subscription_term
    description: Term length for subscriptions
    cocoon_meta:
      missing_acceptable: Not applicable for non-subscription products
  - name: subscription_type
    description: Type of subscription
    tests:
    - not_null
    - accepted_values:
        values:
        - Renewable
        - Non-renewable
        - Solar
        - Wind
        - Hydroelectric
        - Geothermal
        - Biomass
        - Fixed-term
        - Monthly
        - Annual
        - Pay-as-you-go
        - Premium
        - Standard
        - Basic
  - name: is_taxable
    description: Indicates if the product is taxable
    tests:
    - not_null
  - name: connector_type
    description: Type of the connector
    tests:
    - not_null
  - name: pro_type_discount
    description: Custom field for pro type discount
    tests:
    - not_null
  - name: dimension
    description: Dimension of the product
    tests:
    - not_null
  - name: connector_status
    description: Status of the connector
    tests:
    - not_null
    - accepted_values:
        values:
        - Alpha
        - Beta
        - Release Candidate
        - General Availability
        - Deprecated
        - End of Life
        - Development
        - Preview
        - Limited Availability
        - Early Access
  - name: is_complimentary
    description: Custom field for complimentary product status
    tests:
    - not_null
  - name: external_product_id
    description: External identifier for the product
    cocoon_meta:
      missing_acceptable: Not applicable for products without external identification.
  - name: billing_rule_id
    description: Billing rule for the product
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring charges
  - name: revenue_recognition_rule_id
    description: Revenue recognition rule for the product
    cocoon_meta:
      missing_acceptable: Not applicable for products without specific revenue recognition
        rules
  - name: tax_rule_id
    description: Tax rule for the product
    cocoon_meta:
      missing_acceptable: Not applicable for products not subject to taxation
  - name: is_proration_disabled
    description: Flag to indicate if proration is disabled
    tests:
    - not_null
  - name: enable_large_configuration
    description: Enables large configuration for the product
    cocoon_meta:
      missing_acceptable: Not applicable for items without configuration options
  - name: is_test_mode_record
    description: Flag for test mode record
    tests:
    - not_null
  - name: skip_netsuite_export
    description: Flag to skip export to NetSuite
    tests:
    - not_null
  - name: is_non_recurring
    description: Custom field for non-recurring status
    tests:
    - not_null
  - name: is_archived
    description: Indicates if the product is archived
    cocoon_meta:
      missing_acceptable: Not applicable for active, non-archived products.
  - name: celigo_last_modified_date
    description: Last modified date in Celigo integration
    tests:
    - not_null
  - name: created_date
    description: Date when the record was created
    tests:
    - not_null
  - name: last_modified_at
    description: Last modification timestamp of the record
    tests:
    - not_null
  - name: last_modified_date
    description: Date and time of last modification
    tests:
    - not_null
  - name: product_code
    description: Unique identifier for the product
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column is described as a unique identifier for the product.
        For this table, where each row represents a product, product_code should be
        unique across rows.
  - name: sbqq_default_quantity_c
    description: ''
    tests:
    - not_null

stg_sf_event_data (first 100 rows)

account_id is_collections_hold created_by_id description duration_minutes event_subtype is_collections_plan_execution group_event_type event_id is_archived is_child_event is_deleted is_group_event is_private is_recurring is_recurring_secondary is_recurrence_exception is_recurrence_exclusion has_reminder last_modified_by_id is_no_show owner_id show_as subject event_type vidyard_enabled associated_object_count associated_object_id associated_contact_count associated_contact_id activity_date activity_datetime attendance_count call_recording campaign_id chorus_call_id created_datetime end_date end_datetime expected_payment_date first_meeting_date invitee_id is_co_sell_activity is_co_selling_activity last_modified_date recurrence_activity_id recurrence_day_of_month recurrence_day_of_week_mask recurrence_end_date recurrence_instance recurrence_interval recurrence_month_of_year recurrence_start_date_time recurrence_time_zone_id recurrence_type start_date_time system_modstamp
0 0011G00000eLwuWQAS False 0051G000007Ez4XQAS description 15 Event False 1.0 00U1G00000DEaypUAD False False False True False False False False False False 0051G000007Ez4XQAS False 0051G000007Ez4XQAS Busy subject Call False 1 0011G00000eLwuWQAS 1 0031G00001Pji7ZQAR 2019-11-11 2019-11-11 17:23:34 NaN None None None 2019-11-11 17:23:34 2019-11-11 2019-11-11 17:23:34 NaT NaT None NaN NaN 2019-11-11 17:23:34 None NaN None NaT None NaN NaN NaT None None 2019-11-11 17:23:34 2019-11-11 17:23:34
1 0011G00000gXz9HQAS False 0051G000007EpSPQA0 description 30 Event False 1.0 00U1G00000DEaxXUAT False False False True False False False False False False 0051G000007EpSPQA0 False 0051G000007EpSPQA0 Busy subject Call False 0 None 1 0031G00000xRXHBQA4 2019-11-11 2019-11-11 17:23:34 NaN None None None 2019-11-11 17:23:34 2019-11-11 2019-11-11 17:23:34 NaT NaT None NaN NaN 2019-11-11 17:23:34 None NaN None NaT None NaN NaN NaT None None 2019-11-11 17:23:34 2019-11-11 17:23:34
2 0011G00000f8MOkQAM False 0051G0000060zsHQAQ description 30 Event False NaN 00U1G00000DEQNmUAP False False False False False False False False False False 0051G0000060zsHQAQ False 0051G000007F8lCQAS Busy subject Meeting False 0 None 1 0031G00001QY4G5QAL 2019-11-11 2019-11-11 17:23:34 NaN None None None 2019-11-11 17:23:34 2019-11-11 2019-11-11 17:23:34 NaT NaT None NaN NaN 2019-11-11 17:23:34 None NaN None NaT None NaN NaN NaT None None 2019-11-11 17:23:34 2019-11-11 17:23:34
3 0011G00000vVDWsQAO False 0051G0000060zsHQAQ description 30 Event False NaN 00U1G00000DEQP2UAP False False False False False False False False False False 0051G0000060zsHQAQ False 0051G000007F8lCQAS Busy subject Meeting False 0 None 1 0031G00001QXl7WQAT 2019-11-11 2019-11-11 17:23:34 NaN None None None 2019-11-11 17:23:34 2019-11-11 2019-11-11 17:23:34 NaT NaT None NaN NaN 2019-11-11 17:23:34 None NaN None NaT None NaN NaN NaT None None 2019-11-11 17:23:34 2019-11-11 17:23:34
4 0011G00000vVSANQA4 False 0051G000007F94iQAC description 15 Event False 1.0 00U1G00000DEQYxUAP False False False True False False False False False False 0051G000007F94iQAC False 0051G000007F94iQAC Busy subject Call False 1 0011G00000vVSANQA4 1 0031G00001QY6c0QAD 2019-11-11 2019-11-11 17:23:34 NaN None None None 2019-11-11 17:23:34 2019-11-11 2019-11-11 17:23:34 NaT NaT None NaN NaN 2019-11-11 17:23:34 None NaN None NaT None NaN NaN NaT None None 2019-11-11 17:23:34 2019-11-11 17:23:34
5 0011G00000vVS79QAG False 0051G000007F94iQAC description 15 Event False 1.0 00U1G00000DEQYEUA5 False False False True False False False False False False 0051G000007F94iQAC False 0051G000007F94iQAC Busy subject Call False 1 0011G00000vVS79QAG 1 0031G00001QY5TTQA1 2019-11-11 2019-11-11 17:23:34 NaN None None None 2019-11-11 17:23:34 2019-11-11 2019-11-11 17:23:34 NaT NaT None NaN NaN 2019-11-11 17:23:34 None NaN None NaT None NaN NaN NaT None None 2019-11-11 17:23:34 2019-11-11 17:23:34
6 0013700000JwwRJAAZ False 0051G0000060zsHQAQ description 30 Event False NaN 00U1G00000DEQL7UAP False False False False False False False False False False 0051G0000060zsHQAQ False 0051G000007F8lCQAS Busy subject Meeting False 0 None 1 0031G00001QY3kmQAD 2019-11-11 2019-11-11 17:23:34 NaN None None None 2019-11-11 17:23:34 2019-11-11 2019-11-11 17:23:34 NaT NaT None NaN NaN 2019-11-11 17:23:34 None NaN None NaT None NaN NaN NaT None None 2019-11-11 17:23:34 2019-11-11 17:23:34
7 0011G00000gX8tDQAS False 0051G0000060zsHQAQ description 15 Event False NaN 00U1G00000DEQM0UAP False False False False False False False False False False 0051G000007F2JGQA0 False 0051G000007F94iQAC Busy subject Meeting False 0 None 1 0031G00001QXdxXQAT 2019-11-11 2019-11-11 17:23:34 NaN None None None 2019-11-11 17:23:34 2019-11-11 2019-11-11 17:23:34 NaT NaT None NaN NaN 2019-11-11 17:23:34 None NaN None NaT None NaN NaN NaT None None 2019-11-11 17:23:34 2019-11-11 17:23:34
8 0011G00000vVPbgQAG False 0051G000007F94iQAC description 15 Event False 1.0 00U1G00000DEQLvUAP False False False True False False False False False False 0051G000007F94iQAC False 0051G000007F94iQAC Busy subject Call False 1 0011G00000vVPbgQAG 1 0031G00001QXbgEQAT 2019-11-11 2019-11-11 17:23:34 NaN None None None 2019-11-11 17:23:34 2019-11-11 2019-11-11 17:23:34 NaT NaT None NaN NaN 2019-11-11 17:23:34 None NaN None NaT None NaN NaN NaT None None 2019-11-11 17:23:34 2019-11-11 17:23:34
9 0011G00000vVPhAQAW False 0051G000007F94iQAC description 15 Event False 1.0 00U1G00000DEQMtUAP False False False True False False False False False False 0051G000007F94iQAC False 0051G000007F94iQAC Busy subject Call False 1 0011G00000vVPhAQAW 1 0031G00001QXeBJQA1 2019-11-11 2019-11-11 17:23:34 NaN None None None 2019-11-11 17:23:34 2019-11-11 2019-11-11 17:23:34 NaT NaT None NaN NaN 2019-11-11 17:23:34 None NaN None NaT None NaN NaN NaT None None 2019-11-11 17:23:34 2019-11-11 17:23:34

stg_sf_event_data.sql (clean the table)

-- COCOON BLOCK START: PLEASE DO NOT MODIFY THIS BLOCK FOR SELF-MAINTENANCE
WITH 
"sf_event_data_removeWideColumns" AS (
    -- Remove wide columns with pattern. The regex and columns are:
    -- ^sales_loft_\d+_.*$: sales_loft_1_call_disposition_c, sales_loft_1_call_sentiment_c, sales_loft_1_sales_loft_cadence_name_c, sales_loft_1_sales_loft_clicked_count_c, sales_loft_1_sales_loft_email_template_title_c, sales_loft_1_sales_loft_replies_count_c, sales_loft_1_sales_loft_step_day_c, sales_loft_1_sales_loft_view_count_c
    -- ^recurrence_2_pattern_.*$: recurrence_2_pattern_start_date, recurrence_2_pattern_text, recurrence_2_pattern_time_zone, recurrence_2_pattern_version
    -- ^sales_loft_.*(_\d+)?_c$: sales_loft_cadence_id_c, sales_loft_cadence_name_c, sales_loft_clicked_count_c, sales_loft_email_template_id_c, sales_loft_email_template_title_c, sales_loft_external_identifier_c, sales_loft_reply_count_c, sales_loft_step_day_new_c, sales_loft_step_id_c, sales_loft_step_name_c ...
    SELECT 
        "_fivetran_active",
        "_fivetran_synced",
        "account_id",
        "activity_date",
        "activity_date_time",
        "affectlayer_affect_layer_call_id_c",
        "affectlayer_chorus_call_id_c",
        "assigned_to_name_c",
        "assigned_to_role_c",
        "associated_sdr_c",
        "attendance_number_c",
        "bizible_2_bizible_id_c",
        "bizible_2_bizible_touchpoint_date_c",
        "call_disposition_2_c",
        "call_disposition_c",
        "call_recording_c",
        "campaign_c",
        "co_selling_activity_c",
        "collections_hold_c",
        "created_by_id",
        "created_date",
        "description",
        "description_c",
        "duration_in_minutes",
        "duration_in_minutes_c",
        "end_date",
        "end_date_time",
        "event_name_c",
        "event_subtype",
        "execute_collections_plan_activity_c",
        "expected_payment_date_c",
        "first_meeting_c",
        "first_meeting_held_c",
        "group_event_type",
        "how_did_you_bring_value_or_create_trust_c",
        "how_did_you_bring_value_or_earn_trust_c",
        "id",
        "invitee_uuid_c",
        "is_a_co_sell_activity_c",
        "is_archived",
        "is_child",
        "is_deleted",
        "is_group_event",
        "is_private",
        "is_recurrence",
        "is_recurrence_2",
        "is_recurrence_2_exception",
        "is_recurrence_2_exclusion",
        "is_reminder_set",
        "last_modified_by_id",
        "last_modified_date",
        "last_rep_activity_date_c",
        "legacy_hvr_id_c",
        "lid_date_sent_c",
        "lid_url_c",
        "location",
        "meeting_name_c",
        "meeting_type_c",
        "no_show_c",
        "opportunity_c",
        "owner_id",
        "partner_account_c",
        "partner_activity_type_c",
        "partner_contact_c",
        "proof_of_referral_c",
        "recurrence_activity_id",
        "recurrence_day_of_month",
        "recurrence_day_of_week_mask",
        "recurrence_end_date_only",
        "recurrence_instance",
        "recurrence_interval",
        "recurrence_month_of_year",
        "recurrence_start_date_time",
        "recurrence_time_zone_sid_key",
        "recurrence_type",
        "referral_account_c",
        "referral_contact_c",
        "reminder_date_time",
        "show_as",
        "start_date_time",
        "subject",
        "system_modstamp",
        "topic_c",
        "type",
        "vidyard_c",
        "what_count",
        "what_id",
        "who_count",
        "who_id"
    FROM "sf_event_data"
),

"sf_event_data_removeWideColumns_projected" AS (
    -- Projection: Selecting 88 out of 89 columns
    -- Columns projected out: ['_fivetran_synced']
    SELECT 
        "_fivetran_active",
        "account_id",
        "activity_date",
        "activity_date_time",
        "affectlayer_affect_layer_call_id_c",
        "affectlayer_chorus_call_id_c",
        "assigned_to_name_c",
        "assigned_to_role_c",
        "associated_sdr_c",
        "attendance_number_c",
        "bizible_2_bizible_id_c",
        "bizible_2_bizible_touchpoint_date_c",
        "call_disposition_2_c",
        "call_disposition_c",
        "call_recording_c",
        "campaign_c",
        "co_selling_activity_c",
        "collections_hold_c",
        "created_by_id",
        "created_date",
        "description",
        "description_c",
        "duration_in_minutes",
        "duration_in_minutes_c",
        "end_date",
        "end_date_time",
        "event_name_c",
        "event_subtype",
        "execute_collections_plan_activity_c",
        "expected_payment_date_c",
        "first_meeting_c",
        "first_meeting_held_c",
        "group_event_type",
        "how_did_you_bring_value_or_create_trust_c",
        "how_did_you_bring_value_or_earn_trust_c",
        "id",
        "invitee_uuid_c",
        "is_a_co_sell_activity_c",
        "is_archived",
        "is_child",
        "is_deleted",
        "is_group_event",
        "is_private",
        "is_recurrence",
        "is_recurrence_2",
        "is_recurrence_2_exception",
        "is_recurrence_2_exclusion",
        "is_reminder_set",
        "last_modified_by_id",
        "last_modified_date",
        "last_rep_activity_date_c",
        "legacy_hvr_id_c",
        "lid_date_sent_c",
        "lid_url_c",
        "location",
        "meeting_name_c",
        "meeting_type_c",
        "no_show_c",
        "opportunity_c",
        "owner_id",
        "partner_account_c",
        "partner_activity_type_c",
        "partner_contact_c",
        "proof_of_referral_c",
        "recurrence_activity_id",
        "recurrence_day_of_month",
        "recurrence_day_of_week_mask",
        "recurrence_end_date_only",
        "recurrence_instance",
        "recurrence_interval",
        "recurrence_month_of_year",
        "recurrence_start_date_time",
        "recurrence_time_zone_sid_key",
        "recurrence_type",
        "referral_account_c",
        "referral_contact_c",
        "reminder_date_time",
        "show_as",
        "start_date_time",
        "subject",
        "system_modstamp",
        "topic_c",
        "type",
        "vidyard_c",
        "what_count",
        "what_id",
        "who_count",
        "who_id"
    FROM "sf_event_data_removeWideColumns"
),

"sf_event_data_removeWideColumns_projected_renamed" AS (
    -- Rename: Renaming columns
    -- _fivetran_active -> is_active
    -- activity_date_time -> activity_datetime
    -- affectlayer_affect_layer_call_id_c -> affect_layer_call_id
    -- affectlayer_chorus_call_id_c -> chorus_call_id
    -- assigned_to_name_c -> assigned_to_name
    -- assigned_to_role_c -> assigned_to_role
    -- associated_sdr_c -> associated_sdr
    -- attendance_number_c -> attendance_count
    -- bizible_2_bizible_id_c -> bizible_id
    -- bizible_2_bizible_touchpoint_date_c -> bizible_touchpoint_date
    -- call_disposition_2_c -> secondary_call_disposition
    -- call_disposition_c -> primary_call_disposition
    -- call_recording_c -> call_recording
    -- campaign_c -> campaign_id
    -- co_selling_activity_c -> is_co_selling_activity
    -- collections_hold_c -> is_collections_hold
    -- created_date -> created_datetime
    -- description_c -> additional_description
    -- duration_in_minutes -> duration_minutes
    -- duration_in_minutes_c -> custom_duration_minutes
    -- end_date_time -> end_datetime
    -- event_name_c -> event_name
    -- execute_collections_plan_activity_c -> is_collections_plan_execution
    -- expected_payment_date_c -> expected_payment_date
    -- first_meeting_c -> is_first_meeting
    -- first_meeting_held_c -> first_meeting_date
    -- how_did_you_bring_value_or_create_trust_c -> value_creation_description
    -- how_did_you_bring_value_or_earn_trust_c -> trust_earning_description
    -- id -> event_id
    -- invitee_uuid_c -> invitee_id
    -- is_a_co_sell_activity_c -> is_co_sell_activity
    -- is_child -> is_child_event
    -- is_recurrence -> is_recurring
    -- is_recurrence_2 -> is_recurring_secondary
    -- is_recurrence_2_exception -> is_recurrence_exception
    -- is_recurrence_2_exclusion -> is_recurrence_exclusion
    -- is_reminder_set -> has_reminder
    -- last_rep_activity_date_c -> last_rep_activity_date
    -- legacy_hvr_id_c -> legacy_id
    -- lid_date_sent_c -> lid_sent_date
    -- lid_url_c -> lid_url
    -- meeting_name_c -> meeting_name
    -- meeting_type_c -> meeting_type
    -- no_show_c -> is_no_show
    -- opportunity_c -> opportunity_id
    -- partner_account_c -> partner_account_id
    -- partner_activity_type_c -> partner_activity_type
    -- partner_contact_c -> partner_contact_id
    -- proof_of_referral_c -> proof_of_referral
    -- recurrence_end_date_only -> recurrence_end_date
    -- recurrence_time_zone_sid_key -> recurrence_time_zone_id
    -- referral_account_c -> referral_account_id
    -- referral_contact_c -> referral_contact_id
    -- topic_c -> event_topic
    -- type -> event_type
    -- vidyard_c -> vidyard_enabled
    -- what_count -> associated_object_count
    -- what_id -> associated_object_id
    -- who_count -> associated_contact_count
    -- who_id -> associated_contact_id
    SELECT 
        "_fivetran_active" AS "is_active",
        "account_id",
        "activity_date",
        "activity_date_time" AS "activity_datetime",
        "affectlayer_affect_layer_call_id_c" AS "affect_layer_call_id",
        "affectlayer_chorus_call_id_c" AS "chorus_call_id",
        "assigned_to_name_c" AS "assigned_to_name",
        "assigned_to_role_c" AS "assigned_to_role",
        "associated_sdr_c" AS "associated_sdr",
        "attendance_number_c" AS "attendance_count",
        "bizible_2_bizible_id_c" AS "bizible_id",
        "bizible_2_bizible_touchpoint_date_c" AS "bizible_touchpoint_date",
        "call_disposition_2_c" AS "secondary_call_disposition",
        "call_disposition_c" AS "primary_call_disposition",
        "call_recording_c" AS "call_recording",
        "campaign_c" AS "campaign_id",
        "co_selling_activity_c" AS "is_co_selling_activity",
        "collections_hold_c" AS "is_collections_hold",
        "created_by_id",
        "created_date" AS "created_datetime",
        "description",
        "description_c" AS "additional_description",
        "duration_in_minutes" AS "duration_minutes",
        "duration_in_minutes_c" AS "custom_duration_minutes",
        "end_date",
        "end_date_time" AS "end_datetime",
        "event_name_c" AS "event_name",
        "event_subtype",
        "execute_collections_plan_activity_c" AS "is_collections_plan_execution",
        "expected_payment_date_c" AS "expected_payment_date",
        "first_meeting_c" AS "is_first_meeting",
        "first_meeting_held_c" AS "first_meeting_date",
        "group_event_type",
        "how_did_you_bring_value_or_create_trust_c" AS "value_creation_description",
        "how_did_you_bring_value_or_earn_trust_c" AS "trust_earning_description",
        "id" AS "event_id",
        "invitee_uuid_c" AS "invitee_id",
        "is_a_co_sell_activity_c" AS "is_co_sell_activity",
        "is_archived",
        "is_child" AS "is_child_event",
        "is_deleted",
        "is_group_event",
        "is_private",
        "is_recurrence" AS "is_recurring",
        "is_recurrence_2" AS "is_recurring_secondary",
        "is_recurrence_2_exception" AS "is_recurrence_exception",
        "is_recurrence_2_exclusion" AS "is_recurrence_exclusion",
        "is_reminder_set" AS "has_reminder",
        "last_modified_by_id",
        "last_modified_date",
        "last_rep_activity_date_c" AS "last_rep_activity_date",
        "legacy_hvr_id_c" AS "legacy_id",
        "lid_date_sent_c" AS "lid_sent_date",
        "lid_url_c" AS "lid_url",
        "location",
        "meeting_name_c" AS "meeting_name",
        "meeting_type_c" AS "meeting_type",
        "no_show_c" AS "is_no_show",
        "opportunity_c" AS "opportunity_id",
        "owner_id",
        "partner_account_c" AS "partner_account_id",
        "partner_activity_type_c" AS "partner_activity_type",
        "partner_contact_c" AS "partner_contact_id",
        "proof_of_referral_c" AS "proof_of_referral",
        "recurrence_activity_id",
        "recurrence_day_of_month",
        "recurrence_day_of_week_mask",
        "recurrence_end_date_only" AS "recurrence_end_date",
        "recurrence_instance",
        "recurrence_interval",
        "recurrence_month_of_year",
        "recurrence_start_date_time",
        "recurrence_time_zone_sid_key" AS "recurrence_time_zone_id",
        "recurrence_type",
        "referral_account_c" AS "referral_account_id",
        "referral_contact_c" AS "referral_contact_id",
        "reminder_date_time",
        "show_as",
        "start_date_time",
        "subject",
        "system_modstamp",
        "topic_c" AS "event_topic",
        "type" AS "event_type",
        "vidyard_c" AS "vidyard_enabled",
        "what_count" AS "associated_object_count",
        "what_id" AS "associated_object_id",
        "who_count" AS "associated_contact_count",
        "who_id" AS "associated_contact_id"
    FROM "sf_event_data_removeWideColumns_projected"
),

"sf_event_data_removeWideColumns_projected_renamed_casted" AS (
    -- Column Type Casting: 
    -- activity_date: from VARCHAR to DATE
    -- activity_datetime: from VARCHAR to TIMESTAMP
    -- additional_description: from DECIMAL to VARCHAR
    -- affect_layer_call_id: from DECIMAL to VARCHAR
    -- assigned_to_name: from DECIMAL to VARCHAR
    -- assigned_to_role: from DECIMAL to VARCHAR
    -- associated_sdr: from DECIMAL to VARCHAR
    -- attendance_count: from DECIMAL to INT
    -- bizible_id: from DECIMAL to VARCHAR
    -- bizible_touchpoint_date: from DECIMAL to DATE
    -- call_recording: from DECIMAL to VARCHAR
    -- campaign_id: from DECIMAL to VARCHAR
    -- chorus_call_id: from DECIMAL to VARCHAR
    -- created_datetime: from VARCHAR to TIMESTAMP
    -- custom_duration_minutes: from DECIMAL to INT
    -- end_date: from VARCHAR to DATE
    -- end_datetime: from VARCHAR to TIMESTAMP
    -- event_name: from DECIMAL to VARCHAR
    -- event_topic: from DECIMAL to VARCHAR
    -- expected_payment_date: from DECIMAL to DATE
    -- first_meeting_date: from DECIMAL to DATE
    -- invitee_id: from DECIMAL to VARCHAR
    -- is_active: from DECIMAL to BOOLEAN
    -- is_co_sell_activity: from DECIMAL to BOOLEAN
    -- is_co_selling_activity: from DECIMAL to BOOLEAN
    -- is_first_meeting: from DECIMAL to BOOLEAN
    -- last_modified_date: from VARCHAR to TIMESTAMP
    -- last_rep_activity_date: from DECIMAL to DATE
    -- legacy_id: from DECIMAL to VARCHAR
    -- lid_sent_date: from DECIMAL to DATE
    -- lid_url: from DECIMAL to VARCHAR
    -- location: from DECIMAL to VARCHAR
    -- meeting_name: from DECIMAL to VARCHAR
    -- meeting_type: from DECIMAL to VARCHAR
    -- opportunity_id: from DECIMAL to VARCHAR
    -- partner_account_id: from DECIMAL to VARCHAR
    -- partner_activity_type: from DECIMAL to VARCHAR
    -- partner_contact_id: from DECIMAL to VARCHAR
    -- primary_call_disposition: from DECIMAL to VARCHAR
    -- proof_of_referral: from DECIMAL to VARCHAR
    -- recurrence_activity_id: from DECIMAL to VARCHAR
    -- recurrence_day_of_month: from DECIMAL to INT
    -- recurrence_day_of_week_mask: from DECIMAL to VARCHAR
    -- recurrence_end_date: from DECIMAL to DATE
    -- recurrence_instance: from DECIMAL to VARCHAR
    -- recurrence_interval: from DECIMAL to INT
    -- recurrence_month_of_year: from DECIMAL to INT
    -- recurrence_start_date_time: from DECIMAL to TIMESTAMP
    -- recurrence_time_zone_id: from DECIMAL to VARCHAR
    -- recurrence_type: from DECIMAL to VARCHAR
    -- referral_account_id: from DECIMAL to VARCHAR
    -- referral_contact_id: from DECIMAL to VARCHAR
    -- reminder_date_time: from DECIMAL to TIMESTAMP
    -- secondary_call_disposition: from DECIMAL to VARCHAR
    -- start_date_time: from VARCHAR to TIMESTAMP
    -- system_modstamp: from VARCHAR to TIMESTAMP
    -- trust_earning_description: from DECIMAL to VARCHAR
    -- value_creation_description: from DECIMAL to VARCHAR
    SELECT
        "account_id",
        "is_collections_hold",
        "created_by_id",
        "description",
        "duration_minutes",
        "event_subtype",
        "is_collections_plan_execution",
        "group_event_type",
        "event_id",
        "is_archived",
        "is_child_event",
        "is_deleted",
        "is_group_event",
        "is_private",
        "is_recurring",
        "is_recurring_secondary",
        "is_recurrence_exception",
        "is_recurrence_exclusion",
        "has_reminder",
        "last_modified_by_id",
        "is_no_show",
        "owner_id",
        "show_as",
        "subject",
        "event_type",
        "vidyard_enabled",
        "associated_object_count",
        "associated_object_id",
        "associated_contact_count",
        "associated_contact_id",
        CAST("activity_date" AS DATE) AS "activity_date",
        CAST("activity_datetime" AS TIMESTAMP) AS "activity_datetime",
        CAST("additional_description" AS VARCHAR) AS "additional_description",
        CAST("affect_layer_call_id" AS VARCHAR) AS "affect_layer_call_id",
        CAST("assigned_to_name" AS VARCHAR) AS "assigned_to_name",
        CAST("assigned_to_role" AS VARCHAR) AS "assigned_to_role",
        CAST("associated_sdr" AS VARCHAR) AS "associated_sdr",
        CAST("attendance_count" AS INT) AS "attendance_count",
        CAST("bizible_id" AS VARCHAR) AS "bizible_id",
        CAST("bizible_touchpoint_date" AS DATE) AS "bizible_touchpoint_date",
        CAST("call_recording" AS VARCHAR) AS "call_recording",
        CAST("campaign_id" AS VARCHAR) AS "campaign_id",
        CAST("chorus_call_id" AS VARCHAR) AS "chorus_call_id",
        CAST("created_datetime" AS TIMESTAMP) AS "created_datetime",
        CAST("custom_duration_minutes" AS INT) AS "custom_duration_minutes",
        CAST("end_date" AS DATE) AS "end_date",
        CAST("end_datetime" AS TIMESTAMP) AS "end_datetime",
        CAST("event_name" AS VARCHAR) AS "event_name",
        CAST("event_topic" AS VARCHAR) AS "event_topic",
        CAST("expected_payment_date" AS DATE) AS "expected_payment_date",
        CAST("first_meeting_date" AS DATE) AS "first_meeting_date",
        CAST("invitee_id" AS VARCHAR) AS "invitee_id",
        CAST("is_active" AS BOOLEAN) AS "is_active",
        CAST("is_co_sell_activity" AS BOOLEAN) AS "is_co_sell_activity",
        CAST("is_co_selling_activity" AS BOOLEAN) AS "is_co_selling_activity",
        CAST("is_first_meeting" AS BOOLEAN) AS "is_first_meeting",
        CAST("last_modified_date" AS TIMESTAMP) AS "last_modified_date",
        CAST("last_rep_activity_date" AS DATE) AS "last_rep_activity_date",
        CAST("legacy_id" AS VARCHAR) AS "legacy_id",
        CAST("lid_sent_date" AS DATE) AS "lid_sent_date",
        CAST("lid_url" AS VARCHAR) AS "lid_url",
        CAST("location" AS VARCHAR) AS "location",
        CAST("meeting_name" AS VARCHAR) AS "meeting_name",
        CAST("meeting_type" AS VARCHAR) AS "meeting_type",
        CAST("opportunity_id" AS VARCHAR) AS "opportunity_id",
        CAST("partner_account_id" AS VARCHAR) AS "partner_account_id",
        CAST("partner_activity_type" AS VARCHAR) AS "partner_activity_type",
        CAST("partner_contact_id" AS VARCHAR) AS "partner_contact_id",
        CAST("primary_call_disposition" AS VARCHAR) AS "primary_call_disposition",
        CAST("proof_of_referral" AS VARCHAR) AS "proof_of_referral",
        CAST("recurrence_activity_id" AS VARCHAR) AS "recurrence_activity_id",
        CAST("recurrence_day_of_month" AS INT) AS "recurrence_day_of_month",
        CAST("recurrence_day_of_week_mask" AS VARCHAR) AS "recurrence_day_of_week_mask",
        CAST("recurrence_end_date" AS DATE) AS "recurrence_end_date",
        CAST("recurrence_instance" AS VARCHAR) AS "recurrence_instance",
        CAST("recurrence_interval" AS INT) AS "recurrence_interval",
        CAST("recurrence_month_of_year" AS INT) AS "recurrence_month_of_year",
        CAST("recurrence_start_date_time" AS TIMESTAMP) AS "recurrence_start_date_time",
        CAST("recurrence_time_zone_id" AS VARCHAR) AS "recurrence_time_zone_id",
        CAST("recurrence_type" AS VARCHAR) AS "recurrence_type",
        CAST("referral_account_id" AS VARCHAR) AS "referral_account_id",
        CAST("referral_contact_id" AS VARCHAR) AS "referral_contact_id",
        CAST("reminder_date_time" AS TIMESTAMP) AS "reminder_date_time",
        CAST("secondary_call_disposition" AS VARCHAR) AS "secondary_call_disposition",
        CAST("start_date_time" AS TIMESTAMP) AS "start_date_time",
        CAST("system_modstamp" AS TIMESTAMP) AS "system_modstamp",
        CAST("trust_earning_description" AS VARCHAR) AS "trust_earning_description",
        CAST("value_creation_description" AS VARCHAR) AS "value_creation_description"
    FROM "sf_event_data_removeWideColumns_projected_renamed"
),

"sf_event_data_removeWideColumns_projected_renamed_casted_missing_handled" AS (
    -- Handling missing values: There are 32 columns with unacceptable missing values
    -- additional_description has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- affect_layer_call_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- assigned_to_name has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- assigned_to_role has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- associated_object_id has 50.0 percent missing. Strategy: 🔄 Unchanged
    -- associated_sdr has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- bizible_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- bizible_touchpoint_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- custom_duration_minutes has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- event_name has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- event_topic has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- is_active has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- is_first_meeting has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_rep_activity_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- legacy_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lid_sent_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lid_url has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- location has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- meeting_name has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- meeting_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- opportunity_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- partner_account_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- partner_activity_type has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- partner_contact_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- primary_call_disposition has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- proof_of_referral has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- referral_account_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- referral_contact_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- reminder_date_time has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- secondary_call_disposition has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- trust_earning_description has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- value_creation_description has 100.0 percent missing. Strategy: 🗑️ Drop Column
    SELECT
        "account_id",
        "is_collections_hold",
        "created_by_id",
        "description",
        "duration_minutes",
        "event_subtype",
        "is_collections_plan_execution",
        "group_event_type",
        "event_id",
        "is_archived",
        "is_child_event",
        "is_deleted",
        "is_group_event",
        "is_private",
        "is_recurring",
        "is_recurring_secondary",
        "is_recurrence_exception",
        "is_recurrence_exclusion",
        "has_reminder",
        "last_modified_by_id",
        "is_no_show",
        "owner_id",
        "show_as",
        "subject",
        "event_type",
        "vidyard_enabled",
        "associated_object_count",
        "associated_object_id",
        "associated_contact_count",
        "associated_contact_id",
        "activity_date",
        "activity_datetime",
        "attendance_count",
        "call_recording",
        "campaign_id",
        "chorus_call_id",
        "created_datetime",
        "end_date",
        "end_datetime",
        "expected_payment_date",
        "first_meeting_date",
        "invitee_id",
        "is_co_sell_activity",
        "is_co_selling_activity",
        "last_modified_date",
        "recurrence_activity_id",
        "recurrence_day_of_month",
        "recurrence_day_of_week_mask",
        "recurrence_end_date",
        "recurrence_instance",
        "recurrence_interval",
        "recurrence_month_of_year",
        "recurrence_start_date_time",
        "recurrence_time_zone_id",
        "recurrence_type",
        "start_date_time",
        "system_modstamp"
    FROM "sf_event_data_removeWideColumns_projected_renamed_casted"
)

-- COCOON BLOCK END
SELECT * FROM "sf_event_data_removeWideColumns_projected_renamed_casted_missing_handled"

stg_sf_event_data.yml (Document the table)

version: 2
models:
- name: stg_sf_event_data
  description: The table is about event data. It contains details of various events
    or activities, including their type (e.g., Call, Meeting), duration, start and
    end times, associated accounts and contacts, and other metadata. The table includes
    fields for event description, location, recurrence information, and system details
    like creation and modification timestamps.
  columns:
  - name: account_id
    description: Unique identifier for the associated account
    tests:
    - not_null
  - name: is_collections_hold
    description: Indicates if collections are on hold
    tests:
    - not_null
  - name: created_by_id
    description: ID of the user who created the record
    tests:
    - not_null
  - name: description
    description: Description of the event or activity
    tests:
    - not_null
  - name: duration_minutes
    description: Duration of the event in minutes
    tests:
    - not_null
  - name: event_subtype
    description: Subtype or category of the event
    tests:
    - not_null
  - name: is_collections_plan_execution
    description: Indicates collections plan execution activity
    tests:
    - not_null
  - name: group_event_type
    description: Type of group event
    cocoon_meta:
      missing_acceptable: Not applicable for individual events
  - name: event_id
    description: Unique identifier for the event
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column represents the unique identifier for each event. For
        this table, each row is an individual event, and event_id is designed to be
        unique for each event. It is likely to be unique across rows.
  - name: is_archived
    description: Indicator for archived status
    tests:
    - not_null
  - name: is_child_event
    description: Indicator for child event
    tests:
    - not_null
  - name: is_deleted
    description: Indicator for deleted status
    tests:
    - not_null
  - name: is_group_event
    description: Indicator for group event
    tests:
    - not_null
  - name: is_private
    description: Indicator for private event
    tests:
    - not_null
  - name: is_recurring
    description: Indicator for recurring event
    tests:
    - not_null
  - name: is_recurring_secondary
    description: Secondary indicator for recurring event
    tests:
    - not_null
  - name: is_recurrence_exception
    description: Indicator for recurrence exception
    tests:
    - not_null
  - name: is_recurrence_exclusion
    description: Indicator for recurrence exclusion
    tests:
    - not_null
  - name: has_reminder
    description: Indicator for reminder set
    tests:
    - not_null
  - name: last_modified_by_id
    description: ID of user who last modified
    tests:
    - not_null
  - name: is_no_show
    description: Indicator for no-show
    tests:
    - not_null
  - name: owner_id
    description: ID of the event owner
    tests:
    - not_null
  - name: show_as
    description: Availability status during event
    tests:
    - not_null
    - accepted_values:
        values:
        - Busy
        - Free
        - Tentative
        - Out of Office
  - name: subject
    description: Subject or title of the event
    tests:
    - not_null
  - name: event_type
    description: Type of event (e.g., Call, Meeting)
    tests:
    - not_null
    - accepted_values:
        values:
        - Call
        - Meeting
        - Conference
        - Presentation
        - Workshop
        - Webinar
        - Interview
        - Training
        - Seminar
        - Team Building
        - Brainstorming
        - Performance Review
        - Client Visit
        - Project Kickoff
        - Status Update
        - Demo
        - Product Launch
        - Networking Event
        - Board Meeting
        - Town Hall
  - name: vidyard_enabled
    description: Vidyard integration flag
    tests:
    - not_null
  - name: associated_object_count
    description: Count of associated objects
    tests:
    - not_null
  - name: associated_object_id
    description: ID of associated object
    tests:
    - not_null
  - name: associated_contact_count
    description: Count of associated contacts
    tests:
    - not_null
  - name: associated_contact_id
    description: ID of associated contact
    tests:
    - not_null
  - name: activity_date
    description: Date of the activity or event
    tests:
    - not_null
  - name: activity_datetime
    description: Date and time of the activity or event
    tests:
    - not_null
  - name: attendance_count
    description: Number of attendees for the event
    cocoon_meta:
      missing_acceptable: Not applicable for individual meetings or calls
  - name: call_recording
    description: Link or identifier for call recording
    cocoon_meta:
      missing_acceptable: Not applicable for non-call events
  - name: campaign_id
    description: Associated campaign identifier
    cocoon_meta:
      missing_acceptable: Not applicable for non-campaign related events
  - name: chorus_call_id
    description: Identifier for Chorus call
    cocoon_meta:
      missing_acceptable: Not applicable for non-call events
  - name: created_datetime
    description: Date and time the record was created
    tests:
    - not_null
  - name: end_date
    description: End date of the event
    tests:
    - not_null
  - name: end_datetime
    description: End date and time of the event
    tests:
    - not_null
  - name: expected_payment_date
    description: Expected date of payment
    cocoon_meta:
      missing_acceptable: Not applicable for non-payment related events
  - name: first_meeting_date
    description: Date of first meeting held
    cocoon_meta:
      missing_acceptable: Not applicable for follow-up or non-initial meetings
  - name: invitee_id
    description: Unique identifier for the invitee
    cocoon_meta:
      missing_acceptable: Not applicable for events without specific invitees
  - name: is_co_sell_activity
    description: Indicator for co-sell activity
    cocoon_meta:
      missing_acceptable: Not applicable for non-sales related events
  - name: is_co_selling_activity
    description: Indicates if it's a co-selling activity
    cocoon_meta:
      missing_acceptable: Not applicable for non-sales related events
  - name: last_modified_date
    description: Date and time of last modification
    tests:
    - not_null
  - name: recurrence_activity_id
    description: ID of recurring activity
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring events
  - name: recurrence_day_of_month
    description: Day of month for recurring events
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring events
  - name: recurrence_day_of_week_mask
    description: Mask for recurring days of week
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring events
  - name: recurrence_end_date
    description: End date for recurring events
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring events
  - name: recurrence_instance
    description: Instance of recurring event
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring events
  - name: recurrence_interval
    description: Interval between recurring events
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring events
  - name: recurrence_month_of_year
    description: Month of year for recurring events
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring events
  - name: recurrence_start_date_time
    description: Start date and time for recurring events
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring events
  - name: recurrence_time_zone_id
    description: Time zone identifier for recurring events
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring events
  - name: recurrence_type
    description: Type of recurrence pattern
    cocoon_meta:
      missing_acceptable: Not applicable for non-recurring events
  - name: start_date_time
    description: Start date and time of event
    tests:
    - not_null
  - name: system_modstamp
    description: System modification timestamp
    tests:
    - not_null

stg_sf_opportunity_data (first 100 rows)

is_closed success_probability has_overdue_task opportunity_amount is_deleted is_won opportunity_id is_active account_id has_line_items opportunity_stage owner_id pricebook_id record_type_id forecast_category forecast_category_name opportunity_type lead_source opportunity_name has_open_activity campaign_id close_date created_date fiscal_quarter fiscal_year
0 True 1000 False 24120000.0 True True 006q000000HddohAAB True 9CcfAt8qtZvCTwFvwOFLcg== True GavUFuuf4DrnQAoiRGlWpQ== rQhle3uwQbFgFmLTF1WByg== lNUPfU1ue2nQimeN6QVNKQ== 3QOHd+Q7F28PJtnwztV09Q== A/SkeDD5c3ejUyEFFoUHHg== A/SkeDD5c3ejUyEFFoUHHg== +Gkf6SQ2fhAONAiFelNKVw== TDK+SgtPSM3Vk67zX9aeRA== $1m deal False None 2018-12-19 2018-12-19 19:51:13 4 2018
1 True 100 False NaN True True 006q000000HdPzpAAF True wfQo3+JVfsNIdcz/mUkZkA== False GavUFuuf4DrnQAoiRGlWpQ== nqxS50kwRjtOYb9ZB4/PoQ== None 3QOHd+Q7F28PJtnwztV09Q== A/SkeDD5c3ejUyEFFoUHHg== A/SkeDD5c3ejUyEFFoUHHg== +Gkf6SQ2fhAONAiFelNKVw== Fbu50LvyXo0peN4RaMdJ3A== Testing Opp Close False None 2018-12-18 2018-12-18 21:21:17 4 2018
2 True 100 False NaN True True 006q000000Hbmd1AAB True wIXkC/s93lDAT+HVkwv6+A== False GavUFuuf4DrnQAoiRGlWpQ== dVDxbGz10nJ2mKU213GZRQ== None 14mxIBMk0YX2Gz0r1Ktsuw== A/SkeDD5c3ejUyEFFoUHHg== A/SkeDD5c3ejUyEFFoUHHg== +Gkf6SQ2fhAONAiFelNKVw== TDK+SgtPSM3Vk67zX9aeRA== Test False None 2018-12-18 2018-12-10 17:03:22 4 2018
3 True 100 False NaN True True 006q000000HcZXrAAN True 78HpxISq4/eSw+ycDPqSwA== False GavUFuuf4DrnQAoiRGlWpQ== 9B1r0vK1wAVGaERpMleKGg== None 14mxIBMk0YX2Gz0r1Ktsuw== A/SkeDD5c3ejUyEFFoUHHg== A/SkeDD5c3ejUyEFFoUHHg== +Gkf6SQ2fhAONAiFelNKVw== pOz8cFdDlJkM8XvYPfSZ9w== lu test False None 2018-12-13 2018-12-13 18:02:55 4 2018
4 True 100 False NaN True True 006q000000HddueAAB True wfQo3+JVfsNIdcz/mUkZkA== False GavUFuuf4DrnQAoiRGlWpQ== nqxS50kwRjtOYb9ZB4/PoQ== None 3QOHd+Q7F28PJtnwztV09Q== A/SkeDD5c3ejUyEFFoUHHg== A/SkeDD5c3ejUyEFFoUHHg== dSJC2EuRkC62f+UuBPQeVg== dSJC2EuRkC62f+UuBPQeVg== Chewbaca False None 2018-12-07 2018-12-19 20:22:58 4 2018
5 True 0 False 200000.0 True False 006q000000HK8jdAAD True TK5MTSsiOYoDQoJiSbkugA== False tXi3M8u3iPxq0ggxTSxMKw== QEaGoY7B8nGfro2vhOCMvA== None 14mxIBMk0YX2Gz0r1Ktsuw== AloDHjNI+wntE4Eetriz+w== AloDHjNI+wntE4Eetriz+w== +Gkf6SQ2fhAONAiFelNKVw== MfuqnemFQBY2RwqM7YBkKA== Evergreen Test False None 2018-11-21 2018-11-14 19:12:53 4 2018
6 True 0 False NaN True False 006q000000HcZXXAA3 False 78HpxISq4/eSw+ycDPqSwA== False tXi3M8u3iPxq0ggxTSxMKw== 9B1r0vK1wAVGaERpMleKGg== None 14mxIBMk0YX2Gz0r1Ktsuw== AloDHjNI+wntE4Eetriz+w== AloDHjNI+wntE4Eetriz+w== +Gkf6SQ2fhAONAiFelNKVw== UN2fttk8geFc7Db/xJzQ+A== lu test False None 2018-12-13 2018-12-13 18:00:11 4 2018
7 True 0 False 1.0 True False 006q000000GoP76AAF True tZX+Z0iWzZHHjNvRnCJzwg== False tXi3M8u3iPxq0ggxTSxMKw== TLZtnkcZltX8lijWYSQqRg== None 14mxIBMk0YX2Gz0r1Ktsuw== AloDHjNI+wntE4Eetriz+w== AloDHjNI+wntE4Eetriz+w== +Gkf6SQ2fhAONAiFelNKVw== None Blue Test False None 2018-10-31 2018-10-31 17:43:42 4 2018
8 True 0 False NaN True False 006q000000HcZXcAAN True 78HpxISq4/eSw+ycDPqSwA== False tXi3M8u3iPxq0ggxTSxMKw== AwxR76rxgr77EfSnTHH57Q== None 14mxIBMk0YX2Gz0r1Ktsuw== AloDHjNI+wntE4Eetriz+w== AloDHjNI+wntE4Eetriz+w== 9Q0PuStPWLYgxG/8kpvo5g== pOz8cFdDlJkM8XvYPfSZ9w== lu test False None 2018-12-13 2018-12-13 18:01:22 4 2018
9 False 65 False 210000.0 True False 006q000000HdOhuAAF False wIXkC/s93lDAT+HVkwv6+A== True 9RN9J3tlxr89gDctReax5w== dVDxbGz10nJ2mKU213GZRQ== 5x2qfGToAOo3bmSNM8fPjg== 3QOHd+Q7F28PJtnwztV09Q== rq6uxRtOa4gSLxCtlqjecg== rq6uxRtOa4gSLxCtlqjecg== +Gkf6SQ2fhAONAiFelNKVw== Fbu50LvyXo0peN4RaMdJ3A== Testing Order from Process False None 2018-12-19 2018-12-18 17:56:05 4 2018

stg_sf_opportunity_data.sql (clean the table)

-- COCOON BLOCK START: PLEASE DO NOT MODIFY THIS BLOCK FOR SELF-MAINTENANCE
WITH 
"sf_opportunity_data_projected" AS (
    -- Projection: Selecting 35 out of 36 columns
    -- Columns projected out: ['_fivetran_synced']
    SELECT 
        "account_id",
        "amount",
        "campaign_id",
        "close_date",
        "created_date",
        "description",
        "expected_revenue",
        "fiscal",
        "fiscal_quarter",
        "fiscal_year",
        "forecast_category",
        "forecast_category_name",
        "has_open_activity",
        "has_opportunity_line_item",
        "has_overdue_task",
        "id",
        "is_closed",
        "is_deleted",
        "is_excluded_from_territory_2_filter",
        "is_won",
        "last_activity_date",
        "last_referenced_date",
        "last_viewed_date",
        "lead_source",
        "name",
        "next_step",
        "owner_id",
        "pricebook_2_id",
        "probability",
        "record_type_id",
        "stage_name",
        "synced_quote_id",
        "territory_2_id",
        "type",
        "_fivetran_active"
    FROM "sf_opportunity_data"
),

"sf_opportunity_data_projected_renamed" AS (
    -- Rename: Renaming columns
    -- amount -> opportunity_amount
    -- fiscal -> fiscal_period
    -- has_opportunity_line_item -> has_line_items
    -- id -> opportunity_id
    -- is_excluded_from_territory_2_filter -> excluded_from_territory_2
    -- name -> opportunity_name
    -- pricebook_2_id -> pricebook_id
    -- probability -> success_probability
    -- stage_name -> opportunity_stage
    -- territory_2_id -> territory_id
    -- type -> opportunity_type
    -- _fivetran_active -> is_active
    SELECT 
        "account_id",
        "amount" AS "opportunity_amount",
        "campaign_id",
        "close_date",
        "created_date",
        "description",
        "expected_revenue",
        "fiscal" AS "fiscal_period",
        "fiscal_quarter",
        "fiscal_year",
        "forecast_category",
        "forecast_category_name",
        "has_open_activity",
        "has_opportunity_line_item" AS "has_line_items",
        "has_overdue_task",
        "id" AS "opportunity_id",
        "is_closed",
        "is_deleted",
        "is_excluded_from_territory_2_filter" AS "excluded_from_territory_2",
        "is_won",
        "last_activity_date",
        "last_referenced_date",
        "last_viewed_date",
        "lead_source",
        "name" AS "opportunity_name",
        "next_step",
        "owner_id",
        "pricebook_2_id" AS "pricebook_id",
        "probability" AS "success_probability",
        "record_type_id",
        "stage_name" AS "opportunity_stage",
        "synced_quote_id",
        "territory_2_id" AS "territory_id",
        "type" AS "opportunity_type",
        "_fivetran_active" AS "is_active"
    FROM "sf_opportunity_data_projected"
),

"sf_opportunity_data_projected_renamed_cleaned" AS (
    -- Clean unusual string values: 
    -- fiscal_period: The problem is that the fiscal_period column contains an encoded value 'JxJ3Au0JjyhOOUE/UvIeOw==' which is not a standard fiscal period format. This appears to be a Base64 encoded string, possibly used for data obfuscation or compression. Without knowing the decoding method or the original intended value, it's impossible to determine the correct fiscal period. The correct values for fiscal periods are typically in formats like 'Q1 2023', 'FY2023', or specific date ranges. 
    -- opportunity_name: The problem is that 'Blue Test -' has a trailing dash which should be removed.  'lu test 1', 'lu test 2', 'lu test 3' are redundant entries that should be consolidated.  The other values seem to be legitimate opportunity names and don't require changes.  The correct values should remove the trailing dash from 'Blue Test -' and consolidate the 'lu test' entries into a single value. 
    SELECT
        "account_id",
        "opportunity_amount",
        "campaign_id",
        "close_date",
        "created_date",
        "description",
        "expected_revenue",
        CASE
            WHEN "fiscal_period" = 'JxJ3Au0JjyhOOUE/UvIeOw==' THEN ''
            ELSE "fiscal_period"
        END AS "fiscal_period",
        "fiscal_quarter",
        "fiscal_year",
        "forecast_category",
        "forecast_category_name",
        "has_open_activity",
        "has_line_items",
        "has_overdue_task",
        "opportunity_id",
        "is_closed",
        "is_deleted",
        "excluded_from_territory_2",
        "is_won",
        "last_activity_date",
        "last_referenced_date",
        "last_viewed_date",
        "lead_source",
        CASE
            WHEN "opportunity_name" = 'Blue Test -' THEN 'Blue Test'
            WHEN "opportunity_name" = 'lu test 1' THEN 'lu test'
            WHEN "opportunity_name" = 'lu test 2' THEN 'lu test'
            WHEN "opportunity_name" = 'lu test 3' THEN 'lu test'
            ELSE "opportunity_name"
        END AS "opportunity_name",
        "next_step",
        "owner_id",
        "pricebook_id",
        "success_probability",
        "record_type_id",
        "opportunity_stage",
        "synced_quote_id",
        "territory_id",
        "opportunity_type",
        "is_active"
    FROM "sf_opportunity_data_projected_renamed"
),

"sf_opportunity_data_projected_renamed_cleaned_null" AS (
    -- NULL Imputation: Impute Null to Disguised Missing Values
    -- fiscal_period: ['']
    SELECT 
        CASE
            WHEN "fiscal_period" = '' THEN NULL
            ELSE "fiscal_period"
        END AS "fiscal_period",
        "is_closed",
        "last_referenced_date",
        "success_probability",
        "next_step",
        "fiscal_quarter",
        "last_viewed_date",
        "has_overdue_task",
        "opportunity_amount",
        "is_deleted",
        "is_won",
        "last_activity_date",
        "expected_revenue",
        "territory_id",
        "description",
        "fiscal_year",
        "opportunity_id",
        "is_active",
        "account_id",
        "has_line_items",
        "opportunity_stage",
        "owner_id",
        "pricebook_id",
        "record_type_id",
        "forecast_category",
        "close_date",
        "synced_quote_id",
        "created_date",
        "campaign_id",
        "forecast_category_name",
        "opportunity_type",
        "lead_source",
        "excluded_from_territory_2",
        "opportunity_name",
        "has_open_activity"
    FROM "sf_opportunity_data_projected_renamed_cleaned"
),

"sf_opportunity_data_projected_renamed_cleaned_null_casted" AS (
    -- Column Type Casting: 
    -- campaign_id: from DECIMAL to VARCHAR
    -- close_date: from VARCHAR to DATE
    -- created_date: from VARCHAR to TIMESTAMP
    -- description: from DECIMAL to VARCHAR
    -- excluded_from_territory_2: from DECIMAL to VARCHAR
    -- expected_revenue: from DECIMAL to VARCHAR
    -- fiscal_quarter: from INT to VARCHAR
    -- fiscal_year: from INT to VARCHAR
    -- last_activity_date: from DECIMAL to VARCHAR
    -- last_referenced_date: from DECIMAL to VARCHAR
    -- last_viewed_date: from DECIMAL to VARCHAR
    -- next_step: from DECIMAL to VARCHAR
    -- synced_quote_id: from DECIMAL to VARCHAR
    -- territory_id: from DECIMAL to VARCHAR
    SELECT
        "fiscal_period",
        "is_closed",
        "success_probability",
        "has_overdue_task",
        "opportunity_amount",
        "is_deleted",
        "is_won",
        "opportunity_id",
        "is_active",
        "account_id",
        "has_line_items",
        "opportunity_stage",
        "owner_id",
        "pricebook_id",
        "record_type_id",
        "forecast_category",
        "forecast_category_name",
        "opportunity_type",
        "lead_source",
        "opportunity_name",
        "has_open_activity",
        CAST("campaign_id" AS VARCHAR) AS "campaign_id",
        CAST("close_date" AS DATE) AS "close_date",
        CAST("created_date" AS TIMESTAMP) AS "created_date",
        CAST("description" AS VARCHAR) AS "description",
        CAST("excluded_from_territory_2" AS VARCHAR) AS "excluded_from_territory_2",
        CAST("expected_revenue" AS VARCHAR) AS "expected_revenue",
        CAST("fiscal_quarter" AS VARCHAR) AS "fiscal_quarter",
        CAST("fiscal_year" AS VARCHAR) AS "fiscal_year",
        CAST("last_activity_date" AS VARCHAR) AS "last_activity_date",
        CAST("last_referenced_date" AS VARCHAR) AS "last_referenced_date",
        CAST("last_viewed_date" AS VARCHAR) AS "last_viewed_date",
        CAST("next_step" AS VARCHAR) AS "next_step",
        CAST("synced_quote_id" AS VARCHAR) AS "synced_quote_id",
        CAST("territory_id" AS VARCHAR) AS "territory_id"
    FROM "sf_opportunity_data_projected_renamed_cleaned_null"
),

"sf_opportunity_data_projected_renamed_cleaned_null_casted_missing_handled" AS (
    -- Handling missing values: There are 13 columns with unacceptable missing values
    -- description has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- excluded_from_territory_2 has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- expected_revenue has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- fiscal_period has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_activity_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_referenced_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_viewed_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_source has 10.0 percent missing. Strategy: 🔄 Unchanged
    -- next_step has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- opportunity_amount has 60.0 percent missing. Strategy: 🔄 Unchanged
    -- pricebook_id has 80.0 percent missing. Strategy: 🔄 Unchanged
    -- synced_quote_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- territory_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    SELECT
        "is_closed",
        "success_probability",
        "has_overdue_task",
        "opportunity_amount",
        "is_deleted",
        "is_won",
        "opportunity_id",
        "is_active",
        "account_id",
        "has_line_items",
        "opportunity_stage",
        "owner_id",
        "pricebook_id",
        "record_type_id",
        "forecast_category",
        "forecast_category_name",
        "opportunity_type",
        "lead_source",
        "opportunity_name",
        "has_open_activity",
        "campaign_id",
        "close_date",
        "created_date",
        "fiscal_quarter",
        "fiscal_year"
    FROM "sf_opportunity_data_projected_renamed_cleaned_null_casted"
)

-- COCOON BLOCK END
SELECT * FROM "sf_opportunity_data_projected_renamed_cleaned_null_casted_missing_handled"

stg_sf_opportunity_data.yml (Document the table)

version: 2
models:
- name: stg_sf_opportunity_data
  description: The table is about sales opportunities. It includes details like account
    ID, opportunity amount, close date, created date, forecast category, probability,
    stage name, and owner ID. Each row represents a single opportunity with its associated
    information such as whether it's closed, won, or deleted. The table also includes
    fiscal period details and some boolean flags for opportunity characteristics.
  columns:
  - name: is_closed
    description: Indicates if the opportunity is closed
    tests:
    - not_null
  - name: success_probability
    description: Likelihood of closing the opportunity
    tests:
    - not_null
  - name: has_overdue_task
    description: Indicates if there's an overdue task
    tests:
    - not_null
  - name: opportunity_amount
    description: The monetary value of the opportunity
    tests:
    - not_null
  - name: is_deleted
    description: Indicates if the opportunity is deleted
    tests:
    - not_null
  - name: is_won
    description: Indicates if the opportunity is won
    tests:
    - not_null
  - name: opportunity_id
    description: Unique identifier for the opportunity
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column represents a unique identifier for each opportunity.
        For this table, each row is for a single opportunity, and opportunity_id is
        unique across rows.
  - name: is_active
    description: Indicates if the record is active in Fivetran
    tests:
    - not_null
  - name: account_id
    description: Unique identifier for the associated account
    tests:
    - not_null
  - name: has_line_items
    description: Indicates if opportunity has line items
    tests:
    - not_null
  - name: opportunity_stage
    description: Current stage of the sales opportunity
    tests:
    - not_null
    - accepted_values:
        values:
        - Lead
        - Qualified Lead
        - Needs Analysis
        - Proposal
        - Negotiation
        - Closed Won
        - Closed Lost
        - GavUFuuf4DrnQAoiRGlWpQ==
        - tXi3M8u3iPxq0ggxTSxMKw==
        - 9RN9J3tlxr89gDctReax5w==
  - name: owner_id
    description: Identifier for the opportunity owner
    tests:
    - not_null
  - name: pricebook_id
    description: Identifier for the associated pricebook
    tests:
    - not_null
  - name: record_type_id
    description: Identifier for the type of record
    tests:
    - not_null
  - name: forecast_category
    description: Category for forecasting purposes
    tests:
    - not_null
  - name: forecast_category_name
    description: Name of the forecast category
    tests:
    - not_null
  - name: opportunity_type
    description: Classification or category of the opportunity
    tests:
    - not_null
  - name: lead_source
    description: Source of the lead for this opportunity
    tests:
    - not_null
  - name: opportunity_name
    description: Name of the opportunity
    tests:
    - not_null
  - name: has_open_activity
    description: Indicates if there's an open activity
    tests:
    - not_null
  - name: campaign_id
    description: Identifier for the associated marketing campaign
    cocoon_meta:
      missing_acceptable: Not all opportunities are associated with marketing campaigns.
  - name: close_date
    description: Date when the opportunity was closed
    tests:
    - not_null
  - name: created_date
    description: Date when the opportunity was created
    tests:
    - not_null
  - name: fiscal_quarter
    description: Fiscal quarter of the opportunity
    tests:
    - not_null
    - accepted_values:
        values:
        - '1'
        - '2'
        - '3'
        - '4'
  - name: fiscal_year
    description: Fiscal year of the opportunity
    tests:
    - not_null
    - accepted_values:
        values:
        - '2015'
        - '2016'
        - '2017'
        - '2018'
        - '2019'
        - '2020'
        - '2021'
        - '2022'
        - '2023'
        - '2024'

stg_sf_order_data (first 100 rows)

billing_postal_code billing_state is_prepaid_order account_id netsuite_id billing_country pricebook_id calculate_tax invoicing_type update_subscriptions_only billing_account_id shipping_state last_modifier_id tax_calculation_status order_status order_id shipping_country owner_id billing_city prepaid_billing_frequency is_test_mode invoice_batch_type billing_longitude payment_terms order_status_code order_total credit_summary shipping_street creator_id billing_latitude legal_entity_id netsuite_sync_status shipping_city netsuite_order_number bill_immediately is_contracted quote_id is_deleted has_rollover_spend_amendment price_calculation_status skip_netsuite_export netsuite_record_id contracting_method activator_id auto_activated_flag is_seller_importer_of_record billing_day_of_month is_reduction_order is_evergreen order_type activation_datetime amendment_type billing_geocode_accuracy billing_state_code created_date effective_date end_date invoice_message is_active is_hvr_legacy_order last_modified_date last_modified_timestamp netsuite_discount_total netsuite_order_status netsuite_subtotal netsuite_tax_total netsuite_total order_number shipping_postal_code
0 None None False 0011G00000gY0y4QAC NaN United States 01s1G000001N7EKQA0 False Other False 0011G00000gY0y4QAC New York 0051G000005MunnQAC Tax Amount Is Up To Date Activated 8011G000000XFeOQAW United States 0051G000005MumuQAC New York None False Domestic (US) NaN Net 30 Activated 0.0 None 123 Ave 0051G000005MumuQAC NaN a8k1G000000k9d4QAA False New York None False True a4V1G000000TpflUAC False False Not Needed False None By Subscription End Date 0051G000005MumuQAC False False 1 False False New 2019-11-11 17:23:34 None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 NaT None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None None None None 5392 55555
1 None None False 0011G00000gY0y4QAC 1058073.0 United States 01s1G000001N7EKQA0 False Prepaid Credits False 0011G00000gY0y4QAC New York 0051G000005MunnQAC Tax Amount Is Up To Date Activated 8011G000000XFePQAW United States 0051G000005MumuQAC New York Annual False Daily NaN Net 30 Activated 27998.6 a9e1G000000KztBQAS 123 Ave 0051G000005MumuQAC NaN a8k1G000000k9d4QAA False New York None False True a4V1G000000TpflUAC False False Not Needed False None By Subscription End Date 0051G000005MumuQAC False False 30 False False New 2019-11-11 17:23:34 None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 NaT None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None None None None 5393 55555
2 55555 New York False 0011G00000f8IrIQAU NaN United States 01s1G000001N7EKQA0 False Other False 0011G00000f8IrIQAU New York 0051G000005MunnQAC Tax Amount Is Up To Date Activated 8011G000000XDsxQAG United States 0051G000005MumuQAC New York None False Domestic (US) NaN Net 30 Activated 0.0 None 123 Ave 0051G000005MumuQAC NaN a8k1G000000k9d4QAA False New York None False True a4V1G000000TpGCUA0 False False Not Needed False None By Subscription End Date 0051G000005MumuQAC False False 1 False False New 2019-11-11 17:23:34 None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 NaT None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None None None None 2597 55555
3 55555 New York False 0011G00000f8IrIQAU 1057821.0 United States 01s1G000001N7EKQA0 False Prepaid Credits False 0011G00000f8IrIQAU New York 0051G000005MunnQAC Tax Amount Is Up To Date Activated 8011G000000XDsyQAG United States 0051G000005MumuQAC New York Annual False Daily NaN Net 30 Activated 1200.0 a9e1G000000TNSGQA4 123 Ave 0051G000005MumuQAC NaN a8k1G000000k9d4QAA False New York None False True a4V1G000000TpGCUA0 False False Not Needed False None By Subscription End Date 0051G000005MumuQAC False False 30 False False New 2019-11-11 17:23:34 None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 NaT None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None None None None 2598 55555
4 55555 Maryland False 0011G00000fIPsfQAG 1057817.0 United States 01s1G000001N7EKQA0 False Prepaid Credits False 0011G00000fIPsfQAG Maryland 0051G000005MunnQAC No Tax Required Activated 8011G000000XDseQAG United States 0051G000005MumuQAC Baltimore Annual False Daily NaN Net 30 Activated 20400.0 a9e1G000000KzojQAC 123 Ave 0051G000005MumuQAC NaN a8k1G000000k9d4QAA False Baltimore None False True a4V1G000000TpCtUAK False False Not Needed False None By Subscription End Date 0051G000005MumuQAC False False 30 False False New 2019-11-11 17:23:34 None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 NaT None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None None None None 2591 55555
5 55555 Maryland False 0011G00000fIPsfQAG NaN United States 01s1G000001N7EKQA0 False Other False 0011G00000fIPsfQAG Maryland 0051G000005MunnQAC No Tax Required Activated 8011G000000XDsdQAG United States 0051G000005MumuQAC Baltimore None False Domestic (US) NaN Net 30 Activated 0.0 None 123 Ave 0051G000005MumuQAC NaN a8k1G000000k9d4QAA False Baltimore None False True a4V1G000000TpCtUAK False False Not Needed False None By Subscription End Date 0051G000005MumuQAC False False 1 False False New 2019-11-11 17:23:34 None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 NaT None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None None None None 2590 55555
6 55555 Florida False 0011G00000nKDIvQAO 1058653.0 United States 01s1G000001N7EKQA0 False Prepaid Credits False 0011G00000nKDIvQAO Florida 0051G000005MunnQAC No Tax Required Activated 8011G000000XIK8QAO United States 0051G000005MumuQAC Fort Lauderdale None True Daily NaN Net 30 Activated 4500.0 a9e1G000000L1n3QAC 123 Ave 0051G000005MumuQAC NaN a8k1G000000k9d4QAA False Fort Lauderdale SO6556 False True a4V1G000000Tv9vUAC False False Not Needed False google.com By Subscription End Date 0051G000005MumuQAC False False 25 False False New 2019-11-11 17:23:34 None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 NaT None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None None None None 8359 55555
7 55555 Florida False 0011G00000nKDIvQAO NaN United States 01s1G000001N7EKQA0 False Other False 0011G00000nKDIvQAO Florida 0051G000005MumuQAC No Tax Required Activated 8011G000000XIK7QAO United States 0051G000005MumuQAC Fort Lauderdale None False Domestic (US) NaN Net 30 Activated 0.0 None 123 Ave 0051G000005MumuQAC NaN a8k1G000000k9d4QAA False Fort Lauderdale None False True a4V1G000000Tv9vUAC False False Not Needed False None By Subscription End Date 0051G000005MumuQAC False False 1 False False New 2019-11-11 17:23:34 None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 NaT None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None None None None 8358 55555
8 55555 Florida False 0011G00000gZNEkQAO 1057423.0 United States 01s1G000001N7EKQA0 False Prepaid Credits False 0011G00000gZNEkQAO Florida 0051G000005MunnQAC No Tax Required Activated 8011G000000XChLQAW United States 0051G000005MumuQAC Tampa Annual False Daily NaN Net 30 Activated 702.0 a9e1G000000TNOiQAO 123 Ave 0051G000005MumuQAC NaN a8k1G000000k9d4QAA False Tampa None False True a4V1G000000TnQAUA0 False False Not Needed False None By Subscription End Date 0051G000005MumuQAC False False 28 False False New 2019-11-11 17:23:34 None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 NaT None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None None None None 1354 55555
9 55555 Florida False 0011G00000gZNEkQAO NaN United States 01s1G000001N7EKQA0 False Other False 0011G00000gZNEkQAO Florida 0051G000005MunnQAC No Tax Required Activated 8011G000000XChKQAW United States 0051G000005MumuQAC Tampa None False Domestic (US) NaN Net 30 Activated 0.0 None 123 Ave 0051G000005MumuQAC NaN a8k1G000000k9d4QAA False Tampa None False True a4V1G000000TnQAUA0 False False Not Needed False None By Subscription End Date 0051G000005MumuQAC False False 1 False False New 2019-11-11 17:23:34 None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 NaT None None None 2019-11-11 17:23:34 2019-11-11 17:23:34 None None None None None 1353 55555

stg_sf_order_data.sql (clean the table)

-- COCOON BLOCK START: PLEASE DO NOT MODIFY THIS BLOCK FOR SELF-MAINTENANCE
WITH 
"sf_order_data_removeWideColumns" AS (
    -- Remove wide columns with pattern. The regex and columns are:
    -- ^netsuite_conn_.*$: netsuite_conn_celigo_update_c, netsuite_conn_discount_total_c, netsuite_conn_document_id_c, netsuite_conn_net_suite_id_c, netsuite_conn_net_suite_order_date_c, netsuite_conn_net_suite_order_number_c, netsuite_conn_net_suite_order_status_c, netsuite_conn_net_suite_sync_err_c, netsuite_conn_opportunity_c, netsuite_conn_push_to_net_suite_c ...
    SELECT 
        "_fivetran_active",
        "_fivetran_synced",
        "account_id",
        "activated_by_id",
        "activated_date",
        "amend_with_rollover_spend_type_c",
        "amendment_type_c",
        "ava_sfcpq_ava_tax_message_c",
        "ava_sfcpq_entity_use_code_c",
        "ava_sfcpq_invoice_message_c",
        "ava_sfcpq_is_seller_importer_of_record_c",
        "ava_sfcpq_order_calculate_tax_c",
        "ava_sfcpq_sales_tax_amount_c",
        "billing_city",
        "billing_country",
        "billing_country_code",
        "billing_geocode_accuracy",
        "billing_latitude",
        "billing_longitude",
        "billing_postal_code",
        "billing_state",
        "billing_state_code",
        "billing_street",
        "blng_bill_now_c",
        "blng_billing_account_c",
        "blng_billing_day_of_month_c",
        "blng_invoice_batch_c",
        "celigo_sfnsio_discount_total_net_suite_c",
        "celigo_sfnsio_net_suite_id_c",
        "celigo_sfnsio_net_suite_order_number_c",
        "celigo_sfnsio_net_suite_order_status_c",
        "celigo_sfnsio_net_suite_record_c",
        "celigo_sfnsio_ship_date_c",
        "celigo_sfnsio_skip_export_to_net_suite_c",
        "celigo_sfnsio_sub_total_net_suite_c",
        "celigo_sfnsio_tax_total_net_suite_c",
        "celigo_sfnsio_test_mode_record_c",
        "celigo_sfnsio_total_net_suite_c",
        "company_authorized_by_id",
        "contract_id",
        "created_by_id",
        "created_date",
        "credit_summary_c",
        "customer_authorized_by_id",
        "customer_spend_type_c",
        "description",
        "effective_date",
        "end_date",
        "evergreen_c",
        "id",
        "invoicing_type_c",
        "ironclad_workflow_c",
        "is_deleted",
        "is_hvr_legacy_order_c",
        "is_reduction_order",
        "last_modified_by_id",
        "last_modified_date",
        "last_referenced_date",
        "last_viewed_date",
        "legal_entity_c",
        "opportunity_id",
        "order_auto_activated_c",
        "order_number",
        "order_spend_type_c",
        "original_order_id",
        "owner_id",
        "prepaid_billing_frequency_c",
        "prepaid_order_c",
        "pricebook_2_id",
        "purchase_order_number_c",
        "purchase_summary_c",
        "sbqq_contracted_c",
        "sbqq_contracting_method_c",
        "sbqq_payment_term_c",
        "sbqq_price_calc_status_c",
        "sbqq_price_calc_status_message_c",
        "sbqq_quote_c",
        "sbqq_renewal_term_c",
        "sbqq_renewal_uplift_rate_c",
        "shipping_city",
        "shipping_country",
        "shipping_country_code",
        "shipping_geocode_accuracy",
        "shipping_latitude",
        "shipping_longitude",
        "shipping_postal_code",
        "shipping_state",
        "shipping_state_code",
        "shipping_street",
        "status",
        "status_code",
        "synced_to_net_suite_c",
        "system_modstamp",
        "total_amount",
        "type",
        "update_subscriptions_only_c"
    FROM "sf_order_data"
),

"sf_order_data_removeWideColumns_projected" AS (
    -- Projection: Selecting 95 out of 96 columns
    -- Columns projected out: ['_fivetran_synced']
    SELECT 
        "_fivetran_active",
        "account_id",
        "activated_by_id",
        "activated_date",
        "amend_with_rollover_spend_type_c",
        "amendment_type_c",
        "ava_sfcpq_ava_tax_message_c",
        "ava_sfcpq_entity_use_code_c",
        "ava_sfcpq_invoice_message_c",
        "ava_sfcpq_is_seller_importer_of_record_c",
        "ava_sfcpq_order_calculate_tax_c",
        "ava_sfcpq_sales_tax_amount_c",
        "billing_city",
        "billing_country",
        "billing_country_code",
        "billing_geocode_accuracy",
        "billing_latitude",
        "billing_longitude",
        "billing_postal_code",
        "billing_state",
        "billing_state_code",
        "billing_street",
        "blng_bill_now_c",
        "blng_billing_account_c",
        "blng_billing_day_of_month_c",
        "blng_invoice_batch_c",
        "celigo_sfnsio_discount_total_net_suite_c",
        "celigo_sfnsio_net_suite_id_c",
        "celigo_sfnsio_net_suite_order_number_c",
        "celigo_sfnsio_net_suite_order_status_c",
        "celigo_sfnsio_net_suite_record_c",
        "celigo_sfnsio_ship_date_c",
        "celigo_sfnsio_skip_export_to_net_suite_c",
        "celigo_sfnsio_sub_total_net_suite_c",
        "celigo_sfnsio_tax_total_net_suite_c",
        "celigo_sfnsio_test_mode_record_c",
        "celigo_sfnsio_total_net_suite_c",
        "company_authorized_by_id",
        "contract_id",
        "created_by_id",
        "created_date",
        "credit_summary_c",
        "customer_authorized_by_id",
        "customer_spend_type_c",
        "description",
        "effective_date",
        "end_date",
        "evergreen_c",
        "id",
        "invoicing_type_c",
        "ironclad_workflow_c",
        "is_deleted",
        "is_hvr_legacy_order_c",
        "is_reduction_order",
        "last_modified_by_id",
        "last_modified_date",
        "last_referenced_date",
        "last_viewed_date",
        "legal_entity_c",
        "opportunity_id",
        "order_auto_activated_c",
        "order_number",
        "order_spend_type_c",
        "original_order_id",
        "owner_id",
        "prepaid_billing_frequency_c",
        "prepaid_order_c",
        "pricebook_2_id",
        "purchase_order_number_c",
        "purchase_summary_c",
        "sbqq_contracted_c",
        "sbqq_contracting_method_c",
        "sbqq_payment_term_c",
        "sbqq_price_calc_status_c",
        "sbqq_price_calc_status_message_c",
        "sbqq_quote_c",
        "sbqq_renewal_term_c",
        "sbqq_renewal_uplift_rate_c",
        "shipping_city",
        "shipping_country",
        "shipping_country_code",
        "shipping_geocode_accuracy",
        "shipping_latitude",
        "shipping_longitude",
        "shipping_postal_code",
        "shipping_state",
        "shipping_state_code",
        "shipping_street",
        "status",
        "status_code",
        "synced_to_net_suite_c",
        "system_modstamp",
        "total_amount",
        "type",
        "update_subscriptions_only_c"
    FROM "sf_order_data_removeWideColumns"
),

"sf_order_data_removeWideColumns_projected_renamed" AS (
    -- Rename: Renaming columns
    -- _fivetran_active -> is_active
    -- activated_by_id -> activator_id
    -- activated_date -> activation_datetime
    -- amend_with_rollover_spend_type_c -> has_rollover_spend_amendment
    -- amendment_type_c -> amendment_type
    -- ava_sfcpq_ava_tax_message_c -> tax_calculation_status
    -- ava_sfcpq_entity_use_code_c -> entity_use_code
    -- ava_sfcpq_invoice_message_c -> invoice_message
    -- ava_sfcpq_is_seller_importer_of_record_c -> is_seller_importer_of_record
    -- ava_sfcpq_order_calculate_tax_c -> calculate_tax
    -- ava_sfcpq_sales_tax_amount_c -> sales_tax_amount
    -- blng_bill_now_c -> bill_immediately
    -- blng_billing_account_c -> billing_account_id
    -- blng_billing_day_of_month_c -> billing_day_of_month
    -- blng_invoice_batch_c -> invoice_batch_type
    -- celigo_sfnsio_discount_total_net_suite_c -> netsuite_discount_total
    -- celigo_sfnsio_net_suite_id_c -> netsuite_id
    -- celigo_sfnsio_net_suite_order_number_c -> netsuite_order_number
    -- celigo_sfnsio_net_suite_order_status_c -> netsuite_order_status
    -- celigo_sfnsio_net_suite_record_c -> netsuite_record_id
    -- celigo_sfnsio_ship_date_c -> ship_date
    -- celigo_sfnsio_skip_export_to_net_suite_c -> skip_netsuite_export
    -- celigo_sfnsio_sub_total_net_suite_c -> netsuite_subtotal
    -- celigo_sfnsio_tax_total_net_suite_c -> netsuite_tax_total
    -- celigo_sfnsio_test_mode_record_c -> is_test_mode
    -- celigo_sfnsio_total_net_suite_c -> netsuite_total
    -- company_authorized_by_id -> company_authorizer_id
    -- created_by_id -> creator_id
    -- credit_summary_c -> credit_summary
    -- customer_authorized_by_id -> customer_authorizer_id
    -- evergreen_c -> is_evergreen
    -- id -> order_id
    -- invoicing_type_c -> invoicing_type
    -- ironclad_workflow_c -> ironclad_workflow
    -- is_hvr_legacy_order_c -> is_hvr_legacy_order
    -- last_modified_by_id -> last_modifier_id
    -- legal_entity_c -> legal_entity_id
    -- order_auto_activated_c -> auto_activated_flag
    -- prepaid_billing_frequency_c -> prepaid_billing_frequency
    -- prepaid_order_c -> is_prepaid_order
    -- pricebook_2_id -> pricebook_id
    -- purchase_order_number_c -> purchase_order_number
    -- purchase_summary_c -> purchase_summary
    -- sbqq_contracted_c -> is_contracted
    -- sbqq_contracting_method_c -> contracting_method
    -- sbqq_payment_term_c -> payment_terms
    -- sbqq_price_calc_status_c -> price_calculation_status
    -- sbqq_price_calc_status_message_c -> price_calculation_message
    -- sbqq_quote_c -> quote_id
    -- sbqq_renewal_term_c -> renewal_term
    -- sbqq_renewal_uplift_rate_c -> renewal_uplift_rate
    -- status -> order_status
    -- status_code -> order_status_code
    -- synced_to_net_suite_c -> netsuite_sync_status
    -- system_modstamp -> last_modified_timestamp
    -- total_amount -> order_total
    -- type -> order_type
    -- update_subscriptions_only_c -> update_subscriptions_only
    SELECT 
        "_fivetran_active" AS "is_active",
        "account_id",
        "activated_by_id" AS "activator_id",
        "activated_date" AS "activation_datetime",
        "amend_with_rollover_spend_type_c" AS "has_rollover_spend_amendment",
        "amendment_type_c" AS "amendment_type",
        "ava_sfcpq_ava_tax_message_c" AS "tax_calculation_status",
        "ava_sfcpq_entity_use_code_c" AS "entity_use_code",
        "ava_sfcpq_invoice_message_c" AS "invoice_message",
        "ava_sfcpq_is_seller_importer_of_record_c" AS "is_seller_importer_of_record",
        "ava_sfcpq_order_calculate_tax_c" AS "calculate_tax",
        "ava_sfcpq_sales_tax_amount_c" AS "sales_tax_amount",
        "billing_city",
        "billing_country",
        "billing_country_code",
        "billing_geocode_accuracy",
        "billing_latitude",
        "billing_longitude",
        "billing_postal_code",
        "billing_state",
        "billing_state_code",
        "billing_street",
        "blng_bill_now_c" AS "bill_immediately",
        "blng_billing_account_c" AS "billing_account_id",
        "blng_billing_day_of_month_c" AS "billing_day_of_month",
        "blng_invoice_batch_c" AS "invoice_batch_type",
        "celigo_sfnsio_discount_total_net_suite_c" AS "netsuite_discount_total",
        "celigo_sfnsio_net_suite_id_c" AS "netsuite_id",
        "celigo_sfnsio_net_suite_order_number_c" AS "netsuite_order_number",
        "celigo_sfnsio_net_suite_order_status_c" AS "netsuite_order_status",
        "celigo_sfnsio_net_suite_record_c" AS "netsuite_record_id",
        "celigo_sfnsio_ship_date_c" AS "ship_date",
        "celigo_sfnsio_skip_export_to_net_suite_c" AS "skip_netsuite_export",
        "celigo_sfnsio_sub_total_net_suite_c" AS "netsuite_subtotal",
        "celigo_sfnsio_tax_total_net_suite_c" AS "netsuite_tax_total",
        "celigo_sfnsio_test_mode_record_c" AS "is_test_mode",
        "celigo_sfnsio_total_net_suite_c" AS "netsuite_total",
        "company_authorized_by_id" AS "company_authorizer_id",
        "contract_id",
        "created_by_id" AS "creator_id",
        "created_date",
        "credit_summary_c" AS "credit_summary",
        "customer_authorized_by_id" AS "customer_authorizer_id",
        "customer_spend_type_c",
        "description",
        "effective_date",
        "end_date",
        "evergreen_c" AS "is_evergreen",
        "id" AS "order_id",
        "invoicing_type_c" AS "invoicing_type",
        "ironclad_workflow_c" AS "ironclad_workflow",
        "is_deleted",
        "is_hvr_legacy_order_c" AS "is_hvr_legacy_order",
        "is_reduction_order",
        "last_modified_by_id" AS "last_modifier_id",
        "last_modified_date",
        "last_referenced_date",
        "last_viewed_date",
        "legal_entity_c" AS "legal_entity_id",
        "opportunity_id",
        "order_auto_activated_c" AS "auto_activated_flag",
        "order_number",
        "order_spend_type_c",
        "original_order_id",
        "owner_id",
        "prepaid_billing_frequency_c" AS "prepaid_billing_frequency",
        "prepaid_order_c" AS "is_prepaid_order",
        "pricebook_2_id" AS "pricebook_id",
        "purchase_order_number_c" AS "purchase_order_number",
        "purchase_summary_c" AS "purchase_summary",
        "sbqq_contracted_c" AS "is_contracted",
        "sbqq_contracting_method_c" AS "contracting_method",
        "sbqq_payment_term_c" AS "payment_terms",
        "sbqq_price_calc_status_c" AS "price_calculation_status",
        "sbqq_price_calc_status_message_c" AS "price_calculation_message",
        "sbqq_quote_c" AS "quote_id",
        "sbqq_renewal_term_c" AS "renewal_term",
        "sbqq_renewal_uplift_rate_c" AS "renewal_uplift_rate",
        "shipping_city",
        "shipping_country",
        "shipping_country_code",
        "shipping_geocode_accuracy",
        "shipping_latitude",
        "shipping_longitude",
        "shipping_postal_code",
        "shipping_state",
        "shipping_state_code",
        "shipping_street",
        "status" AS "order_status",
        "status_code" AS "order_status_code",
        "synced_to_net_suite_c" AS "netsuite_sync_status",
        "system_modstamp" AS "last_modified_timestamp",
        "total_amount" AS "order_total",
        "type" AS "order_type",
        "update_subscriptions_only_c" AS "update_subscriptions_only"
    FROM "sf_order_data_removeWideColumns_projected"
),

"sf_order_data_removeWideColumns_projected_renamed_cleaned" AS (
    -- Clean unusual string values: 
    -- billing_city: The problem is that 'New York' and 'New York, NY' are redundant representations of the same city. The correct values should be consistent in format. Since 'New York' is more frequent and aligns with the format of other cities (no state abbreviation), it should be the standard format. 
    -- billing_postal_code: The problem is that 'USA' is not a valid postal code, but rather a country name. Postal codes in the USA typically consist of 5 digits, sometimes followed by a hyphen and 4 more digits. The value '55555' appears to be a valid US postal code format, while 'USA' is clearly incorrect. Since we don't have enough information to determine the correct postal code for entries marked 'USA', the best approach is to map these to an empty string, indicating missing data. 
    -- billing_state: The problem is that the billing_state column contains a mix of state names, state abbreviations, and even a ZIP code, which is inconsistent and incorrect for a state field. The correct values should be full state names. 'Florida' and 'New York' are already correct. 'MD' is an abbreviation that should be expanded to 'Maryland'. The ZIP code '55555-1502' is not a state at all and should be removed or replaced with the correct state if that information is available elsewhere. 
    -- billing_street: The problem is that '123 Ave' appears to be a placeholder or dummy address rather than a real street address. This is likely used as a default value or for testing purposes. In a real dataset, we would expect to see a variety of unique street addresses. The correct approach would be to leave this field blank or null until a real address is provided. 
    SELECT
        "is_active",
        "account_id",
        "activator_id",
        "activation_datetime",
        "has_rollover_spend_amendment",
        "amendment_type",
        "tax_calculation_status",
        "entity_use_code",
        "invoice_message",
        "is_seller_importer_of_record",
        "calculate_tax",
        "sales_tax_amount",
        CASE
            WHEN "billing_city" = 'New York, NY' THEN 'New York'
            ELSE "billing_city"
        END AS "billing_city",
        "billing_country",
        "billing_country_code",
        "billing_geocode_accuracy",
        "billing_latitude",
        "billing_longitude",
        CASE
            WHEN "billing_postal_code" = 'USA' THEN ''
            ELSE "billing_postal_code"
        END AS "billing_postal_code",
        CASE
            WHEN "billing_state" = '55555-1502' THEN ''
            WHEN "billing_state" = 'MD' THEN 'Maryland'
            ELSE "billing_state"
        END AS "billing_state",
        "billing_state_code",
        CASE
            WHEN "billing_street" = '123 Ave' THEN ''
            ELSE "billing_street"
        END AS "billing_street",
        "bill_immediately",
        "billing_account_id",
        "billing_day_of_month",
        "invoice_batch_type",
        "netsuite_discount_total",
        "netsuite_id",
        "netsuite_order_number",
        "netsuite_order_status",
        "netsuite_record_id",
        "ship_date",
        "skip_netsuite_export",
        "netsuite_subtotal",
        "netsuite_tax_total",
        "is_test_mode",
        "netsuite_total",
        "company_authorizer_id",
        "contract_id",
        "creator_id",
        "created_date",
        "credit_summary",
        "customer_authorizer_id",
        "customer_spend_type_c",
        "description",
        "effective_date",
        "end_date",
        "is_evergreen",
        "order_id",
        "invoicing_type",
        "ironclad_workflow",
        "is_deleted",
        "is_hvr_legacy_order",
        "is_reduction_order",
        "last_modifier_id",
        "last_modified_date",
        "last_referenced_date",
        "last_viewed_date",
        "legal_entity_id",
        "opportunity_id",
        "auto_activated_flag",
        "order_number",
        "order_spend_type_c",
        "original_order_id",
        "owner_id",
        "prepaid_billing_frequency",
        "is_prepaid_order",
        "pricebook_id",
        "purchase_order_number",
        "purchase_summary",
        "is_contracted",
        "contracting_method",
        "payment_terms",
        "price_calculation_status",
        "price_calculation_message",
        "quote_id",
        "renewal_term",
        "renewal_uplift_rate",
        "shipping_city",
        "shipping_country",
        "shipping_country_code",
        "shipping_geocode_accuracy",
        "shipping_latitude",
        "shipping_longitude",
        "shipping_postal_code",
        "shipping_state",
        "shipping_state_code",
        "shipping_street",
        "order_status",
        "order_status_code",
        "netsuite_sync_status",
        "last_modified_timestamp",
        "order_total",
        "order_type",
        "update_subscriptions_only"
    FROM "sf_order_data_removeWideColumns_projected_renamed"
),

"sf_order_data_removeWideColumns_projected_renamed_cleaned_null" AS (
    -- NULL Imputation: Impute Null to Disguised Missing Values
    -- billing_postal_code: ['']
    -- billing_state: ['']
    -- billing_street: ['']
    SELECT 
        CASE
            WHEN "billing_postal_code" = '' THEN NULL
            ELSE "billing_postal_code"
        END AS "billing_postal_code",
        CASE
            WHEN "billing_state" = '' THEN NULL
            ELSE "billing_state"
        END AS "billing_state",
        CASE
            WHEN "billing_street" = '' THEN NULL
            ELSE "billing_street"
        END AS "billing_street",
        "is_prepaid_order",
        "account_id",
        "order_number",
        "effective_date",
        "renewal_uplift_rate",
        "netsuite_discount_total",
        "netsuite_id",
        "billing_country",
        "order_spend_type_c",
        "description",
        "pricebook_id",
        "calculate_tax",
        "invoicing_type",
        "update_subscriptions_only",
        "last_referenced_date",
        "billing_account_id",
        "shipping_state",
        "netsuite_total",
        "renewal_term",
        "last_modifier_id",
        "tax_calculation_status",
        "end_date",
        "entity_use_code",
        "order_status",
        "order_id",
        "shipping_country",
        "owner_id",
        "billing_city",
        "billing_country_code",
        "billing_state_code",
        "ironclad_workflow",
        "prepaid_billing_frequency",
        "is_hvr_legacy_order",
        "customer_spend_type_c",
        "amendment_type",
        "is_test_mode",
        "opportunity_id",
        "shipping_country_code",
        "invoice_batch_type",
        "billing_longitude",
        "payment_terms",
        "order_status_code",
        "order_total",
        "credit_summary",
        "billing_geocode_accuracy",
        "shipping_street",
        "last_modified_date",
        "creator_id",
        "billing_latitude",
        "original_order_id",
        "legal_entity_id",
        "company_authorizer_id",
        "activation_datetime",
        "netsuite_sync_status",
        "shipping_city",
        "shipping_longitude",
        "contract_id",
        "netsuite_order_number",
        "bill_immediately",
        "is_contracted",
        "shipping_postal_code",
        "created_date",
        "ship_date",
        "shipping_latitude",
        "is_active",
        "quote_id",
        "is_deleted",
        "has_rollover_spend_amendment",
        "sales_tax_amount",
        "price_calculation_status",
        "shipping_geocode_accuracy",
        "last_viewed_date",
        "invoice_message",
        "shipping_state_code",
        "purchase_summary",
        "skip_netsuite_export",
        "netsuite_record_id",
        "contracting_method",
        "activator_id",
        "auto_activated_flag",
        "last_modified_timestamp",
        "netsuite_subtotal",
        "price_calculation_message",
        "purchase_order_number",
        "netsuite_tax_total",
        "is_seller_importer_of_record",
        "netsuite_order_status",
        "billing_day_of_month",
        "customer_authorizer_id",
        "is_reduction_order",
        "is_evergreen",
        "order_type"
    FROM "sf_order_data_removeWideColumns_projected_renamed_cleaned"
),

"sf_order_data_removeWideColumns_projected_renamed_cleaned_null_casted" AS (
    -- Column Type Casting: 
    -- activation_datetime: from VARCHAR to TIMESTAMP
    -- amendment_type: from DECIMAL to VARCHAR
    -- billing_country_code: from DECIMAL to VARCHAR
    -- billing_geocode_accuracy: from DECIMAL to VARCHAR
    -- billing_state_code: from DECIMAL to VARCHAR
    -- company_authorizer_id: from DECIMAL to VARCHAR
    -- contract_id: from DECIMAL to VARCHAR
    -- created_date: from VARCHAR to TIMESTAMP
    -- customer_authorizer_id: from DECIMAL to VARCHAR
    -- customer_spend_type_c: from DECIMAL to VARCHAR
    -- description: from DECIMAL to VARCHAR
    -- effective_date: from VARCHAR to TIMESTAMP
    -- end_date: from DECIMAL to DATE
    -- entity_use_code: from DECIMAL to VARCHAR
    -- invoice_message: from DECIMAL to VARCHAR
    -- ironclad_workflow: from DECIMAL to VARCHAR
    -- is_active: from DECIMAL to VARCHAR
    -- is_hvr_legacy_order: from DECIMAL to VARCHAR
    -- last_modified_date: from VARCHAR to TIMESTAMP
    -- last_modified_timestamp: from VARCHAR to TIMESTAMP
    -- last_referenced_date: from DECIMAL to VARCHAR
    -- last_viewed_date: from DECIMAL to VARCHAR
    -- netsuite_discount_total: from DECIMAL to VARCHAR
    -- netsuite_order_status: from DECIMAL to VARCHAR
    -- netsuite_subtotal: from DECIMAL to VARCHAR
    -- netsuite_tax_total: from DECIMAL to VARCHAR
    -- netsuite_total: from DECIMAL to VARCHAR
    -- opportunity_id: from DECIMAL to VARCHAR
    -- order_number: from INT to VARCHAR
    -- order_spend_type_c: from DECIMAL to VARCHAR
    -- original_order_id: from DECIMAL to VARCHAR
    -- price_calculation_message: from DECIMAL to VARCHAR
    -- purchase_order_number: from DECIMAL to VARCHAR
    -- purchase_summary: from DECIMAL to VARCHAR
    -- renewal_term: from DECIMAL to VARCHAR
    -- renewal_uplift_rate: from DECIMAL to VARCHAR
    -- sales_tax_amount: from DECIMAL to VARCHAR
    -- ship_date: from DECIMAL to DATE
    -- shipping_country_code: from DECIMAL to VARCHAR
    -- shipping_geocode_accuracy: from DECIMAL to VARCHAR
    -- shipping_postal_code: from INT to VARCHAR
    -- shipping_state_code: from DECIMAL to VARCHAR
    SELECT
        "billing_postal_code",
        "billing_state",
        "billing_street",
        "is_prepaid_order",
        "account_id",
        "netsuite_id",
        "billing_country",
        "pricebook_id",
        "calculate_tax",
        "invoicing_type",
        "update_subscriptions_only",
        "billing_account_id",
        "shipping_state",
        "last_modifier_id",
        "tax_calculation_status",
        "order_status",
        "order_id",
        "shipping_country",
        "owner_id",
        "billing_city",
        "prepaid_billing_frequency",
        "is_test_mode",
        "invoice_batch_type",
        "billing_longitude",
        "payment_terms",
        "order_status_code",
        "order_total",
        "credit_summary",
        "shipping_street",
        "creator_id",
        "billing_latitude",
        "legal_entity_id",
        "netsuite_sync_status",
        "shipping_city",
        "shipping_longitude",
        "netsuite_order_number",
        "bill_immediately",
        "is_contracted",
        "shipping_latitude",
        "quote_id",
        "is_deleted",
        "has_rollover_spend_amendment",
        "price_calculation_status",
        "skip_netsuite_export",
        "netsuite_record_id",
        "contracting_method",
        "activator_id",
        "auto_activated_flag",
        "is_seller_importer_of_record",
        "billing_day_of_month",
        "is_reduction_order",
        "is_evergreen",
        "order_type",
        CAST("activation_datetime" AS TIMESTAMP) AS "activation_datetime",
        CAST("amendment_type" AS VARCHAR) AS "amendment_type",
        CAST("billing_country_code" AS VARCHAR) AS "billing_country_code",
        CAST("billing_geocode_accuracy" AS VARCHAR) AS "billing_geocode_accuracy",
        CAST("billing_state_code" AS VARCHAR) AS "billing_state_code",
        CAST("company_authorizer_id" AS VARCHAR) AS "company_authorizer_id",
        CAST("contract_id" AS VARCHAR) AS "contract_id",
        CAST("created_date" AS TIMESTAMP) AS "created_date",
        CAST("customer_authorizer_id" AS VARCHAR) AS "customer_authorizer_id",
        CAST("customer_spend_type_c" AS VARCHAR) AS "customer_spend_type_c",
        CAST("description" AS VARCHAR) AS "description",
        CAST("effective_date" AS TIMESTAMP) AS "effective_date",
        CAST("end_date" AS DATE) AS "end_date",
        CAST("entity_use_code" AS VARCHAR) AS "entity_use_code",
        CAST("invoice_message" AS VARCHAR) AS "invoice_message",
        CAST("ironclad_workflow" AS VARCHAR) AS "ironclad_workflow",
        CAST("is_active" AS VARCHAR) AS "is_active",
        CAST("is_hvr_legacy_order" AS VARCHAR) AS "is_hvr_legacy_order",
        CAST("last_modified_date" AS TIMESTAMP) AS "last_modified_date",
        CAST("last_modified_timestamp" AS TIMESTAMP) AS "last_modified_timestamp",
        CAST("last_referenced_date" AS VARCHAR) AS "last_referenced_date",
        CAST("last_viewed_date" AS VARCHAR) AS "last_viewed_date",
        CAST("netsuite_discount_total" AS VARCHAR) AS "netsuite_discount_total",
        CAST("netsuite_order_status" AS VARCHAR) AS "netsuite_order_status",
        CAST("netsuite_subtotal" AS VARCHAR) AS "netsuite_subtotal",
        CAST("netsuite_tax_total" AS VARCHAR) AS "netsuite_tax_total",
        CAST("netsuite_total" AS VARCHAR) AS "netsuite_total",
        CAST("opportunity_id" AS VARCHAR) AS "opportunity_id",
        CAST("order_number" AS VARCHAR) AS "order_number",
        CAST("order_spend_type_c" AS VARCHAR) AS "order_spend_type_c",
        CAST("original_order_id" AS VARCHAR) AS "original_order_id",
        CAST("price_calculation_message" AS VARCHAR) AS "price_calculation_message",
        CAST("purchase_order_number" AS VARCHAR) AS "purchase_order_number",
        CAST("purchase_summary" AS VARCHAR) AS "purchase_summary",
        CAST("renewal_term" AS VARCHAR) AS "renewal_term",
        CAST("renewal_uplift_rate" AS VARCHAR) AS "renewal_uplift_rate",
        CAST("sales_tax_amount" AS VARCHAR) AS "sales_tax_amount",
        CAST("ship_date" AS DATE) AS "ship_date",
        CAST("shipping_country_code" AS VARCHAR) AS "shipping_country_code",
        CAST("shipping_geocode_accuracy" AS VARCHAR) AS "shipping_geocode_accuracy",
        CAST("shipping_postal_code" AS VARCHAR) AS "shipping_postal_code",
        CAST("shipping_state_code" AS VARCHAR) AS "shipping_state_code"
    FROM "sf_order_data_removeWideColumns_projected_renamed_cleaned_null"
),

"sf_order_data_removeWideColumns_projected_renamed_cleaned_null_casted_missing_handled" AS (
    -- Handling missing values: There are 28 columns with unacceptable missing values
    -- billing_country_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- billing_postal_code has 20.0 percent missing. Strategy: 🔄 Unchanged
    -- billing_state has 20.0 percent missing. Strategy: 🔄 Unchanged
    -- billing_street has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- company_authorizer_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- contract_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- customer_authorizer_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- customer_spend_type_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- description has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- entity_use_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- ironclad_workflow has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_referenced_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_viewed_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- opportunity_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- order_spend_type_c has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- original_order_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- price_calculation_message has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- purchase_order_number has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- purchase_summary has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- renewal_term has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- renewal_uplift_rate has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- sales_tax_amount has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- ship_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- shipping_country_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- shipping_geocode_accuracy has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- shipping_latitude has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- shipping_longitude has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- shipping_state_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    SELECT
        "billing_postal_code",
        "billing_state",
        "is_prepaid_order",
        "account_id",
        "netsuite_id",
        "billing_country",
        "pricebook_id",
        "calculate_tax",
        "invoicing_type",
        "update_subscriptions_only",
        "billing_account_id",
        "shipping_state",
        "last_modifier_id",
        "tax_calculation_status",
        "order_status",
        "order_id",
        "shipping_country",
        "owner_id",
        "billing_city",
        "prepaid_billing_frequency",
        "is_test_mode",
        "invoice_batch_type",
        "billing_longitude",
        "payment_terms",
        "order_status_code",
        "order_total",
        "credit_summary",
        "shipping_street",
        "creator_id",
        "billing_latitude",
        "legal_entity_id",
        "netsuite_sync_status",
        "shipping_city",
        "netsuite_order_number",
        "bill_immediately",
        "is_contracted",
        "quote_id",
        "is_deleted",
        "has_rollover_spend_amendment",
        "price_calculation_status",
        "skip_netsuite_export",
        "netsuite_record_id",
        "contracting_method",
        "activator_id",
        "auto_activated_flag",
        "is_seller_importer_of_record",
        "billing_day_of_month",
        "is_reduction_order",
        "is_evergreen",
        "order_type",
        "activation_datetime",
        "amendment_type",
        "billing_geocode_accuracy",
        "billing_state_code",
        "created_date",
        "effective_date",
        "end_date",
        "invoice_message",
        "is_active",
        "is_hvr_legacy_order",
        "last_modified_date",
        "last_modified_timestamp",
        "netsuite_discount_total",
        "netsuite_order_status",
        "netsuite_subtotal",
        "netsuite_tax_total",
        "netsuite_total",
        "order_number",
        "shipping_postal_code"
    FROM "sf_order_data_removeWideColumns_projected_renamed_cleaned_null_casted"
)

-- COCOON BLOCK END
SELECT * FROM "sf_order_data_removeWideColumns_projected_renamed_cleaned_null_casted_missing_handled"

stg_sf_order_data.yml (Document the table)

version: 2
models:
- name: stg_sf_order_data
  description: The table is about customer orders. It contains details like order
    ID, account ID, billing information, shipping information, order status, and financial
    details. Each row represents a unique order with fields for dates, amounts, billing
    frequency, and various flags related to the order process and status.
  columns:
  - name: billing_postal_code
    description: Postal code for billing address
    tests:
    - not_null
  - name: billing_state
    description: State for billing address
    tests:
    - not_null
  - name: is_prepaid_order
    description: Indicates if the order is prepaid
    tests:
    - not_null
  - name: account_id
    description: Unique identifier for the customer account
    tests:
    - not_null
  - name: netsuite_id
    description: NetSuite ID for the order
    cocoon_meta:
      missing_acceptable: Not applicable for orders not yet synced with NetSuite.
  - name: billing_country
    description: Country for billing address
    tests:
    - not_null
  - name: pricebook_id
    description: ID of the pricebook used for the order
    tests:
    - not_null
  - name: calculate_tax
    description: Flag to calculate tax for the order
    tests:
    - not_null
  - name: invoicing_type
    description: Type of invoicing for the order
    tests:
    - not_null
    - accepted_values:
        values:
        - Other
        - Prepaid Credits
        - Standard Invoice
        - Credit Card
        - PayPal
        - Bank Transfer
        - Cash on Delivery
        - Net 30
        - Net 60
        - Net 90
        - Milestone Billing
        - Recurring Billing
        - Proforma Invoice
  - name: update_subscriptions_only
    description: Flag for updating only subscriptions
    tests:
    - not_null
  - name: billing_account_id
    description: Account associated with billing
    tests:
    - not_null
  - name: shipping_state
    description: State for shipping address
    tests:
    - not_null
    - accepted_values:
        values:
        - Alabama
        - Alaska
        - Arizona
        - Arkansas
        - California
        - Colorado
        - Connecticut
        - Delaware
        - Florida
        - Georgia
        - Hawaii
        - Idaho
        - Illinois
        - Indiana
        - Iowa
        - Kansas
        - Kentucky
        - Louisiana
        - Maine
        - Maryland
        - Massachusetts
        - Michigan
        - Minnesota
        - Mississippi
        - Missouri
        - Montana
        - Nebraska
        - Nevada
        - New Hampshire
        - New Jersey
        - New Mexico
        - New York
        - North Carolina
        - North Dakota
        - Ohio
        - Oklahoma
        - Oregon
        - Pennsylvania
        - Rhode Island
        - South Carolina
        - South Dakota
        - Tennessee
        - Texas
        - Utah
        - Vermont
        - Virginia
        - Washington
        - West Virginia
        - Wisconsin
        - Wyoming
  - name: last_modifier_id
    description: ID of user who last modified the record
    tests:
    - not_null
  - name: tax_calculation_status
    description: Message regarding tax calculation status
    tests:
    - not_null
    - accepted_values:
        values:
        - No Tax Required
        - Tax Amount Is Up To Date
        - Tax Calculation In Progress
        - Tax Calculation Error
        - Tax Amount Outdated
        - Awaiting Tax Information
        - Tax Exempt
        - Tax Calculation Pending Review
        - Tax Calculation Completed
        - Tax Recalculation Needed
  - name: order_status
    description: Current status of the order
    tests:
    - not_null
    - accepted_values:
        values:
        - Activated
        - Pending
        - Processing
        - Shipped
        - Delivered
        - Cancelled
        - Returned
        - On Hold
        - Refunded
        - Completed
  - name: order_id
    description: Unique identifier for the order
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column represents a unique identifier for the order. For this
        table, each row is a unique order. The order_id appears to be unique across
        all rows and is consistently populated.
  - name: shipping_country
    description: Country for shipping address
    tests:
    - not_null
  - name: owner_id
    description: Unique identifier of the order owner
    tests:
    - not_null
  - name: billing_city
    description: City for billing address
    tests:
    - not_null
  - name: prepaid_billing_frequency
    description: Frequency of prepaid billing
    tests:
    - accepted_values:
        values:
        - Annual
        - Monthly
        - Quarterly
        - Semi-Annual
        - Weekly
        - Bi-Weekly
        - Daily
    cocoon_meta:
      missing_acceptable: Not applicable for non-prepaid or one-time orders.
  - name: is_test_mode
    description: Flag for test mode record
    tests:
    - not_null
  - name: invoice_batch_type
    description: Batch type for invoice processing
    tests:
    - not_null
    - accepted_values:
        values:
        - Daily
        - Weekly
        - Monthly
        - Quarterly
        - Annually
        - Domestic (US)
        - International
        - Combined (Domestic + International)
        - Custom
  - name: billing_longitude
    description: Longitude of billing address
    cocoon_meta:
      missing_acceptable: Geographic coordinates not required or collected for billing.
  - name: payment_terms
    description: Payment terms for the order
    tests:
    - not_null
    - accepted_values:
        values:
        - Net 30
        - Net 60
        - Net 90
        - Due on Receipt
        - 2/10 Net 30
        - 1/10 Net 30
        - COD (Cash on Delivery)
        - CIA (Cash in Advance)
        - EOM (End of Month)
        - 15 MFI (15th Month Following Invoice)
        - 50% Advance, 50% on Delivery
        - Letter of Credit
        - Consignment
  - name: order_status_code
    description: Code representing the order status
    tests:
    - not_null
    - accepted_values:
        values:
        - Pending
        - Activated
        - Processing
        - Shipped
        - Delivered
        - Cancelled
        - Returned
        - On Hold
        - Backordered
        - Completed
        - Failed
        - Refunded
  - name: order_total
    description: Total monetary value of the order
    tests:
    - not_null
  - name: credit_summary
    description: Summary of credits for the order
    cocoon_meta:
      missing_acceptable: No credit summary exists for some accounts.
  - name: shipping_street
    description: Street address for shipping
    tests:
    - not_null
  - name: creator_id
    description: ID of user who created the record
    tests:
    - not_null
  - name: billing_latitude
    description: Latitude of billing address
    cocoon_meta:
      missing_acceptable: Geographic coordinates not required or collected for billing.
  - name: legal_entity_id
    description: Legal entity associated with the order
    tests:
    - not_null
  - name: netsuite_sync_status
    description: Indicates if order is synced to NetSuite
    tests:
    - not_null
  - name: shipping_city
    description: City for shipping address
    tests:
    - not_null
  - name: netsuite_order_number
    description: NetSuite order number
    cocoon_meta:
      missing_acceptable: Not applicable for orders not yet processed in NetSuite.
  - name: bill_immediately
    description: Flag to indicate immediate billing
    tests:
    - not_null
  - name: is_contracted
    description: Indicates if the order is contracted
    tests:
    - not_null
  - name: quote_id
    description: Quote ID associated with the order
    tests:
    - not_null
  - name: is_deleted
    description: Flag indicating if the record is deleted
    tests:
    - not_null
  - name: has_rollover_spend_amendment
    description: Flag for spend type amendment with rollover
    tests:
    - not_null
  - name: price_calculation_status
    description: Status of price calculation
    tests:
    - not_null
    - accepted_values:
        values:
        - Not Needed
        - Pending
        - In Progress
        - Completed
        - Failed
        - Cancelled
        - On Hold
  - name: skip_netsuite_export
    description: Flag to skip exporting to NetSuite
    tests:
    - not_null
  - name: netsuite_record_id
    description: NetSuite record identifier
    cocoon_meta:
      missing_acceptable: Not applicable for orders not yet synced with NetSuite.
  - name: contracting_method
    description: Method used for contracting
    tests:
    - not_null
    - accepted_values:
        values:
        - By Subscription End Date
        - Fixed Price
        - Time and Materials
        - Cost-Plus
        - Performance-Based
        - Indefinite Delivery/Indefinite Quantity (IDIQ)
        - Blanket Purchase Agreement (BPA)
        - Purchase Order
        - Letter Contract
        - Cooperative Agreement
        - Grant
        - Firm Fixed Price (FFP)
        - Cost-Plus-Fixed-Fee (CPFF)
        - Cost-Plus-Incentive-Fee (CPIF)
        - Cost-Plus-Award-Fee (CPAF)
        - Labor Hour
        - Retainer
  - name: activator_id
    description: ID of the user who activated the account
    tests:
    - not_null
  - name: auto_activated_flag
    description: Indicates if order was automatically activated
    tests:
    - not_null
  - name: is_seller_importer_of_record
    description: Indicates if seller is importer of record
    tests:
    - not_null
  - name: billing_day_of_month
    description: Day of month for billing
    tests:
    - not_null
  - name: is_reduction_order
    description: Flag indicating if it's a reduction order
    tests:
    - not_null
  - name: is_evergreen
    description: Flag for evergreen contract
    tests:
    - not_null
  - name: order_type
    description: Type or category of the order
    tests:
    - not_null
    - accepted_values:
        values:
        - New
        - Pending
        - Processing
        - Shipped
        - Delivered
        - Cancelled
        - Returned
        - On Hold
        - Backordered
        - Completed
  - name: activation_datetime
    description: Date and time when the account was activated
    tests:
    - not_null
  - name: amendment_type
    description: Type of amendment made to the order
    cocoon_meta:
      missing_acceptable: No amendments made to the account.
  - name: billing_geocode_accuracy
    description: Accuracy of billing address geocoding
    cocoon_meta:
      missing_acceptable: Geocoding not performed or necessary for this account.
  - name: billing_state_code
    description: State code for billing address
    cocoon_meta:
      missing_acceptable: Not used when full state name is provided.
  - name: created_date
    description: Date and time the record was created
    tests:
    - not_null
  - name: effective_date
    description: Date the order becomes effective
    tests:
    - not_null
  - name: end_date
    description: End date of the order
    cocoon_meta:
      missing_acceptable: Account or contract has no specified end date.
  - name: invoice_message
    description: Message related to invoice
    cocoon_meta:
      missing_acceptable: No custom invoice message set for this account.
  - name: is_active
    description: Indicates if the record is active in Fivetran
    cocoon_meta:
      missing_acceptable: Account status might be pending or in another state.
  - name: is_hvr_legacy_order
    description: Flag for HVR legacy order
    cocoon_meta:
      missing_acceptable: Account is not related to HVR legacy orders.
  - name: last_modified_date
    description: Date and time of last modification
    tests:
    - not_null
  - name: last_modified_timestamp
    description: Timestamp of last system modification to the order
    tests:
    - not_null
  - name: netsuite_discount_total
    description: Total discount in NetSuite
    cocoon_meta:
      missing_acceptable: Not applicable when there's no discount on the order.
  - name: netsuite_order_status
    description: Order status in NetSuite
    cocoon_meta:
      missing_acceptable: Not applicable for orders not yet processed in NetSuite.
  - name: netsuite_subtotal
    description: Subtotal amount in NetSuite
    cocoon_meta:
      missing_acceptable: Not applicable for orders not yet processed in NetSuite.
  - name: netsuite_tax_total
    description: Total tax amount in NetSuite
    cocoon_meta:
      missing_acceptable: Not applicable for orders not yet processed in NetSuite.
  - name: netsuite_total
    description: Total amount in NetSuite
    cocoon_meta:
      missing_acceptable: Not applicable for orders not yet processed in NetSuite.
  - name: order_number
    description: Unique identifier for the order
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column represents a unique identifier for the order. For this
        table, each row is a unique order. The order_number appears to be unique across
        all rows and is consistently populated.
  - name: shipping_postal_code
    description: Postal code for shipping address
    tests:
    - not_null

stg_sf_opportunity_history_data (first 100 rows)

forecast_category_id is_closed opportunity_category opportunity_type_id has_overdue_task opportunity_amount is_deleted is_won opportunity_id is_active account_id lead_source_id win_probability stage_name has_line_items owner_id forecast_category_name opportunity_name has_open_activity campaign_id close_date created_date fiscal_quarter fiscal_year validity_end_date validity_start_date
0 A/SkeDD5c3ejUyEFFoUHHg== True +Gkf6SQ2fhAONAiFelNKVw== 3QOHd+Q7F28PJtnwztV09Q== False 24120000.0 True True 006q000000HddohAAB True 9CcfAt8qtZvCTwFvwOFLcg== TDK+SgtPSM3Vk67zX9aeRA== 1000 GavUFuuf4DrnQAoiRGlWpQ== True rQhle3uwQbFgFmLTF1WByg== A/SkeDD5c3ejUyEFFoUHHg== $1m deal False None 2018-12-19 2018-12-19 19:51:13 4 2018 NaT 2019-10-17 21:10:19
1 A/SkeDD5c3ejUyEFFoUHHg== True +Gkf6SQ2fhAONAiFelNKVw== 3QOHd+Q7F28PJtnwztV09Q== False NaN True True 006q000000HdPzpAAF True wfQo3+JVfsNIdcz/mUkZkA== Fbu50LvyXo0peN4RaMdJ3A== 100 GavUFuuf4DrnQAoiRGlWpQ== False nqxS50kwRjtOYb9ZB4/PoQ== A/SkeDD5c3ejUyEFFoUHHg== Testing Opp Close False None 2018-12-18 2018-12-18 21:21:17 4 2018 NaT 2019-10-17 21:33:00
2 A/SkeDD5c3ejUyEFFoUHHg== True +Gkf6SQ2fhAONAiFelNKVw== 14mxIBMk0YX2Gz0r1Ktsuw== False NaN True True 006q000000Hbmd1AAB True wIXkC/s93lDAT+HVkwv6+A== TDK+SgtPSM3Vk67zX9aeRA== 100 GavUFuuf4DrnQAoiRGlWpQ== False dVDxbGz10nJ2mKU213GZRQ== A/SkeDD5c3ejUyEFFoUHHg== Test False None 2018-12-18 2018-12-10 17:03:22 4 2018 NaT 2019-04-04 18:36:08
3 A/SkeDD5c3ejUyEFFoUHHg== True +Gkf6SQ2fhAONAiFelNKVw== 14mxIBMk0YX2Gz0r1Ktsuw== False NaN True True 006q000000HcZXrAAN True 78HpxISq4/eSw+ycDPqSwA== pOz8cFdDlJkM8XvYPfSZ9w== 100 GavUFuuf4DrnQAoiRGlWpQ== False 9B1r0vK1wAVGaERpMleKGg== A/SkeDD5c3ejUyEFFoUHHg== lu test False None 2018-12-13 2018-12-13 18:02:55 4 2018 NaT 2019-04-04 18:36:08
4 A/SkeDD5c3ejUyEFFoUHHg== True dSJC2EuRkC62f+UuBPQeVg== 3QOHd+Q7F28PJtnwztV09Q== False NaN True True 006q000000HddueAAB True wfQo3+JVfsNIdcz/mUkZkA== dSJC2EuRkC62f+UuBPQeVg== 100 GavUFuuf4DrnQAoiRGlWpQ== False nqxS50kwRjtOYb9ZB4/PoQ== A/SkeDD5c3ejUyEFFoUHHg== Chewbaca False None 2018-12-07 2018-12-19 20:22:58 4 2018 NaT 2019-04-04 18:36:08
5 AloDHjNI+wntE4Eetriz+w== True +Gkf6SQ2fhAONAiFelNKVw== 14mxIBMk0YX2Gz0r1Ktsuw== False 200000.0 True False 006q000000HK8jdAAD True TK5MTSsiOYoDQoJiSbkugA== MfuqnemFQBY2RwqM7YBkKA== 0 tXi3M8u3iPxq0ggxTSxMKw== False QEaGoY7B8nGfro2vhOCMvA== AloDHjNI+wntE4Eetriz+w== Evergreen Test False None 2018-11-21 2018-11-14 19:12:53 4 2018 NaT 2019-04-04 18:36:08
6 AloDHjNI+wntE4Eetriz+w== True +Gkf6SQ2fhAONAiFelNKVw== 14mxIBMk0YX2Gz0r1Ktsuw== False NaN True False 006q000000HcZXXAA3 False 78HpxISq4/eSw+ycDPqSwA== UN2fttk8geFc7Db/xJzQ+A== 0 tXi3M8u3iPxq0ggxTSxMKw== False 9B1r0vK1wAVGaERpMleKGg== AloDHjNI+wntE4Eetriz+w== lu test False None 2018-12-13 2018-12-13 18:00:11 4 2018 2019-04-04 18:36:07 2019-04-03 18:36:06
7 AloDHjNI+wntE4Eetriz+w== True +Gkf6SQ2fhAONAiFelNKVw== 14mxIBMk0YX2Gz0r1Ktsuw== False 1.0 True False 006q000000GoP76AAF True tZX+Z0iWzZHHjNvRnCJzwg== None 0 tXi3M8u3iPxq0ggxTSxMKw== False TLZtnkcZltX8lijWYSQqRg== AloDHjNI+wntE4Eetriz+w== Blue Test False None 2018-10-31 2018-10-31 17:43:42 4 2018 NaT 2019-04-04 18:36:08
8 AloDHjNI+wntE4Eetriz+w== True 9Q0PuStPWLYgxG/8kpvo5g== 14mxIBMk0YX2Gz0r1Ktsuw== False NaN True False 006q000000HcZXcAAN True 78HpxISq4/eSw+ycDPqSwA== pOz8cFdDlJkM8XvYPfSZ9w== 0 tXi3M8u3iPxq0ggxTSxMKw== False AwxR76rxgr77EfSnTHH57Q== AloDHjNI+wntE4Eetriz+w== lu test False None 2018-12-13 2018-12-13 18:01:22 4 2018 NaT 2019-04-04 18:36:08
9 rq6uxRtOa4gSLxCtlqjecg== False +Gkf6SQ2fhAONAiFelNKVw== 3QOHd+Q7F28PJtnwztV09Q== False 210000.0 True False 006q000000HdOhuAAF False wIXkC/s93lDAT+HVkwv6+A== Fbu50LvyXo0peN4RaMdJ3A== 65 9RN9J3tlxr89gDctReax5w== True dVDxbGz10nJ2mKU213GZRQ== rq6uxRtOa4gSLxCtlqjecg== Testing Order from Process False None 2018-12-19 2018-12-18 17:56:05 4 2018 2019-04-04 18:36:07 2019-04-03 18:36:06

stg_sf_opportunity_history_data.sql (clean the table)

-- COCOON BLOCK START: PLEASE DO NOT MODIFY THIS BLOCK FOR SELF-MAINTENANCE
WITH 
"sf_opportunity_history_data_projected" AS (
    -- Projection: Selecting 34 out of 35 columns
    -- Columns projected out: ['_fivetran_synced']
    SELECT 
        "_fivetran_active",
        "_fivetran_start",
        "_fivetran_end",
        "account_id",
        "amount",
        "campaign_id",
        "close_date",
        "created_date",
        "description",
        "expected_revenue",
        "fiscal",
        "fiscal_quarter",
        "fiscal_year",
        "forecast_category",
        "forecast_category_name",
        "has_open_activity",
        "has_opportunity_line_item",
        "has_overdue_task",
        "id",
        "is_closed",
        "is_deleted",
        "is_won",
        "last_activity_date",
        "last_referenced_date",
        "last_viewed_date",
        "lead_source",
        "name",
        "next_step",
        "owner_id",
        "probability",
        "record_type_id",
        "stage_name",
        "synced_quote_id",
        "type"
    FROM "sf_opportunity_history_data"
),

"sf_opportunity_history_data_projected_renamed" AS (
    -- Rename: Renaming columns
    -- _fivetran_active -> is_active
    -- _fivetran_start -> validity_start_date
    -- _fivetran_end -> validity_end_date
    -- amount -> opportunity_amount
    -- fiscal -> fiscal_period
    -- forecast_category -> forecast_category_id
    -- has_opportunity_line_item -> has_line_items
    -- id -> opportunity_id
    -- lead_source -> lead_source_id
    -- name -> opportunity_name
    -- probability -> win_probability
    -- record_type_id -> opportunity_type_id
    -- type -> opportunity_category
    SELECT 
        "_fivetran_active" AS "is_active",
        "_fivetran_start" AS "validity_start_date",
        "_fivetran_end" AS "validity_end_date",
        "account_id",
        "amount" AS "opportunity_amount",
        "campaign_id",
        "close_date",
        "created_date",
        "description",
        "expected_revenue",
        "fiscal" AS "fiscal_period",
        "fiscal_quarter",
        "fiscal_year",
        "forecast_category" AS "forecast_category_id",
        "forecast_category_name",
        "has_open_activity",
        "has_opportunity_line_item" AS "has_line_items",
        "has_overdue_task",
        "id" AS "opportunity_id",
        "is_closed",
        "is_deleted",
        "is_won",
        "last_activity_date",
        "last_referenced_date",
        "last_viewed_date",
        "lead_source" AS "lead_source_id",
        "name" AS "opportunity_name",
        "next_step",
        "owner_id",
        "probability" AS "win_probability",
        "record_type_id" AS "opportunity_type_id",
        "stage_name",
        "synced_quote_id",
        "type" AS "opportunity_category"
    FROM "sf_opportunity_history_data_projected"
),

"sf_opportunity_history_data_projected_renamed_cleaned" AS (
    -- Clean unusual string values: 
    -- fiscal_period: The problem is that the fiscal_period column contains an encoded value 'JxJ3Au0JjyhOOUE/UvIeOw==' which is not a standard fiscal period format. This appears to be a Base64 encoded string, possibly used for data obfuscation or compression. Without knowing the decoding method or the original intended value, it's impossible to determine the correct fiscal period. The correct values for fiscal periods are typically in formats like 'Q1 2023', 'FY2023', or specific date ranges. 
    -- opportunity_name: The problem is that 'Blue Test -' has a trailing dash which should be removed.  'lu test 1', 'lu test 2', 'lu test 3' are redundant entries that should be consolidated.  The other values seem to be legitimate opportunity names and don't require changes.  The correct values should remove the trailing dash from 'Blue Test -' and consolidate the 'lu test' entries into a single value. 
    SELECT
        "is_active",
        "validity_start_date",
        "validity_end_date",
        "account_id",
        "opportunity_amount",
        "campaign_id",
        "close_date",
        "created_date",
        "description",
        "expected_revenue",
        CASE
            WHEN "fiscal_period" = 'JxJ3Au0JjyhOOUE/UvIeOw==' THEN ''
            ELSE "fiscal_period"
        END AS "fiscal_period",
        "fiscal_quarter",
        "fiscal_year",
        "forecast_category_id",
        "forecast_category_name",
        "has_open_activity",
        "has_line_items",
        "has_overdue_task",
        "opportunity_id",
        "is_closed",
        "is_deleted",
        "is_won",
        "last_activity_date",
        "last_referenced_date",
        "last_viewed_date",
        "lead_source_id",
        CASE
            WHEN "opportunity_name" = 'Blue Test -' THEN 'Blue Test'
            WHEN "opportunity_name" = 'lu test 1' THEN 'lu test'
            WHEN "opportunity_name" = 'lu test 2' THEN 'lu test'
            WHEN "opportunity_name" = 'lu test 3' THEN 'lu test'
            ELSE "opportunity_name"
        END AS "opportunity_name",
        "next_step",
        "owner_id",
        "win_probability",
        "opportunity_type_id",
        "stage_name",
        "synced_quote_id",
        "opportunity_category"
    FROM "sf_opportunity_history_data_projected_renamed"
),

"sf_opportunity_history_data_projected_renamed_cleaned_null" AS (
    -- NULL Imputation: Impute Null to Disguised Missing Values
    -- validity_end_date: ['9999-12-31 23:59:59']
    -- fiscal_period: ['']
    SELECT 
        CASE
            WHEN "validity_end_date" = '9999-12-31 23:59:59' THEN NULL
            ELSE "validity_end_date"
        END AS "validity_end_date",
        CASE
            WHEN "fiscal_period" = '' THEN NULL
            ELSE "fiscal_period"
        END AS "fiscal_period",
        "forecast_category_id",
        "is_closed",
        "last_referenced_date",
        "opportunity_category",
        "next_step",
        "opportunity_type_id",
        "fiscal_quarter",
        "last_viewed_date",
        "validity_start_date",
        "has_overdue_task",
        "opportunity_amount",
        "is_deleted",
        "is_won",
        "last_activity_date",
        "expected_revenue",
        "description",
        "fiscal_year",
        "opportunity_id",
        "is_active",
        "account_id",
        "lead_source_id",
        "win_probability",
        "stage_name",
        "has_line_items",
        "owner_id",
        "close_date",
        "synced_quote_id",
        "created_date",
        "campaign_id",
        "forecast_category_name",
        "opportunity_name",
        "has_open_activity"
    FROM "sf_opportunity_history_data_projected_renamed_cleaned"
),

"sf_opportunity_history_data_projected_renamed_cleaned_null_casted" AS (
    -- Column Type Casting: 
    -- campaign_id: from DECIMAL to VARCHAR
    -- close_date: from VARCHAR to DATE
    -- created_date: from VARCHAR to TIMESTAMP
    -- description: from DECIMAL to VARCHAR
    -- expected_revenue: from DECIMAL to VARCHAR
    -- fiscal_quarter: from INT to VARCHAR
    -- fiscal_year: from INT to VARCHAR
    -- last_activity_date: from DECIMAL to VARCHAR
    -- last_referenced_date: from DECIMAL to VARCHAR
    -- last_viewed_date: from DECIMAL to VARCHAR
    -- next_step: from DECIMAL to VARCHAR
    -- synced_quote_id: from DECIMAL to VARCHAR
    -- validity_end_date: from VARCHAR to TIMESTAMP
    -- validity_start_date: from VARCHAR to TIMESTAMP
    SELECT
        "fiscal_period",
        "forecast_category_id",
        "is_closed",
        "opportunity_category",
        "opportunity_type_id",
        "has_overdue_task",
        "opportunity_amount",
        "is_deleted",
        "is_won",
        "opportunity_id",
        "is_active",
        "account_id",
        "lead_source_id",
        "win_probability",
        "stage_name",
        "has_line_items",
        "owner_id",
        "forecast_category_name",
        "opportunity_name",
        "has_open_activity",
        CAST("campaign_id" AS VARCHAR) AS "campaign_id",
        CAST("close_date" AS DATE) AS "close_date",
        CAST("created_date" AS TIMESTAMP) AS "created_date",
        CAST("description" AS VARCHAR) AS "description",
        CAST("expected_revenue" AS VARCHAR) AS "expected_revenue",
        CAST("fiscal_quarter" AS VARCHAR) AS "fiscal_quarter",
        CAST("fiscal_year" AS VARCHAR) AS "fiscal_year",
        CAST("last_activity_date" AS VARCHAR) AS "last_activity_date",
        CAST("last_referenced_date" AS VARCHAR) AS "last_referenced_date",
        CAST("last_viewed_date" AS VARCHAR) AS "last_viewed_date",
        CAST("next_step" AS VARCHAR) AS "next_step",
        CAST("synced_quote_id" AS VARCHAR) AS "synced_quote_id",
        CAST("validity_end_date" AS TIMESTAMP) AS "validity_end_date",
        CAST("validity_start_date" AS TIMESTAMP) AS "validity_start_date"
    FROM "sf_opportunity_history_data_projected_renamed_cleaned_null"
),

"sf_opportunity_history_data_projected_renamed_cleaned_null_casted_missing_handled" AS (
    -- Handling missing values: There are 11 columns with unacceptable missing values
    -- description has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- expected_revenue has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- fiscal_period has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_activity_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_referenced_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_viewed_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- lead_source_id has 10.0 percent missing. Strategy: 🔄 Unchanged
    -- next_step has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- opportunity_amount has 60.0 percent missing. Strategy: 🔄 Unchanged
    -- synced_quote_id has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- validity_end_date has 80.0 percent missing. Strategy: 🔄 Unchanged
    SELECT
        "forecast_category_id",
        "is_closed",
        "opportunity_category",
        "opportunity_type_id",
        "has_overdue_task",
        "opportunity_amount",
        "is_deleted",
        "is_won",
        "opportunity_id",
        "is_active",
        "account_id",
        "lead_source_id",
        "win_probability",
        "stage_name",
        "has_line_items",
        "owner_id",
        "forecast_category_name",
        "opportunity_name",
        "has_open_activity",
        "campaign_id",
        "close_date",
        "created_date",
        "fiscal_quarter",
        "fiscal_year",
        "validity_end_date",
        "validity_start_date"
    FROM "sf_opportunity_history_data_projected_renamed_cleaned_null_casted"
)

-- COCOON BLOCK END
SELECT * FROM "sf_opportunity_history_data_projected_renamed_cleaned_null_casted_missing_handled"

stg_sf_opportunity_history_data.yml (Document the table)

version: 2
models:
- name: stg_sf_opportunity_history_data
  description: The table is about sales opportunity history. It contains details like
    opportunity ID, account ID, amount, close date, creation date, forecast category,
    probability, stage name, and owner ID. The data tracks various attributes of sales
    opportunities including whether they were won or lost, deleted, and had associated
    activities. It also includes fiscal period information and opportunity type.
  columns:
  - name: forecast_category_id
    description: Category for forecasting purposes
    tests:
    - not_null
  - name: is_closed
    description: Indicates if the opportunity is closed
    tests:
    - not_null
  - name: opportunity_category
    description: Classification or category of the opportunity
    tests:
    - not_null
  - name: opportunity_type_id
    description: Identifier for the type of sales opportunity record
    tests:
    - not_null
  - name: has_overdue_task
    description: Indicates if there's an overdue task
    tests:
    - not_null
  - name: opportunity_amount
    description: Monetary value of the opportunity
    tests:
    - not_null
  - name: is_deleted
    description: Indicates if the opportunity is deleted
    tests:
    - not_null
  - name: is_won
    description: Indicates if the opportunity was won
    tests:
    - not_null
  - name: opportunity_id
    description: Unique identifier for the opportunity
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column represents a unique identifier for each opportunity.
        For this table, each row is for a specific sales opportunity. The opportunity_id
        appears to be unique across rows, as it follows a consistent format (e.g.,
        '006q000000HddohAAB') and is typically used as a primary key in database systems.
  - name: is_active
    description: Indicates if the record is currently active
    tests:
    - not_null
  - name: account_id
    description: Unique identifier for the associated account
    tests:
    - not_null
  - name: lead_source_id
    description: Source of the lead for this opportunity
    tests:
    - not_null
  - name: win_probability
    description: Likelihood of winning the opportunity
    tests:
    - not_null
  - name: stage_name
    description: Current stage of the sales opportunity
    tests:
    - not_null
    - accepted_values:
        values:
        - Lead
        - Prospect
        - Qualification
        - Needs Analysis
        - Proposal
        - Negotiation
        - Closed Won
        - Closed Lost
        - GavUFuuf4DrnQAoiRGlWpQ==
        - tXi3M8u3iPxq0ggxTSxMKw==
        - 9RN9J3tlxr89gDctReax5w==
  - name: has_line_items
    description: Indicates if line items are present
    tests:
    - not_null
  - name: owner_id
    description: Identifier of the opportunity owner
    tests:
    - not_null
  - name: forecast_category_name
    description: Name of the forecast category
    tests:
    - not_null
  - name: opportunity_name
    description: Name or title of the opportunity
    tests:
    - not_null
  - name: has_open_activity
    description: Indicates if there's an open activity
    tests:
    - not_null
  - name: campaign_id
    description: Identifier for associated marketing campaign
    cocoon_meta:
      missing_acceptable: Not all opportunities are associated with marketing campaigns.
  - name: close_date
    description: Date when the opportunity was closed
    tests:
    - not_null
  - name: created_date
    description: Date when the opportunity was created
    tests:
    - not_null
  - name: fiscal_quarter
    description: Fiscal quarter of the opportunity
    tests:
    - not_null
    - accepted_values:
        values:
        - '1'
        - '2'
        - '3'
        - '4'
  - name: fiscal_year
    description: Fiscal year of the opportunity
    tests:
    - not_null
    - accepted_values:
        values:
        - '2015'
        - '2016'
        - '2017'
        - '2018'
        - '2019'
        - '2020'
        - '2021'
        - '2022'
        - '2023'
        - '2024'
  - name: validity_end_date
    description: End date of the record's validity
    tests:
    - not_null
  - name: validity_start_date
    description: Start date of the record's validity
    tests:
    - not_null

stg_sf_opportunity_line_item_data (first 100 rows)

subscription_type sbqq_parent_id pricebook_entry_id is_deleted product_code total_price duration_months opportunity_id sbqq_quote_line product_family product_name line_item_id quantity hvr_use_case last_modifier_id product_id unit_price creator_id creation_datetime last_modified_datetime last_modified_timestamp list_price
0 None None 01u1G000002Ks75QAC False a 0.00 12 0061G00000Ja7B6QAJ a4R1G000000S2a6UAC Usage plan a 00k1G00000A3iyqQAB 1 False 0051G000005MumpQAC 01 1G000000bUE8QAM 0.00 0051G0000060rqhQAA 2019-11-11 17:23:34 2019-11-11 17:23:34 2019-11-11 17:23:34 0.0
1 None None 01u1G000002Kbu5QAC NaN b 5100.00 12 0061G00000HhviAQAR a4R1G000000XqhrUAC None plan b 00k1G000009ar5IQAQ 6 NaN 0051G000005MumuQAC 01 1G000000bH0WQAU 850.00 0051G000005MumuQAC 2019-11-11 17:23:34 2019-11-11 17:23:34 2019-11-11 17:23:34 1000.0
2 Renewable None 01u1G000002KbuAQAS NaN d 38093.00 12 0061G00000HhviAQAR a4R1G000000XsCJUA0 None plan k 00k1G000009a jwQAA 50 NaN 0051G000005MumuQAC 01 1G000000bH0bQAE 761.86 0051G000005MumuQAC 2019-11-11 17:23:34 2019-11-11 17:23:34 2019-11-11 17:23:34 1500.0
3 Renewable None 01u1G000002KbuAQAS NaN e 84250.32 12 0061G00000HhviAQAR a4R1G000000XqhsUAC None plan i 00k1G000009ar5JQAQ 66 NaN 0051G000005MumuQAC 01 1G000000bH0bQAE 1276.52 0051G000005MumuQAC 2019-11-11 17:23:34 2019-11-11 17:23:34 2019-11-11 17:23:34 1500.0
4 Renewable None 01u1G000002KbuwQAC NaN f 4000.00 12 0061G00000HhviAQAR a4R1G000000XqhoUAC None plan j 00k1G000009ar5GQAQ 4 NaN 0051G000005MumuQAC 01 1G000000bH1NQAU 1000.00 0051G000005MumuQAC 2019-11-11 17:23:34 2019-11-11 17:23:34 2019-11-11 17:23:34 1000.0
5 Renewable None 01u1G000002KbvfQAC NaN p 162000.00 12 0061G00000HhviAQAR a4R1G000000XqhqUAC None plan d 00k1G000009ar5HQAQ 18 NaN 0051G000005MumuQAC 01 1G000000bH05QAE 9000.00 0051G000005MumuQAC 2019-11-11 17:23:34 2019-11-11 17:23:34 2019-11-11 17:23:34 12000.0
6 Renewable None 01u1G000002KcPQAS NaN l 0.00 12 0061G00000Is1QAJ a4R1G000000XrkUAK None plan e 00k1G000009al6CQAQ 1 NaN 0051G000005MumuQAC 01 1G000000bH pQAE 0.00 0051G000005MumuQAC 2019-11-11 17:23:34 2019-11-11 17:23:34 2019-11-11 17:23:34 0.0
7 Renewable None 01u1G000002KcPQAS NaN m 0.00 12 0061G00000HhviAQAR a4R1G000000XqhmUAC None plan f 00k1G000009aYhMQAU 1 NaN 0051G000005MumuQAC 01 1G000000bH pQAE 0.00 0051G000005MumuQAC 2019-11-11 17:23:34 2019-11-11 17:23:34 2019-11-11 17:23:34 0.0
8 Renewable None 01u1G000002KcPQAS NaN n 0.00 12 0061G00000IsgqwQAB a4R1G000000XsYWUA0 None plan g 00k1G000009auVBQAY 1 NaN 0051G000005MumuQAC 01 1G000000bH pQAE 0.00 0051G000005MumuQAC 2019-11-11 17:23:34 2019-11-11 17:23:34 2019-11-11 17:23:34 0.0
9 Renewable 00k1G000009b6cAQAQ 01u1G000002KcqQAC NaN s 2045.45 12 0061G00000IL0vQAF a4R1G000000XxmUAC None plan h 00k1G000009b6cCQAQ 1 NaN 0051G000005MumuQAC 01 1G000000bH0yQAE 2045.45 0051G000005MumuQAC 2019-11-11 17:23:34 2019-11-11 17:23:34 2019-11-11 17:23:34 2000.0

stg_sf_opportunity_line_item_data.sql (clean the table)

-- COCOON BLOCK START: PLEASE DO NOT MODIFY THIS BLOCK FOR SELF-MAINTENANCE
WITH 
"sf_opportunity_line_item_data_removeWideColumns" AS (
    -- Remove wide columns with pattern. The regex and columns are:
    -- ^celigo_sfnsio_.*_c$: celigo_sfnsio_contract_item_id_c, celigo_sfnsio_contract_term_c, celigo_sfnsio_end_date_c, celigo_sfnsio_list_rate_c, celigo_sfnsio_net_suite_line_id_c, celigo_sfnsio_start_date_c
    -- ^netsuite_conn_.*_c$: netsuite_conn_discount_item_c, netsuite_conn_end_date_c, netsuite_conn_from_contract_item_id_c, netsuite_conn_item_category_c, netsuite_conn_list_rate_c, netsuite_conn_net_suite_item_id_import_c, netsuite_conn_net_suite_item_key_id_c, netsuite_conn_pushed_from_net_suite_c, netsuite_conn_start_date_c, netsuite_conn_term_contract_pricing_type_c ...
    -- ^one_saas_app_.*_c$: one_saas_app_included_c, one_saas_app_quantity_invoiced_c, one_saas_app_quantity_not_invoiced_c
    SELECT 
        "_fivetran_active",
        "_fivetran_synced",
        "created_by_id",
        "created_date",
        "description",
        "discount",
        "event_volume_c",
        "has_quantity_schedule",
        "has_revenue_schedule",
        "has_schedule",
        "hvr_use_case_c",
        "id",
        "is_deleted",
        "last_modified_by_id",
        "last_modified_date",
        "last_referenced_date",
        "last_viewed_date",
        "list_price",
        "months_c",
        "name",
        "opportunity_id",
        "pricebook_entry_id",
        "product_2_id",
        "product_code",
        "product_code_stamped_c",
        "product_family_c",
        "quantity",
        "roadmap_connections_c",
        "row_volume_c",
        "sbqq_parent_id_c",
        "sbqq_quote_line_c",
        "sbqq_subscription_type_c",
        "service_date",
        "sort_order",
        "system_modstamp",
        "total_price",
        "unit_price"
    FROM "sf_opportunity_line_item_data"
),

"sf_opportunity_line_item_data_removeWideColumns_projected" AS (
    -- Projection: Selecting 36 out of 37 columns
    -- Columns projected out: ['_fivetran_synced']
    SELECT 
        "_fivetran_active",
        "created_by_id",
        "created_date",
        "description",
        "discount",
        "event_volume_c",
        "has_quantity_schedule",
        "has_revenue_schedule",
        "has_schedule",
        "hvr_use_case_c",
        "id",
        "is_deleted",
        "last_modified_by_id",
        "last_modified_date",
        "last_referenced_date",
        "last_viewed_date",
        "list_price",
        "months_c",
        "name",
        "opportunity_id",
        "pricebook_entry_id",
        "product_2_id",
        "product_code",
        "product_code_stamped_c",
        "product_family_c",
        "quantity",
        "roadmap_connections_c",
        "row_volume_c",
        "sbqq_parent_id_c",
        "sbqq_quote_line_c",
        "sbqq_subscription_type_c",
        "service_date",
        "sort_order",
        "system_modstamp",
        "total_price",
        "unit_price"
    FROM "sf_opportunity_line_item_data_removeWideColumns"
),

"sf_opportunity_line_item_data_removeWideColumns_projected_renamed" AS (
    -- Rename: Renaming columns
    -- _fivetran_active -> is_active
    -- created_by_id -> creator_id
    -- created_date -> creation_datetime
    -- description -> item_description
    -- discount -> discount_amount
    -- event_volume_c -> event_volume
    -- hvr_use_case_c -> hvr_use_case
    -- id -> line_item_id
    -- last_modified_by_id -> last_modifier_id
    -- last_modified_date -> last_modified_datetime
    -- months_c -> duration_months
    -- name -> product_name
    -- product_2_id -> product_id
    -- product_code_stamped_c -> stamped_product_code
    -- product_family_c -> product_family
    -- roadmap_connections_c -> roadmap_connections
    -- row_volume_c -> row_volume
    -- sbqq_parent_id_c -> sbqq_parent_id
    -- sbqq_quote_line_c -> sbqq_quote_line
    -- sbqq_subscription_type_c -> subscription_type
    -- system_modstamp -> last_modified_timestamp
    SELECT 
        "_fivetran_active" AS "is_active",
        "created_by_id" AS "creator_id",
        "created_date" AS "creation_datetime",
        "description" AS "item_description",
        "discount" AS "discount_amount",
        "event_volume_c" AS "event_volume",
        "has_quantity_schedule",
        "has_revenue_schedule",
        "has_schedule",
        "hvr_use_case_c" AS "hvr_use_case",
        "id" AS "line_item_id",
        "is_deleted",
        "last_modified_by_id" AS "last_modifier_id",
        "last_modified_date" AS "last_modified_datetime",
        "last_referenced_date",
        "last_viewed_date",
        "list_price",
        "months_c" AS "duration_months",
        "name" AS "product_name",
        "opportunity_id",
        "pricebook_entry_id",
        "product_2_id" AS "product_id",
        "product_code",
        "product_code_stamped_c" AS "stamped_product_code",
        "product_family_c" AS "product_family",
        "quantity",
        "roadmap_connections_c" AS "roadmap_connections",
        "row_volume_c" AS "row_volume",
        "sbqq_parent_id_c" AS "sbqq_parent_id",
        "sbqq_quote_line_c" AS "sbqq_quote_line",
        "sbqq_subscription_type_c" AS "subscription_type",
        "service_date",
        "sort_order",
        "system_modstamp" AS "last_modified_timestamp",
        "total_price",
        "unit_price"
    FROM "sf_opportunity_line_item_data_removeWideColumns_projected"
),

"sf_opportunity_line_item_data_removeWideColumns_projected_renamed_cleaned" AS (
    -- Clean unusual string values: 
    -- product_name: The problem is twofold: 1) There are typos in 'sof  serve' and 'sof  ware', which should be 'soft serve' and 'software' respectively. 2) The naming convention is inconsistent, with most plans using lowercase letters (a, b, d, e, f, g, h) but 'self serve' and the misspelled versions using full words. To maintain consistency, we should keep the most frequent format, which is the lowercase letter plans. 'self serve', 'soft serve', and 'software' don't fit this pattern, so they should be assigned new, consistent names. 
    -- opportunity_id: The problem is that two values ('0061G00000I L0vQAF' and '0061G00000Is1  QAJ') contain unexpected spaces, which are likely typos or data entry errors. The correct values should follow the pattern of the other valid entries, which is a string of 18 characters without spaces. The most frequent and correct pattern is '0061G00000HhviAQAR'. 
    -- pricebook_entry_id: The problem is that two of the values ('01u1G000002Kc PQAS' and '01u1G000002Kc qQAC') contain spaces, which is unusual for ID fields. The correct values should follow the pattern of the other IDs, which is a 15-character string without spaces. The most likely explanation is that these are typos, where a space was accidentally inserted. The correct values should be '01u1G000002KcPQAS' and '01u1G000002KcqQAC' respectively, removing the space. 
    -- sbqq_quote_line: The problem is that two values contain spaces ('a4R1G000000X xmUAC' and 'a4R1G000000Xr kUAK'), which is inconsistent with the pattern of the other IDs. The correct values should not contain spaces. The most likely explanation is that these are typos, and the spaces should be removed to match the pattern of the other IDs. 
    -- subscription_type: The problem is that 'X' is an unclear and non-descriptive value for a subscription type. It doesn't provide any meaningful information about the subscription. The correct values should be descriptive of the subscription type. In this case, 'Renewable' is a clear and descriptive value, while 'X' is not. 
    SELECT
        "is_active",
        "creator_id",
        "creation_datetime",
        "item_description",
        "discount_amount",
        "event_volume",
        "has_quantity_schedule",
        "has_revenue_schedule",
        "has_schedule",
        "hvr_use_case",
        "line_item_id",
        "is_deleted",
        "last_modifier_id",
        "last_modified_datetime",
        "last_referenced_date",
        "last_viewed_date",
        "list_price",
        "duration_months",
        CASE
            WHEN "product_name" = 'sof  serve' THEN 'plan i'
            WHEN "product_name" = 'sof  ware' THEN 'plan j'
            WHEN "product_name" = 'self serve' THEN 'plan k'
            ELSE "product_name"
        END AS "product_name",
        CASE
            WHEN "opportunity_id" = '0061G00000I L0vQAF' THEN '0061G00000IL0vQAF'
            WHEN "opportunity_id" = '0061G00000Is1  QAJ' THEN '0061G00000Is1QAJ'
            ELSE "opportunity_id"
        END AS "opportunity_id",
        CASE
            WHEN "pricebook_entry_id" = '01u1G000002Kc PQAS' THEN '01u1G000002KcPQAS'
            WHEN "pricebook_entry_id" = '01u1G000002Kc qQAC' THEN '01u1G000002KcqQAC'
            ELSE "pricebook_entry_id"
        END AS "pricebook_entry_id",
        "product_id",
        "product_code",
        "stamped_product_code",
        "product_family",
        "quantity",
        "roadmap_connections",
        "row_volume",
        "sbqq_parent_id",
        CASE
            WHEN "sbqq_quote_line" = 'a4R1G000000X xmUAC' THEN 'a4R1G000000XxmUAC'
            WHEN "sbqq_quote_line" = 'a4R1G000000Xr kUAK' THEN 'a4R1G000000XrkUAK'
            ELSE "sbqq_quote_line"
        END AS "sbqq_quote_line",
        CASE
            WHEN "subscription_type" = 'X' THEN ''
            ELSE "subscription_type"
        END AS "subscription_type",
        "service_date",
        "sort_order",
        "last_modified_timestamp",
        "total_price",
        "unit_price"
    FROM "sf_opportunity_line_item_data_removeWideColumns_projected_renamed"
),

"sf_opportunity_line_item_data_removeWideColumns_projected_renamed_cleaned_null" AS (
    -- NULL Imputation: Impute Null to Disguised Missing Values
    -- subscription_type: ['']
    SELECT 
        CASE
            WHEN "subscription_type" = '' THEN NULL
            ELSE "subscription_type"
        END AS "subscription_type",
        "last_referenced_date",
        "sbqq_parent_id",
        "service_date",
        "pricebook_entry_id",
        "row_volume",
        "event_volume",
        "last_viewed_date",
        "list_price",
        "is_deleted",
        "has_quantity_schedule",
        "product_code",
        "total_price",
        "last_modified_timestamp",
        "duration_months",
        "opportunity_id",
        "is_active",
        "sbqq_quote_line",
        "creation_datetime",
        "item_description",
        "roadmap_connections",
        "product_family",
        "product_name",
        "line_item_id",
        "quantity",
        "sort_order",
        "hvr_use_case",
        "stamped_product_code",
        "last_modifier_id",
        "has_schedule",
        "product_id",
        "has_revenue_schedule",
        "unit_price",
        "last_modified_datetime",
        "creator_id",
        "discount_amount"
    FROM "sf_opportunity_line_item_data_removeWideColumns_projected_renamed_cleaned"
),

"sf_opportunity_line_item_data_removeWideColumns_projected_renamed_cleaned_null_casted" AS (
    -- Column Type Casting: 
    -- creation_datetime: from VARCHAR to TIMESTAMP
    -- event_volume: from DECIMAL to VARCHAR
    -- has_quantity_schedule: from DECIMAL to BOOLEAN
    -- has_revenue_schedule: from DECIMAL to BOOLEAN
    -- has_schedule: from DECIMAL to BOOLEAN
    -- is_active: from DECIMAL to BOOLEAN
    -- item_description: from DECIMAL to VARCHAR
    -- last_modified_datetime: from VARCHAR to TIMESTAMP
    -- last_modified_timestamp: from VARCHAR to TIMESTAMP
    -- last_referenced_date: from DECIMAL to DATE
    -- last_viewed_date: from DECIMAL to DATE
    -- list_price: from INT to DECIMAL
    -- roadmap_connections: from DECIMAL to VARCHAR
    -- row_volume: from DECIMAL to VARCHAR
    -- service_date: from DECIMAL to DATE
    -- sort_order: from DECIMAL to INT
    -- stamped_product_code: from DECIMAL to VARCHAR
    SELECT
        "subscription_type",
        "sbqq_parent_id",
        "pricebook_entry_id",
        "is_deleted",
        "product_code",
        "total_price",
        "duration_months",
        "opportunity_id",
        "sbqq_quote_line",
        "product_family",
        "product_name",
        "line_item_id",
        "quantity",
        "hvr_use_case",
        "last_modifier_id",
        "product_id",
        "unit_price",
        "creator_id",
        "discount_amount",
        CAST("creation_datetime" AS TIMESTAMP) AS "creation_datetime",
        CAST("event_volume" AS VARCHAR) AS "event_volume",
        CAST("has_quantity_schedule" AS BOOLEAN) AS "has_quantity_schedule",
        CAST("has_revenue_schedule" AS BOOLEAN) AS "has_revenue_schedule",
        CAST("has_schedule" AS BOOLEAN) AS "has_schedule",
        CAST("is_active" AS BOOLEAN) AS "is_active",
        CAST("item_description" AS VARCHAR) AS "item_description",
        CAST("last_modified_datetime" AS TIMESTAMP) AS "last_modified_datetime",
        CAST("last_modified_timestamp" AS TIMESTAMP) AS "last_modified_timestamp",
        CAST("last_referenced_date" AS DATE) AS "last_referenced_date",
        CAST("last_viewed_date" AS DATE) AS "last_viewed_date",
        CAST("list_price" AS DECIMAL) AS "list_price",
        CAST("roadmap_connections" AS VARCHAR) AS "roadmap_connections",
        CAST("row_volume" AS VARCHAR) AS "row_volume",
        CAST("service_date" AS DATE) AS "service_date",
        CAST("sort_order" AS INT) AS "sort_order",
        CAST("stamped_product_code" AS VARCHAR) AS "stamped_product_code"
    FROM "sf_opportunity_line_item_data_removeWideColumns_projected_renamed_cleaned_null"
),

"sf_opportunity_line_item_data_removeWideColumns_projected_renamed_cleaned_null_casted_missing_handled" AS (
    -- Handling missing values: There are 17 columns with unacceptable missing values
    -- discount_amount has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- event_volume has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- has_quantity_schedule has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- has_revenue_schedule has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- has_schedule has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- is_active has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- is_deleted has 90.0 percent missing. Strategy: 🔄 Unchanged
    -- item_description has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_referenced_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- last_viewed_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- product_family has 90.0 percent missing. Strategy: 🔄 Unchanged
    -- roadmap_connections has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- row_volume has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- sbqq_parent_id has 90.0 percent missing. Strategy: 🔄 Unchanged
    -- service_date has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- sort_order has 100.0 percent missing. Strategy: 🗑️ Drop Column
    -- stamped_product_code has 100.0 percent missing. Strategy: 🗑️ Drop Column
    SELECT
        "subscription_type",
        "sbqq_parent_id",
        "pricebook_entry_id",
        "is_deleted",
        "product_code",
        "total_price",
        "duration_months",
        "opportunity_id",
        "sbqq_quote_line",
        "product_family",
        "product_name",
        "line_item_id",
        "quantity",
        "hvr_use_case",
        "last_modifier_id",
        "product_id",
        "unit_price",
        "creator_id",
        "creation_datetime",
        "last_modified_datetime",
        "last_modified_timestamp",
        "list_price"
    FROM "sf_opportunity_line_item_data_removeWideColumns_projected_renamed_cleaned_null_casted"
)

-- COCOON BLOCK END
SELECT * FROM "sf_opportunity_line_item_data_removeWideColumns_projected_renamed_cleaned_null_casted_missing_handled"

stg_sf_opportunity_line_item_data.yml (Document the table)

version: 2
models:
- name: stg_sf_opportunity_line_item_data
  description: The table is about opportunity line items. It contains details of individual
    products or services within a sales opportunity. Each row represents a single
    item with information like product name, quantity, price, discounts, and related
    IDs. The table includes fields for dates, pricing, product codes, and custom fields
    specific to the sales process. It appears to be part of a larger customer relationship
    management (CRM) or sales force automation system.
  columns:
  - name: subscription_type
    description: Subscription type for the product or service
    tests:
    - accepted_values:
        values:
        - Renewable
        - Non-renewable
        - Monthly
        - Quarterly
        - Annual
        - Lifetime
        - Free trial
        - Pay-as-you-go
        - Basic
        - Premium
        - Enterprise
        - Student
        - Family
        - Individual
    cocoon_meta:
      missing_acceptable: Not applicable for non-subscription products or services.
  - name: sbqq_parent_id
    description: Custom field for parent ID in SBQQ
    tests:
    - not_null
  - name: pricebook_entry_id
    description: ID of the associated pricebook entry
    tests:
    - not_null
  - name: is_deleted
    description: Indicates if the record is deleted
    tests:
    - not_null
  - name: product_code
    description: Code identifying the product
    tests:
    - not_null
    - accepted_values:
        values:
        - a
        - b
        - c
        - d
        - e
        - f
        - g
        - h
        - i
        - j
        - k
        - l
        - m
        - n
        - o
        - p
        - q
        - r
        - s
        - t
        - u
        - v
        - w
        - x
        - y
        - z
  - name: total_price
    description: Total price for the line item
    tests:
    - not_null
  - name: duration_months
    description: Custom field for duration in months
    tests:
    - not_null
  - name: opportunity_id
    description: ID of the associated opportunity
    tests:
    - not_null
  - name: sbqq_quote_line
    description: Custom field for quote line in SBQQ
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column appears to contain a unique identifier for each quote
        line. For this table, where each row represents a line item, this could potentially
        be unique across all rows.
  - name: product_family
    description: Custom field for product family
    tests:
    - not_null
  - name: product_name
    description: Name of the product or service
    tests:
    - not_null
    - accepted_values:
        values:
        - plan a
        - plan b
        - plan c
        - plan d
        - plan e
        - plan f
        - plan g
        - plan h
        - plan i
        - plan j
        - plan k
        - plan l
        - plan m
        - plan n
        - plan o
        - plan p
        - plan q
        - plan r
        - plan s
        - plan t
        - plan u
        - plan v
        - plan w
        - plan x
        - plan y
        - plan z
  - name: line_item_id
    description: Unique identifier for the line item
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: This column appears to be a unique identifier for each line item.
        For this table, where each row represents a line item, this should be unique
        across all rows.
  - name: quantity
    description: Quantity of the product or service
    tests:
    - not_null
  - name: hvr_use_case
    description: Custom field for HVR use case
    cocoon_meta:
      missing_acceptable: Might not apply to certain product types or categories.
  - name: last_modifier_id
    description: ID of user who last modified the record
    tests:
    - not_null
  - name: product_id
    description: ID of the associated product
    tests:
    - not_null
  - name: unit_price
    description: Price per unit of the product or service
    tests:
    - not_null
  - name: creator_id
    description: ID of the user who created the record
    tests:
    - not_null
  - name: creation_datetime
    description: Date and time when the record was created
    tests:
    - not_null
  - name: last_modified_datetime
    description: Date and time of last modification
    tests:
    - not_null
  - name: last_modified_timestamp
    description: Last modification timestamp of the record
    tests:
    - not_null
  - name: list_price
    description: List price of the product or service
    tests:
    - not_null
Some tables log change events, which may be redundant to query. Instead, we take a snapshot of the latest.

snapshot_sf_contact_history_data (first 100 rows)

mailing_country lead_source mailing_city contact_id last_name owner_id mailing_country_code mailing_state last_modified_by_id email full_name mailing_street account_id is_active description primary_phone job_title home_phone individual_id is_deleted last_activity_date last_modified_date last_referenced_date last_viewed_date mailing_postal_code master_record_id mobile_phone reports_to_id validity_start_date
0 United States ZoomInfo Chicago 0031G00000qAfq1QAC G 0051G000005MreQAC US Illinois 0051G000005MreQAC hi@google.com Jerome Powell 123 Ave 0011G00000eNyiXQAS True Buy more. (555) 555-5555 Marketing Director None None NaN 2019-01-03 19:53:01 2019-11-11 17:23:34 NaT 2019-01-13 19:53:01 55555.0 None None None 2019-01-03 19:53:01
1 None None None 0033700000JmrFPAA None None None None None None None None None True None None None None None NaN 2020-07-07 00:00:00 2019-11-11 17:23:34 NaT 2020-08-07 00:00:00 None None None None 2020-07-07 12:51:56
2 United States ZoomInfo None 0031G00000q9jPQAQ G 0051G000005MreQAC US None 0051G000005MreQAC None Janet Yellen None 0011G00000eM9wvQAC True None (555) 555-5555 Data Science Director None None NaN 2018-11-12 19:53:00 2019-11-11 17:23:34 NaT 2018-11-13 19:53:00 None None None None 2018-11-12 19:53:00
3 United States Vendor List None 0031G00000rfAvuQAE G 0051G000005MreQAC US None 0051G000005MreQAC None Jerome Powell None 0011G00000f8NwQAU True Buy our things. None Director, Business Insights & Strategy None None NaN 2019-04-04 17:44:47 2019-11-11 17:23:34 NaT 2019-04-13 17:44:47 None None None None 2019-04-04 17:44:47

snapshot_sf_contact_history_data.sql (clean the table)

-- Slowly Changing Dimension: Dimension keys are "contact_id"
-- Effective date columns are "validity_end_date"
-- We will create Type 1 SCD (latest snapshot)
SELECT 
    "mailing_country",
    "lead_source",
    "mailing_city",
    "contact_id",
    "last_name",
    "owner_id",
    "mailing_country_code",
    "mailing_state",
    "last_modified_by_id",
    "email",
    "full_name",
    "mailing_street",
    "account_id",
    "is_active",
    "description",
    "primary_phone",
    "job_title",
    "home_phone",
    "individual_id",
    "is_deleted",
    "last_activity_date",
    "last_modified_date",
    "last_referenced_date",
    "last_viewed_date",
    "mailing_postal_code",
    "master_record_id",
    "mobile_phone",
    "reports_to_id",
    "validity_start_date"
FROM (
     SELECT 
            "mailing_country",
            "lead_source",
            "mailing_city",
            "contact_id",
            "last_name",
            "owner_id",
            "mailing_country_code",
            "mailing_state",
            "last_modified_by_id",
            "email",
            "full_name",
            "mailing_street",
            "account_id",
            "is_active",
            "description",
            "primary_phone",
            "job_title",
            "home_phone",
            "individual_id",
            "is_deleted",
            "last_activity_date",
            "last_modified_date",
            "last_referenced_date",
            "last_viewed_date",
            "mailing_postal_code",
            "master_record_id",
            "mobile_phone",
            "reports_to_id",
            "validity_start_date",
            ROW_NUMBER() OVER (
                PARTITION BY "contact_id" 
                ORDER BY "validity_end_date" 
            DESC) AS "cocoon_rn"
    FROM "stg_sf_contact_history_data"
) ranked
WHERE "cocoon_rn" = 1

snapshot_sf_contact_history_data.yml (Document the table)

version: 2
models:
- name: snapshot_sf_contact_history_data
  description: The table is about current contact information. It tracks the most
    recent version of personal and professional details for individuals. This includes
    names, email addresses, phone numbers, mailing addresses, job titles, and account
    associations. It also contains system-related data like last modified dates, owner
    IDs, and activity dates. The table is used for up-to-date customer relationship
    management.
  columns:
  - name: mailing_country
    description: Country in the mailing address
    tests:
    - not_null
  - name: lead_source
    description: Source of the lead or contact
    tests:
    - not_null
  - name: mailing_city
    description: City in the mailing address
    tests:
    - not_null
  - name: contact_id
    description: Unique identifier for the contact record
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: Unique dimension key, derived from the slowly changing dimension
  - name: last_name
    description: Last name of the contact
    tests:
    - not_null
  - name: owner_id
    description: ID of the user who owns the record
    tests:
    - not_null
  - name: mailing_country_code
    description: Country code in the mailing address
    tests:
    - not_null
  - name: mailing_state
    description: State in the mailing address
    tests:
    - not_null
    - accepted_values:
        values:
        - Alabama
        - Alaska
        - Arizona
        - Arkansas
        - California
        - Colorado
        - Connecticut
        - Delaware
        - Florida
        - Georgia
        - Hawaii
        - Idaho
        - Illinois
        - Indiana
        - Iowa
        - Kansas
        - Kentucky
        - Louisiana
        - Maine
        - Maryland
        - Massachusetts
        - Michigan
        - Minnesota
        - Mississippi
        - Missouri
        - Montana
        - Nebraska
        - Nevada
        - New Hampshire
        - New Jersey
        - New Mexico
        - New York
        - North Carolina
        - North Dakota
        - Ohio
        - Oklahoma
        - Oregon
        - Pennsylvania
        - Rhode Island
        - South Carolina
        - South Dakota
        - Tennessee
        - Texas
        - Utah
        - Vermont
        - Virginia
        - Washington
        - West Virginia
        - Wisconsin
        - Wyoming
  - name: last_modified_by_id
    description: ID of user who last modified the record
    tests:
    - not_null
  - name: email
    description: Email address of the contact
    tests:
    - not_null
  - name: full_name
    description: Full name of the contact
    tests:
    - not_null
  - name: mailing_street
    description: Street address in the mailing address
    tests:
    - not_null
  - name: account_id
    description: Unique identifier for the associated account
    tests:
    - not_null
  - name: is_active
    description: Indicates if the record is currently active
    tests:
    - not_null
  - name: description
    description: Additional notes or description about the contact
    tests:
    - not_null
  - name: primary_phone
    description: Primary phone number of the contact
    tests:
    - not_null
  - name: job_title
    description: Job title of the individual
    tests:
    - not_null
  - name: home_phone
    description: Home phone number of the contact
    cocoon_meta:
      missing_acceptable: Not all contacts may have a home phone.
  - name: individual_id
    description: Identifier for the individual (if different from contact)
    cocoon_meta:
      missing_acceptable: May not be applicable for business or organizational contacts.
  - name: is_deleted
    description: Indicates if the record has been deleted
    cocoon_meta:
      missing_acceptable: Record is active, so deletion status not applicable.
  - name: last_activity_date
    description: Date of the most recent activity
    tests:
    - not_null
  - name: last_modified_date
    description: Date and time of last modification
    tests:
    - not_null
  - name: last_referenced_date
    description: Date the record was last referenced
    cocoon_meta:
      missing_acceptable: New or unused records may not have been referenced.
  - name: last_viewed_date
    description: Date the record was last viewed
    tests:
    - not_null
  - name: mailing_postal_code
    description: Postal code in the mailing address
    tests:
    - not_null
  - name: master_record_id
    description: ID of the master record if duplicates exist
    cocoon_meta:
      missing_acceptable: Only applicable for merged or duplicate records.
  - name: mobile_phone
    description: Mobile phone number of the contact
    cocoon_meta:
      missing_acceptable: Not all contacts may have a mobile phone.
  - name: reports_to_id
    description: ID of the person this contact reports to
    cocoon_meta:
      missing_acceptable: May not have a superior or be part of hierarchy.
  - name: validity_start_date
    description: Start date of record validity
    tests:
    - not_null
cocoon_meta:
  scd_base_table: stg_sf_contact_history_data

snapshot_sf_account_history_data (first 100 rows)

account_name shipping_country account_source record_id is_deleted record_type_id industry master_record_id encrypted_website owner_id billing_street description billing_postal_code encrypted_account_type is_active employee_count parent_account_id shipping_city shipping_postal_code shipping_state shipping_street valid_from
0 None None 4sUcAmMzCJTMD0K4Qnsiog== 001q0000010QZZ7AAO True ulhLv5btm8B/N7JURh1/+w== None None None AwxR76rxgr77EfSnTHH57Q== None None None iFbCAfBS66w7LWV2PbAhCg== False None None None None None None 2019-04-04 18:36:06
1 None None None 0015500000Xyy06AAB False ulhLv5btm8B/N7JURh1/+w== None None None tqs6UXPA/Lm7W+0dX0+syw== None None None ziZgHawN6hOLcpXwK3Ygpw== True None None None None None None 2019-10-17 21:10:19
2 Seinfeld Company None TDK+SgtPSM3Vk67zX9aeRA== 0015500000Ygpq1AAB True ulhLv5btm8B/N7JURh1/+w== None L4izOo4yZpLq5io5YM8pvA== None soS8gWpPTwLhsepmOnEc0w== None None None ziZgHawN6hOLcpXwK3Ygpw== True None None None None None None 2019-10-17 21:33:00
3 None None MfuqnemFQBY2RwqM7YBkKA== 001q0000010Pe9xAAC True ulhLv5btm8B/N7JURh1/+w== None None jcDRlq9Jxi7l0+tk1aTTdg== AwxR76rxgr77EfSnTHH57Q== None None None iFbCAfBS66w7LWV2PbAhCg== True None None None None None None 2019-04-04 18:36:06
4 Balto Dog Company None MfuqnemFQBY2RwqM7YBkKA== 001q0000010kZLuAAM True ulhLv5btm8B/N7JURh1/+w== yCBcdjbnKNRIwndOakqUSw== None +Z00MuxehkeqPQlcxh/nBA== AwxR76rxgr77EfSnTHH57Q== XBbaBQNtkym1SAcPiKF1UA== None bnxaENqWaHK61C0CuTdesA== iFbCAfBS66w7LWV2PbAhCg== True None None None None None None 2019-04-04 18:36:06
5 None None 4sUcAmMzCJTMD0K4Qnsiog== 001q000000wW9BZAA0 True ulhLv5btm8B/N7JURh1/+w== None None ye4O0TtPzpTBUyS5TfSNig== Air1Prg9Tsiw3UANemom6g== 2YEqg12uvpIXyu6aR9mQlg== None gnzLDuqKcGxMNKFokfhOew== iFbCAfBS66w7LWV2PbAhCg== True None None None None None None 2019-04-04 18:36:06
6 None None None 001q000000wW9BeAAK True ulhLv5btm8B/N7JURh1/+w== None None ye4O0TtPzpTBUyS5TfSNig== Air1Prg9Tsiw3UANemom6g== 2YEqg12uvpIXyu6aR9mQlg== None gnzLDuqKcGxMNKFokfhOew== iFbCAfBS66w7LWV2PbAhCg== True None None None None None None 2019-04-04 18:36:06
7 None None Fbu50LvyXo0peN4RaMdJ3A== 001q0000013WMSUAA4 True ulhLv5btm8B/N7JURh1/+w== yCBcdjbnKNRIwndOakqUSw== None HVkg9LRLJ6gCvXfE8FNvWg== nqxS50kwRjtOYb9ZB4/PoQ== UisBzX5S+vz7B0xHE4v4bg== None auObPzjeIkCwKijyu7QQCw== ziZgHawN6hOLcpXwK3Ygpw== True 120210.0 None None None None None 2019-04-04 18:36:06
8 Rick Thomas Company None MfuqnemFQBY2RwqM7YBkKA== 001q0000010PXTEAA4 True ulhLv5btm8B/N7JURh1/+w== None None +6N+ddY6amrzExJicFCd3w== Air1Prg9Tsiw3UANemom6g== qvC68WCtjj4ClzOUWJSkCw== wf9VogLxiOoQJExQ13q6Vw== bnxaENqWaHK61C0CuTdesA== iFbCAfBS66w7LWV2PbAhCg== False None None None None None None 2019-04-04 18:36:06
9 None None 4sUcAmMzCJTMD0K4Qnsiog== 001q0000010PiFMAA0 True ulhLv5btm8B/N7JURh1/+w== None None None AwxR76rxgr77EfSnTHH57Q== None None None iFbCAfBS66w7LWV2PbAhCg== False None None None None None None 2019-04-04 18:36:06

snapshot_sf_account_history_data.sql (clean the table)

-- Slowly Changing Dimension: Dimension keys are "record_id"
-- Effective date columns are "valid_until"
-- We will create Type 1 SCD (latest snapshot)
SELECT 
    "account_name",
    "shipping_country",
    "account_source",
    "record_id",
    "is_deleted",
    "record_type_id",
    "industry",
    "master_record_id",
    "encrypted_website",
    "owner_id",
    "billing_street",
    "description",
    "billing_postal_code",
    "encrypted_account_type",
    "is_active",
    "employee_count",
    "parent_account_id",
    "shipping_city",
    "shipping_postal_code",
    "shipping_state",
    "shipping_street",
    "valid_from"
FROM (
     SELECT 
            "account_name",
            "shipping_country",
            "account_source",
            "record_id",
            "is_deleted",
            "record_type_id",
            "industry",
            "master_record_id",
            "encrypted_website",
            "owner_id",
            "billing_street",
            "description",
            "billing_postal_code",
            "encrypted_account_type",
            "is_active",
            "employee_count",
            "parent_account_id",
            "shipping_city",
            "shipping_postal_code",
            "shipping_state",
            "shipping_street",
            "valid_from",
            ROW_NUMBER() OVER (
                PARTITION BY "record_id" 
                ORDER BY "valid_until" 
            DESC) AS "cocoon_rn"
    FROM "stg_sf_account_history_data"
) ranked
WHERE "cocoon_rn" = 1

snapshot_sf_account_history_data.yml (Document the table)

version: 2
models:
- name: snapshot_sf_account_history_data
  description: The table contains the latest version of Salesforce account data. It
    includes account details like name, billing/shipping address, industry, and other
    metadata. Some fields are encrypted for security. Each row represents the most
    current information for a unique account. The table omits historical versions
    and tracking columns, focusing on the present state of accounts.
  columns:
  - name: account_name
    description: Name of the account
    tests:
    - not_null
  - name: shipping_country
    description: Country for shipping address
    cocoon_meta:
      missing_acceptable: Not applicable if the account has no shipping address.
  - name: account_source
    description: Origin or source of the account
    tests:
    - not_null
  - name: record_id
    description: Unique identifier for the record
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: Unique dimension key, derived from the slowly changing dimension
  - name: is_deleted
    description: Indicates if the record is deleted
    tests:
    - not_null
  - name: record_type_id
    description: ID of the record type
    tests:
    - not_null
  - name: industry
    description: Industry sector of the account
    tests:
    - not_null
  - name: master_record_id
    description: ID of the master record if merged
    tests:
    - not_null
  - name: encrypted_website
    description: Encrypted website URL of the account
    tests:
    - not_null
  - name: owner_id
    description: ID of the account owner
    tests:
    - not_null
  - name: billing_street
    description: Street address for billing
    tests:
    - not_null
  - name: description
    description: Additional details about the account
    tests:
    - not_null
  - name: billing_postal_code
    description: Postal code for billing address
    tests:
    - not_null
  - name: encrypted_account_type
    description: Encrypted account type or category
    tests:
    - not_null
  - name: is_active
    description: Indicates if the record is currently active
    tests:
    - not_null
  - name: employee_count
    description: Total number of employees in the company
    tests:
    - not_null
  - name: parent_account_id
    description: ID of the parent account if exists
    cocoon_meta:
      missing_acceptable: Not applicable if the account is not a subsidiary.
  - name: shipping_city
    description: City for shipping address
    cocoon_meta:
      missing_acceptable: Not applicable if the account has no shipping address.
  - name: shipping_postal_code
    description: Postal code for shipping address
    cocoon_meta:
      missing_acceptable: Not applicable if the account has no shipping address.
  - name: shipping_state
    description: State for shipping address
    cocoon_meta:
      missing_acceptable: Not applicable if the account has no shipping address.
  - name: shipping_street
    description: Shipping street address of the account
    cocoon_meta:
      missing_acceptable: Not applicable if the account has no shipping address.
  - name: valid_from
    description: Start timestamp for record validity
    tests:
    - not_null
cocoon_meta:
  scd_base_table: stg_sf_account_history_data

snapshot_sf_opportunity_history_data (first 100 rows)

forecast_category_id is_closed opportunity_category opportunity_type_id has_overdue_task opportunity_amount is_deleted is_won opportunity_id is_active account_id lead_source_id win_probability stage_name has_line_items owner_id forecast_category_name opportunity_name has_open_activity campaign_id close_date created_date fiscal_quarter fiscal_year validity_start_date
0 AloDHjNI+wntE4Eetriz+w== True +Gkf6SQ2fhAONAiFelNKVw== 14mxIBMk0YX2Gz0r1Ktsuw== False NaN True False 006q000000HcZXXAA3 False 78HpxISq4/eSw+ycDPqSwA== UN2fttk8geFc7Db/xJzQ+A== 0 tXi3M8u3iPxq0ggxTSxMKw== False 9B1r0vK1wAVGaERpMleKGg== AloDHjNI+wntE4Eetriz+w== lu test False None 2018-12-13 2018-12-13 18:00:11 4 2018 2019-04-03 18:36:06
1 AloDHjNI+wntE4Eetriz+w== True +Gkf6SQ2fhAONAiFelNKVw== 14mxIBMk0YX2Gz0r1Ktsuw== False 200000.0 True False 006q000000HK8jdAAD True TK5MTSsiOYoDQoJiSbkugA== MfuqnemFQBY2RwqM7YBkKA== 0 tXi3M8u3iPxq0ggxTSxMKw== False QEaGoY7B8nGfro2vhOCMvA== AloDHjNI+wntE4Eetriz+w== Evergreen Test False None 2018-11-21 2018-11-14 19:12:53 4 2018 2019-04-04 18:36:08
2 A/SkeDD5c3ejUyEFFoUHHg== True +Gkf6SQ2fhAONAiFelNKVw== 3QOHd+Q7F28PJtnwztV09Q== False NaN True True 006q000000HdPzpAAF True wfQo3+JVfsNIdcz/mUkZkA== Fbu50LvyXo0peN4RaMdJ3A== 100 GavUFuuf4DrnQAoiRGlWpQ== False nqxS50kwRjtOYb9ZB4/PoQ== A/SkeDD5c3ejUyEFFoUHHg== Testing Opp Close False None 2018-12-18 2018-12-18 21:21:17 4 2018 2019-10-17 21:33:00
3 A/SkeDD5c3ejUyEFFoUHHg== True +Gkf6SQ2fhAONAiFelNKVw== 3QOHd+Q7F28PJtnwztV09Q== False 24120000.0 True True 006q000000HddohAAB True 9CcfAt8qtZvCTwFvwOFLcg== TDK+SgtPSM3Vk67zX9aeRA== 1000 GavUFuuf4DrnQAoiRGlWpQ== True rQhle3uwQbFgFmLTF1WByg== A/SkeDD5c3ejUyEFFoUHHg== $1m deal False None 2018-12-19 2018-12-19 19:51:13 4 2018 2019-10-17 21:10:19
4 A/SkeDD5c3ejUyEFFoUHHg== True dSJC2EuRkC62f+UuBPQeVg== 3QOHd+Q7F28PJtnwztV09Q== False NaN True True 006q000000HddueAAB True wfQo3+JVfsNIdcz/mUkZkA== dSJC2EuRkC62f+UuBPQeVg== 100 GavUFuuf4DrnQAoiRGlWpQ== False nqxS50kwRjtOYb9ZB4/PoQ== A/SkeDD5c3ejUyEFFoUHHg== Chewbaca False None 2018-12-07 2018-12-19 20:22:58 4 2018 2019-04-04 18:36:08
5 A/SkeDD5c3ejUyEFFoUHHg== True +Gkf6SQ2fhAONAiFelNKVw== 14mxIBMk0YX2Gz0r1Ktsuw== False NaN True True 006q000000HcZXrAAN True 78HpxISq4/eSw+ycDPqSwA== pOz8cFdDlJkM8XvYPfSZ9w== 100 GavUFuuf4DrnQAoiRGlWpQ== False 9B1r0vK1wAVGaERpMleKGg== A/SkeDD5c3ejUyEFFoUHHg== lu test False None 2018-12-13 2018-12-13 18:02:55 4 2018 2019-04-04 18:36:08
6 AloDHjNI+wntE4Eetriz+w== True 9Q0PuStPWLYgxG/8kpvo5g== 14mxIBMk0YX2Gz0r1Ktsuw== False NaN True False 006q000000HcZXcAAN True 78HpxISq4/eSw+ycDPqSwA== pOz8cFdDlJkM8XvYPfSZ9w== 0 tXi3M8u3iPxq0ggxTSxMKw== False AwxR76rxgr77EfSnTHH57Q== AloDHjNI+wntE4Eetriz+w== lu test False None 2018-12-13 2018-12-13 18:01:22 4 2018 2019-04-04 18:36:08
7 A/SkeDD5c3ejUyEFFoUHHg== True +Gkf6SQ2fhAONAiFelNKVw== 14mxIBMk0YX2Gz0r1Ktsuw== False NaN True True 006q000000Hbmd1AAB True wIXkC/s93lDAT+HVkwv6+A== TDK+SgtPSM3Vk67zX9aeRA== 100 GavUFuuf4DrnQAoiRGlWpQ== False dVDxbGz10nJ2mKU213GZRQ== A/SkeDD5c3ejUyEFFoUHHg== Test False None 2018-12-18 2018-12-10 17:03:22 4 2018 2019-04-04 18:36:08
8 rq6uxRtOa4gSLxCtlqjecg== False +Gkf6SQ2fhAONAiFelNKVw== 3QOHd+Q7F28PJtnwztV09Q== False 210000.0 True False 006q000000HdOhuAAF False wIXkC/s93lDAT+HVkwv6+A== Fbu50LvyXo0peN4RaMdJ3A== 65 9RN9J3tlxr89gDctReax5w== True dVDxbGz10nJ2mKU213GZRQ== rq6uxRtOa4gSLxCtlqjecg== Testing Order from Process False None 2018-12-19 2018-12-18 17:56:05 4 2018 2019-04-03 18:36:06
9 AloDHjNI+wntE4Eetriz+w== True +Gkf6SQ2fhAONAiFelNKVw== 14mxIBMk0YX2Gz0r1Ktsuw== False 1.0 True False 006q000000GoP76AAF True tZX+Z0iWzZHHjNvRnCJzwg== None 0 tXi3M8u3iPxq0ggxTSxMKw== False TLZtnkcZltX8lijWYSQqRg== AloDHjNI+wntE4Eetriz+w== Blue Test False None 2018-10-31 2018-10-31 17:43:42 4 2018 2019-04-04 18:36:08

snapshot_sf_opportunity_history_data.sql (clean the table)

-- Slowly Changing Dimension: Dimension keys are "opportunity_id"
-- Effective date columns are "validity_end_date"
-- We will create Type 1 SCD (latest snapshot)
SELECT 
    "forecast_category_id",
    "is_closed",
    "opportunity_category",
    "opportunity_type_id",
    "has_overdue_task",
    "opportunity_amount",
    "is_deleted",
    "is_won",
    "opportunity_id",
    "is_active",
    "account_id",
    "lead_source_id",
    "win_probability",
    "stage_name",
    "has_line_items",
    "owner_id",
    "forecast_category_name",
    "opportunity_name",
    "has_open_activity",
    "campaign_id",
    "close_date",
    "created_date",
    "fiscal_quarter",
    "fiscal_year",
    "validity_start_date"
FROM (
     SELECT 
            "forecast_category_id",
            "is_closed",
            "opportunity_category",
            "opportunity_type_id",
            "has_overdue_task",
            "opportunity_amount",
            "is_deleted",
            "is_won",
            "opportunity_id",
            "is_active",
            "account_id",
            "lead_source_id",
            "win_probability",
            "stage_name",
            "has_line_items",
            "owner_id",
            "forecast_category_name",
            "opportunity_name",
            "has_open_activity",
            "campaign_id",
            "close_date",
            "created_date",
            "fiscal_quarter",
            "fiscal_year",
            "validity_start_date",
            ROW_NUMBER() OVER (
                PARTITION BY "opportunity_id" 
                ORDER BY "validity_end_date" 
            DESC) AS "cocoon_rn"
    FROM "stg_sf_opportunity_history_data"
) ranked
WHERE "cocoon_rn" = 1

snapshot_sf_opportunity_history_data.yml (Document the table)

version: 2
models:
- name: snapshot_sf_opportunity_history_data
  description: The table is about current sales opportunities. It tracks the most
    recent version of each opportunity, including details like ID, account, amount,
    close date, forecast category, probability, and stage. It contains information
    on whether opportunities are won, lost, or active, and includes associated data
    like lead source, campaign, and fiscal period. The table provides a snapshot of
    the latest state for each sales opportunity.
  columns:
  - name: forecast_category_id
    description: Category for forecasting purposes
    tests:
    - not_null
  - name: is_closed
    description: Indicates if the opportunity is closed
    tests:
    - not_null
  - name: opportunity_category
    description: Classification or category of the opportunity
    tests:
    - not_null
  - name: opportunity_type_id
    description: Identifier for the type of sales opportunity record
    tests:
    - not_null
  - name: has_overdue_task
    description: Indicates if there's an overdue task
    tests:
    - not_null
  - name: opportunity_amount
    description: Monetary value of the opportunity
    tests:
    - not_null
  - name: is_deleted
    description: Indicates if the opportunity is deleted
    tests:
    - not_null
  - name: is_won
    description: Indicates if the opportunity was won
    tests:
    - not_null
  - name: opportunity_id
    description: Unique identifier for the opportunity
    tests:
    - not_null
    - unique
    cocoon_meta:
      uniqueness: Unique dimension key, derived from the slowly changing dimension
  - name: is_active
    description: Indicates if the record is currently active
    tests:
    - not_null
  - name: account_id
    description: Unique identifier for the associated account
    tests:
    - not_null
  - name: lead_source_id
    description: Source of the lead for this opportunity
    tests:
    - not_null
  - name: win_probability
    description: Likelihood of winning the opportunity
    tests:
    - not_null
  - name: stage_name
    description: Current stage of the sales opportunity
    tests:
    - not_null
    - accepted_values:
        values:
        - Lead
        - Prospect
        - Qualification
        - Needs Analysis
        - Proposal
        - Negotiation
        - Closed Won
        - Closed Lost
        - GavUFuuf4DrnQAoiRGlWpQ==
        - tXi3M8u3iPxq0ggxTSxMKw==
        - 9RN9J3tlxr89gDctReax5w==
  - name: has_line_items
    description: Indicates if line items are present
    tests:
    - not_null
  - name: owner_id
    description: Identifier of the opportunity owner
    tests:
    - not_null
  - name: forecast_category_name
    description: Name of the forecast category
    tests:
    - not_null
  - name: opportunity_name
    description: Name or title of the opportunity
    tests:
    - not_null
  - name: has_open_activity
    description: Indicates if there's an open activity
    tests:
    - not_null
  - name: campaign_id
    description: Identifier for associated marketing campaign
    cocoon_meta:
      missing_acceptable: Not all opportunities are associated with marketing campaigns.
  - name: close_date
    description: Date when the opportunity was closed
    tests:
    - not_null
  - name: created_date
    description: Date when the opportunity was created
    tests:
    - not_null
  - name: fiscal_quarter
    description: Fiscal quarter of the opportunity
    tests:
    - not_null
    - accepted_values:
        values:
        - '1'
        - '2'
        - '3'
        - '4'
  - name: fiscal_year
    description: Fiscal year of the opportunity
    tests:
    - not_null
    - accepted_values:
        values:
        - '2015'
        - '2016'
        - '2017'
        - '2018'
        - '2019'
        - '2020'
        - '2021'
        - '2022'
        - '2023'
        - '2024'
  - name: validity_start_date
    description: Start date of the record's validity
    tests:
    - not_null
cocoon_meta:
  scd_base_table: stg_sf_opportunity_history_data
We identify the primary key (PK) and foreign key (FK) from tables. We build a join graph that connects FK to PK.

Join Graph (FK to PK)

%3 stg_sf_user_role_data stg_sf_user_role_data stg_sf_lead_data stg_sf_lead_data stg_sf_user_data stg_sf_user_data stg_sf_lead_data->stg_sf_user_data stg_sf_lead_data->stg_sf_user_data stg_sf_lead_data->stg_sf_user_data stg_sf_account_data stg_sf_account_data stg_sf_lead_data->stg_sf_account_data stg_sf_contact_data stg_sf_contact_data stg_sf_lead_data->stg_sf_contact_data stg_sf_opportunity_data stg_sf_opportunity_data stg_sf_lead_data->stg_sf_opportunity_data stg_sf_opportunity_line_item_data stg_sf_opportunity_line_item_data stg_sf_product_2_data stg_sf_product_2_data stg_sf_opportunity_line_item_data->stg_sf_product_2_data stg_sf_opportunity_line_item_data->stg_sf_user_data stg_sf_opportunity_line_item_data->stg_sf_user_data stg_sf_opportunity_line_item_data->stg_sf_opportunity_data snapshot_sf_opportunity_history_data snapshot_sf_opportunity_history_data snapshot_sf_opportunity_history_data->stg_sf_user_data snapshot_sf_opportunity_history_data->stg_sf_account_data snapshot_sf_opportunity_history_data->stg_sf_opportunity_data stg_sf_product_2_data->stg_sf_user_data stg_sf_product_2_data->stg_sf_user_data snapshot_sf_account_history_data snapshot_sf_account_history_data snapshot_sf_account_history_data->stg_sf_user_data stg_sf_user_data->stg_sf_user_role_data stg_sf_event_data stg_sf_event_data stg_sf_event_data->stg_sf_user_data stg_sf_event_data->stg_sf_user_data stg_sf_event_data->stg_sf_user_data stg_sf_event_data->stg_sf_event_data stg_sf_event_data->stg_sf_account_data stg_sf_event_data->stg_sf_contact_data stg_sf_task_data stg_sf_task_data stg_sf_task_data->stg_sf_user_data stg_sf_task_data->stg_sf_user_data stg_sf_task_data->stg_sf_user_data stg_sf_task_data->stg_sf_account_data stg_sf_task_data->stg_sf_contact_data stg_sf_account_data->stg_sf_user_data stg_sf_contact_data->stg_sf_user_data stg_sf_contact_data->stg_sf_user_data stg_sf_contact_data->stg_sf_user_data stg_sf_contact_data->stg_sf_account_data stg_sf_opportunity_data->stg_sf_user_data stg_sf_opportunity_data->stg_sf_account_data stg_sf_order_data stg_sf_order_data stg_sf_order_data->stg_sf_user_data stg_sf_order_data->stg_sf_user_data stg_sf_order_data->stg_sf_user_data stg_sf_order_data->stg_sf_user_data stg_sf_order_data->stg_sf_account_data stg_sf_order_data->stg_sf_account_data snapshot_sf_contact_history_data snapshot_sf_contact_history_data snapshot_sf_contact_history_data->stg_sf_user_data snapshot_sf_contact_history_data->stg_sf_user_data snapshot_sf_contact_history_data->stg_sf_account_data snapshot_sf_contact_history_data->stg_sf_contact_data

cocoon_join.yml (Document the joins)

join_graph:
- table_name: stg_sf_account_data
  primary_key: account_id
  foreign_keys:
  - column: owner_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
- table_name: stg_sf_contact_data
  foreign_keys:
  - column: account_id
    reference:
      table_name: stg_sf_account_data
      column: account_id
  - column: created_by_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
  - column: last_modified_by_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
  - column: owner_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
  primary_key: contact_id
- table_name: stg_sf_event_data
  foreign_keys:
  - column: account_id
    reference:
      table_name: stg_sf_account_data
      column: account_id
  - column: associated_contact_id
    reference:
      table_name: stg_sf_contact_data
      column: contact_id
  - column: associated_object_id
    reference:
      table_name: stg_sf_event_data
      column: event_id
  - column: created_by_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
  - column: last_modified_by_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
  - column: owner_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
  primary_key: event_id
- table_name: stg_sf_lead_data
  foreign_keys:
  - column: converted_account_id
    reference:
      table_name: stg_sf_account_data
      column: account_id
  - column: converted_contact_id
    reference:
      table_name: stg_sf_contact_data
      column: contact_id
  - column: converted_opportunity_id
    reference:
      table_name: stg_sf_opportunity_data
      column: opportunity_id
  - column: owner_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
  - column: last_modified_by_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
  - column: created_by_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
- table_name: stg_sf_opportunity_data
  foreign_keys:
  - column: account_id
    reference:
      table_name: stg_sf_account_data
      column: account_id
  - column: owner_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
  primary_key: opportunity_id
- table_name: stg_sf_order_data
  foreign_keys:
  - column: account_id
    reference:
      table_name: stg_sf_account_data
      column: account_id
  - column: billing_account_id
    reference:
      table_name: stg_sf_account_data
      column: account_id
  - column: last_modifier_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
  - column: owner_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
  - column: creator_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
  - column: activator_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
- table_name: stg_sf_task_data
  foreign_keys:
  - column: account_id
    reference:
      table_name: stg_sf_account_data
      column: account_id
  - column: associated_person_id
    reference:
      table_name: stg_sf_contact_data
      column: contact_id
  - column: created_by_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
  - column: last_modified_by_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
  - column: owner_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
- table_name: snapshot_sf_contact_history_data
  foreign_keys:
  - column: account_id
    reference:
      table_name: stg_sf_account_data
      column: account_id
  - column: contact_id
    reference:
      table_name: stg_sf_contact_data
      column: contact_id
  - column: owner_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
  - column: last_modified_by_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
- table_name: snapshot_sf_opportunity_history_data
  foreign_keys:
  - column: account_id
    reference:
      table_name: stg_sf_account_data
      column: account_id
  - column: opportunity_id
    reference:
      table_name: stg_sf_opportunity_data
      column: opportunity_id
  - column: owner_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
- table_name: stg_sf_opportunity_line_item_data
  foreign_keys:
  - column: opportunity_id
    reference:
      table_name: stg_sf_opportunity_data
      column: opportunity_id
  - column: product_id
    reference:
      table_name: stg_sf_product_2_data
      column: product_id
  - column: last_modifier_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
  - column: creator_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
- table_name: stg_sf_product_2_data
  primary_key: product_id
  foreign_keys:
  - column: last_modified_by_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
  - column: created_by_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
- table_name: stg_sf_user_data
  primary_key: user_id
  foreign_keys:
  - column: role_id
    reference:
      table_name: stg_sf_user_role_data
      column: role_id
- table_name: snapshot_sf_account_history_data
  foreign_keys:
  - column: owner_id
    reference:
      table_name: stg_sf_user_data
      column: user_id
- table_name: stg_sf_user_role_data
  primary_key: role_id
  foreign_keys: []
We identify the entities and relationships behind the tables, and tell the story among these relationships.

cocoon_er.yml (Document the ER model)

entities:
- entity_name: Accounts
  entity_description: Represents business accounts or organizations in the Salesforce
    system, including their details and attributes.
  table_name: stg_sf_account_data
  primary_key: account_id
- entity_name: Contacts
  entity_description: Represents individual people associated with accounts, including
    their personal and professional information.
  table_name: stg_sf_contact_data
  primary_key: contact_id
- entity_name: Events
  entity_description: Represents activities or engagements such as calls, meetings,
    or appointments associated with accounts or contacts.
  table_name: stg_sf_event_data
  primary_key: event_id
- entity_name: Opportunities
  entity_description: Represents potential sales or deals in various stages of the
    sales pipeline.
  table_name: stg_sf_opportunity_data
  primary_key: opportunity_id
- entity_name: Products
  entity_description: Represents goods or services offered by the company, including
    their attributes and pricing information.
  table_name: stg_sf_product_2_data
  primary_key: product_id
- entity_name: Users
  entity_description: Represents individuals who have access to the Salesforce system,
    including their roles and permissions.
  table_name: stg_sf_user_data
  primary_key: user_id
- entity_name: UserRoles
  entity_description: Represents the hierarchical structure of user roles and their
    associated permissions within the Salesforce system.
  table_name: stg_sf_user_role_data
  primary_key: role_id
relations:
- relation_name: UserManagedAccounts
  relation_description: This stores Account information managed by Users, where Users
    are represented by the owner_id field in the Accounts table.
  table_name: stg_sf_account_data
  entities:
  - Accounts
  - Users
- relation_name: AccountContactUserManagement
  relation_description: Contacts belong to Accounts and are managed by Users who own,
    create, or modify the contact records.
  table_name: stg_sf_contact_data
  entities:
  - Contacts
  - Accounts
  - Users
- relation_name: UserScheduledAccountEvents
  relation_description: Events are scheduled by Users for Accounts, involving specific
    Contacts, tracking various activities and interactions.
  table_name: stg_sf_event_data
  entities:
  - Events
  - Accounts
  - Contacts
  - Users
- relation_name: AccountOpportunityManagement
  relation_description: Opportunities are sales prospects associated with Accounts
    and managed by Users (owners) within a sales pipeline.
  table_name: stg_sf_opportunity_data
  entities:
  - Opportunities
  - Accounts
  - Users
- relation_name: ProductCatalogManagement
  relation_description: This stores Product information and metadata, including details
    about Users who created or modified the products.
  table_name: stg_sf_product_2_data
  entities:
  - Products
  - Users
- relation_name: UserRoleAssignment
  relation_description: Users are assigned specific UserRoles within the Salesforce
    system, determining their permissions and access levels.
  table_name: stg_sf_user_data
  entities:
  - Users
  - UserRoles
- relation_name: LeadManagementAndConversion
  relation_description: Users manage Leads (potential Contacts) that can convert into
    Contacts associated with Accounts and generate Opportunities.
  table_name: stg_sf_lead_data
  entities:
  - Accounts
  - Contacts
  - Opportunities
  - Users
- relation_name: AccountOrdersManagement
  relation_description: This stores the Orders placed by Accounts, which are managed
    by Users who create, modify, and activate them.
  table_name: stg_sf_order_data
  entities:
  - Accounts
  - Users
- relation_description: Represents a business activity such as making a phone call
    or other to-do items. In the user interface, Task and Event records are collectively
    referred to as activities.
  table_name: stg_sf_task_data
  entities:
  - Accounts
  - Contacts
  - Users
- relation_description: Contacts belong to Accounts and are managed by Users who own
    and modify the contact information.
  table_name: snapshot_sf_contact_history_data
  entities:
  - Accounts
  - Contacts
  - Users
- relation_description: Users (sales representatives) manage Opportunities for Accounts,
    tracking potential sales and their progress through stages.
  table_name: snapshot_sf_opportunity_history_data
  entities:
  - Accounts
  - Opportunities
  - Users
- relation_name: OpportunityLineItems
  relation_description: Users create and modify Opportunities, which contain multiple
    Products as line items with specific pricing and quantities.
  table_name: stg_sf_opportunity_line_item_data
  entities:
  - Opportunities
  - Products
  - Users
- relation_description: This table stores the current state of Salesforce accounts,
    which may be associated with or managed by users in the system.
  table_name: snapshot_sf_account_history_data
  entities:
  - Users
story:
- relation_name: UserRoleAssignment
  story_line: Administrators assign roles to users in the system.
- relation_name: ProductCatalogManagement
  story_line: Product managers create and update product information.
- relation_name: LeadManagementAndConversion
  story_line: Sales reps identify and nurture potential leads.
- relation_name: UserManagedAccounts
  story_line: Sales reps convert leads into managed customer accounts.
- relation_name: AccountContactUserManagement
  story_line: Account managers add contacts to customer accounts.
- relation_name: AccountOpportunityManagement
  story_line: Sales reps create opportunities for customer accounts.
- relation_name: OpportunityLineItems
  story_line: Sales reps add products to sales opportunities.
- relation_name: UserScheduledAccountEvents
  story_line: Account managers schedule events with customer contacts.
- relation_name: AccountOrdersManagement
  story_line: Sales reps process and manage customer orders.