%3 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends 18. model.hubspot.hubspot__email_event_sent->21. model.hubspot.hubspot__email_sends 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change 20. model.hubspot.hubspot__email_event_status_change->30. model.hubspot.int_hubspot__email_aggregate_status_change 21. model.hubspot.hubspot__email_sends->4. model.hubspot.hubspot__contact_lists 21. model.hubspot.hubspot__email_sends->5. model.hubspot.hubspot__contacts 21. model.hubspot.hubspot__email_sends->9. model.hubspot.hubspot__email_campaigns 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 21. model.hubspot.hubspot__email_sends->32. model.hubspot.int_hubspot__email_metrics__by_contact_list 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements->1. model.hubspot.hubspot__companies 27. model.hubspot.hubspot__engagements->8. model.hubspot.hubspot__deals 27. model.hubspot.hubspot__engagements->22. model.hubspot.hubspot__engagement_calls 27. model.hubspot.hubspot__engagements->23. model.hubspot.hubspot__engagement_emails 27. model.hubspot.hubspot__engagements->24. model.hubspot.hubspot__engagement_meetings 27. model.hubspot.hubspot__engagements->25. model.hubspot.hubspot__engagement_notes 27. model.hubspot.hubspot__engagements->26. model.hubspot.hubspot__engagement_tasks 33. model.hubspot.int_hubspot__engagement_metrics__by_contact 33. model.hubspot.int_hubspot__engagement_metrics__by_contact 27. model.hubspot.hubspot__engagements->33. model.hubspot.int_hubspot__engagement_metrics__by_contact 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust->5. model.hubspot.hubspot__contacts 28. model.hubspot.int_hubspot__contact_merge_adjust->10. model.hubspot.hubspot__email_event_bounce 28. model.hubspot.int_hubspot__contact_merge_adjust->11. model.hubspot.hubspot__email_event_clicks 28. model.hubspot.int_hubspot__contact_merge_adjust->12. model.hubspot.hubspot__email_event_deferred 28. model.hubspot.int_hubspot__contact_merge_adjust->13. model.hubspot.hubspot__email_event_delivered 28. model.hubspot.int_hubspot__contact_merge_adjust->14. model.hubspot.hubspot__email_event_dropped 28. model.hubspot.int_hubspot__contact_merge_adjust->15. model.hubspot.hubspot__email_event_forward 28. model.hubspot.int_hubspot__contact_merge_adjust->16. model.hubspot.hubspot__email_event_opens 28. model.hubspot.int_hubspot__contact_merge_adjust->17. model.hubspot.hubspot__email_event_print 28. model.hubspot.int_hubspot__contact_merge_adjust->18. model.hubspot.hubspot__email_event_sent 28. model.hubspot.int_hubspot__contact_merge_adjust->19. model.hubspot.hubspot__email_event_spam_report 28. model.hubspot.int_hubspot__contact_merge_adjust->20. model.hubspot.hubspot__email_event_status_change 29. model.hubspot.int_hubspot__deals_enhanced 29. model.hubspot.int_hubspot__deals_enhanced 29. model.hubspot.int_hubspot__deals_enhanced->7. model.hubspot.hubspot__deal_stages 29. model.hubspot.int_hubspot__deals_enhanced->8. model.hubspot.hubspot__deals 30. model.hubspot.int_hubspot__email_aggregate_status_change->21. model.hubspot.hubspot__email_sends 31. model.hubspot.int_hubspot__email_event_aggregates 31. model.hubspot.int_hubspot__email_event_aggregates 31. model.hubspot.int_hubspot__email_event_aggregates->21. model.hubspot.hubspot__email_sends 32. model.hubspot.int_hubspot__email_metrics__by_contact_list->4. model.hubspot.hubspot__contact_lists 33. model.hubspot.int_hubspot__engagement_metrics__by_contact->5. model.hubspot.hubspot__contacts 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company->1. model.hubspot.hubspot__companies 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history->2. model.hubspot.hubspot__company_history 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp->35. model.hubspot_source.stg_hubspot__company_property_history 37. model.hubspot_source.stg_hubspot__company_tmp 37. model.hubspot_source.stg_hubspot__company_tmp 37. model.hubspot_source.stg_hubspot__company_tmp->34. model.hubspot_source.stg_hubspot__company 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact->28. model.hubspot.int_hubspot__contact_merge_adjust 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list->4. model.hubspot.hubspot__contact_lists 40. model.hubspot_source.stg_hubspot__contact_list_member 40. model.hubspot_source.stg_hubspot__contact_list_member 40. model.hubspot_source.stg_hubspot__contact_list_member->32. model.hubspot.int_hubspot__email_metrics__by_contact_list 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp->40. model.hubspot_source.stg_hubspot__contact_list_member 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp->39. model.hubspot_source.stg_hubspot__contact_list 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history->3. model.hubspot.hubspot__contact_history 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp->43. model.hubspot_source.stg_hubspot__contact_property_history 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp->38. model.hubspot_source.stg_hubspot__contact 46. model.hubspot_source.stg_hubspot__deal 46. model.hubspot_source.stg_hubspot__deal 46. model.hubspot_source.stg_hubspot__deal->29. model.hubspot.int_hubspot__deals_enhanced 47. model.hubspot_source.stg_hubspot__deal_company 47. model.hubspot_source.stg_hubspot__deal_company 48. model.hubspot_source.stg_hubspot__deal_company_tmp 48. model.hubspot_source.stg_hubspot__deal_company_tmp 48. model.hubspot_source.stg_hubspot__deal_company_tmp->47. model.hubspot_source.stg_hubspot__deal_company 49. model.hubspot_source.stg_hubspot__deal_contact 49. model.hubspot_source.stg_hubspot__deal_contact 50. model.hubspot_source.stg_hubspot__deal_contact_tmp 50. model.hubspot_source.stg_hubspot__deal_contact_tmp 50. model.hubspot_source.stg_hubspot__deal_contact_tmp->49. model.hubspot_source.stg_hubspot__deal_contact 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline->7. model.hubspot.hubspot__deal_stages 51. model.hubspot_source.stg_hubspot__deal_pipeline->29. model.hubspot.int_hubspot__deals_enhanced 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage->7. model.hubspot.hubspot__deal_stages 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage->29. model.hubspot.int_hubspot__deals_enhanced 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp->51. model.hubspot_source.stg_hubspot__deal_pipeline 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history->6. model.hubspot.hubspot__deal_history 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp->55. model.hubspot_source.stg_hubspot__deal_property_history 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage->7. model.hubspot.hubspot__deal_stages 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp->57. model.hubspot_source.stg_hubspot__deal_stage 59. model.hubspot_source.stg_hubspot__deal_tmp 59. model.hubspot_source.stg_hubspot__deal_tmp 59. model.hubspot_source.stg_hubspot__deal_tmp->46. model.hubspot_source.stg_hubspot__deal 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign->9. model.hubspot.hubspot__email_campaigns 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp->60. model.hubspot_source.stg_hubspot__email_campaign 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event->10. model.hubspot.hubspot__email_event_bounce 62. model.hubspot_source.stg_hubspot__email_event->11. model.hubspot.hubspot__email_event_clicks 62. model.hubspot_source.stg_hubspot__email_event->12. model.hubspot.hubspot__email_event_deferred 62. model.hubspot_source.stg_hubspot__email_event->13. model.hubspot.hubspot__email_event_delivered 62. model.hubspot_source.stg_hubspot__email_event->14. model.hubspot.hubspot__email_event_dropped 62. model.hubspot_source.stg_hubspot__email_event->15. model.hubspot.hubspot__email_event_forward 62. model.hubspot_source.stg_hubspot__email_event->16. model.hubspot.hubspot__email_event_opens 62. model.hubspot_source.stg_hubspot__email_event->17. model.hubspot.hubspot__email_event_print 62. model.hubspot_source.stg_hubspot__email_event->18. model.hubspot.hubspot__email_event_sent 62. model.hubspot_source.stg_hubspot__email_event->19. model.hubspot.hubspot__email_event_spam_report 62. model.hubspot_source.stg_hubspot__email_event->20. model.hubspot.hubspot__email_event_status_change 62. model.hubspot_source.stg_hubspot__email_event->31. model.hubspot.int_hubspot__email_event_aggregates 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce->10. model.hubspot.hubspot__email_event_bounce 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp->63. model.hubspot_source.stg_hubspot__email_event_bounce 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click->11. model.hubspot.hubspot__email_event_clicks 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp->65. model.hubspot_source.stg_hubspot__email_event_click 67. model.hubspot_source.stg_hubspot__email_event_deferred 67. model.hubspot_source.stg_hubspot__email_event_deferred 67. model.hubspot_source.stg_hubspot__email_event_deferred->12. model.hubspot.hubspot__email_event_deferred 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp->67. model.hubspot_source.stg_hubspot__email_event_deferred 69. model.hubspot_source.stg_hubspot__email_event_delivered 69. model.hubspot_source.stg_hubspot__email_event_delivered 69. model.hubspot_source.stg_hubspot__email_event_delivered->13. model.hubspot.hubspot__email_event_delivered 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp->69. model.hubspot_source.stg_hubspot__email_event_delivered 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped->14. model.hubspot.hubspot__email_event_dropped 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp->71. model.hubspot_source.stg_hubspot__email_event_dropped 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward->15. model.hubspot.hubspot__email_event_forward 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp->73. model.hubspot_source.stg_hubspot__email_event_forward 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open->16. model.hubspot.hubspot__email_event_opens 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp->75. model.hubspot_source.stg_hubspot__email_event_open 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print->17. model.hubspot.hubspot__email_event_print 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp->77. model.hubspot_source.stg_hubspot__email_event_print 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent->18. model.hubspot.hubspot__email_event_sent 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp->79. model.hubspot_source.stg_hubspot__email_event_sent 81. model.hubspot_source.stg_hubspot__email_event_spam_report 81. model.hubspot_source.stg_hubspot__email_event_spam_report 81. model.hubspot_source.stg_hubspot__email_event_spam_report->19. model.hubspot.hubspot__email_event_spam_report 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp->81. model.hubspot_source.stg_hubspot__email_event_spam_report 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change->20. model.hubspot.hubspot__email_event_status_change 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp->83. model.hubspot_source.stg_hubspot__email_event_status_change 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp->62. model.hubspot_source.stg_hubspot__email_event 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement->27. model.hubspot.hubspot__engagements 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call->22. model.hubspot.hubspot__engagement_calls 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp->87. model.hubspot_source.stg_hubspot__engagement_call 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company->1. model.hubspot.hubspot__companies 89. model.hubspot_source.stg_hubspot__engagement_company->27. model.hubspot.hubspot__engagements 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp->89. model.hubspot_source.stg_hubspot__engagement_company 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact->27. model.hubspot.hubspot__engagements 91. model.hubspot_source.stg_hubspot__engagement_contact->33. model.hubspot.int_hubspot__engagement_metrics__by_contact 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp->91. model.hubspot_source.stg_hubspot__engagement_contact 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal->8. model.hubspot.hubspot__deals 93. model.hubspot_source.stg_hubspot__engagement_deal->27. model.hubspot.hubspot__engagements 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp->93. model.hubspot_source.stg_hubspot__engagement_deal 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email->23. model.hubspot.hubspot__engagement_emails 96. model.hubspot_source.stg_hubspot__engagement_email_tmp 96. model.hubspot_source.stg_hubspot__engagement_email_tmp 96. model.hubspot_source.stg_hubspot__engagement_email_tmp->95. model.hubspot_source.stg_hubspot__engagement_email 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting->24. model.hubspot.hubspot__engagement_meetings 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp->97. model.hubspot_source.stg_hubspot__engagement_meeting 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note->25. model.hubspot.hubspot__engagement_notes 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp->99. model.hubspot_source.stg_hubspot__engagement_note 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task->26. model.hubspot.hubspot__engagement_tasks 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp->101. model.hubspot_source.stg_hubspot__engagement_task 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp->86. model.hubspot_source.stg_hubspot__engagement 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner->29. model.hubspot.int_hubspot__deals_enhanced 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp->104. model.hubspot_source.stg_hubspot__owner 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property 107. model.hubspot_source.stg_hubspot__property_option 107. model.hubspot_source.stg_hubspot__property_option 108. model.hubspot_source.stg_hubspot__property_option_tmp 108. model.hubspot_source.stg_hubspot__property_option_tmp 108. model.hubspot_source.stg_hubspot__property_option_tmp->107. model.hubspot_source.stg_hubspot__property_option 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp->106. model.hubspot_source.stg_hubspot__property 110. source.hubspot_source.hubspot.company 110. source.hubspot_source.hubspot.company 110. source.hubspot_source.hubspot.company->37. model.hubspot_source.stg_hubspot__company_tmp 111. source.hubspot_source.hubspot.company_property_history 111. source.hubspot_source.hubspot.company_property_history 111. source.hubspot_source.hubspot.company_property_history->36. model.hubspot_source.stg_hubspot__company_property_history_tmp 112. source.hubspot_source.hubspot.contact 112. source.hubspot_source.hubspot.contact 112. source.hubspot_source.hubspot.contact->45. model.hubspot_source.stg_hubspot__contact_tmp 113. source.hubspot_source.hubspot.contact_list 113. source.hubspot_source.hubspot.contact_list 113. source.hubspot_source.hubspot.contact_list->42. model.hubspot_source.stg_hubspot__contact_list_tmp 114. source.hubspot_source.hubspot.contact_list_member 114. source.hubspot_source.hubspot.contact_list_member 114. source.hubspot_source.hubspot.contact_list_member->41. model.hubspot_source.stg_hubspot__contact_list_member_tmp 115. source.hubspot_source.hubspot.contact_property_history 115. source.hubspot_source.hubspot.contact_property_history 115. source.hubspot_source.hubspot.contact_property_history->44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 116. source.hubspot_source.hubspot.deal 116. source.hubspot_source.hubspot.deal 116. source.hubspot_source.hubspot.deal->59. model.hubspot_source.stg_hubspot__deal_tmp 117. source.hubspot_source.hubspot.deal_company 117. source.hubspot_source.hubspot.deal_company 117. source.hubspot_source.hubspot.deal_company->48. model.hubspot_source.stg_hubspot__deal_company_tmp 118. source.hubspot_source.hubspot.deal_contact 118. source.hubspot_source.hubspot.deal_contact 118. source.hubspot_source.hubspot.deal_contact->50. model.hubspot_source.stg_hubspot__deal_contact_tmp 119. source.hubspot_source.hubspot.deal_pipeline 119. source.hubspot_source.hubspot.deal_pipeline 119. source.hubspot_source.hubspot.deal_pipeline->54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 120. source.hubspot_source.hubspot.deal_pipeline_stage 120. source.hubspot_source.hubspot.deal_pipeline_stage 120. source.hubspot_source.hubspot.deal_pipeline_stage->53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 121. source.hubspot_source.hubspot.deal_property_history 121. source.hubspot_source.hubspot.deal_property_history 121. source.hubspot_source.hubspot.deal_property_history->56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 122. source.hubspot_source.hubspot.deal_stage 122. source.hubspot_source.hubspot.deal_stage 122. source.hubspot_source.hubspot.deal_stage->58. model.hubspot_source.stg_hubspot__deal_stage_tmp 123. source.hubspot_source.hubspot.email_campaign 123. source.hubspot_source.hubspot.email_campaign 123. source.hubspot_source.hubspot.email_campaign->61. model.hubspot_source.stg_hubspot__email_campaign_tmp 124. source.hubspot_source.hubspot.email_event 124. source.hubspot_source.hubspot.email_event 124. source.hubspot_source.hubspot.email_event->85. model.hubspot_source.stg_hubspot__email_event_tmp 125. source.hubspot_source.hubspot.email_event_bounce 125. source.hubspot_source.hubspot.email_event_bounce 125. source.hubspot_source.hubspot.email_event_bounce->64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 126. source.hubspot_source.hubspot.email_event_click 126. source.hubspot_source.hubspot.email_event_click 126. source.hubspot_source.hubspot.email_event_click->66. model.hubspot_source.stg_hubspot__email_event_click_tmp 127. source.hubspot_source.hubspot.email_event_deferred 127. source.hubspot_source.hubspot.email_event_deferred 127. source.hubspot_source.hubspot.email_event_deferred->68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp 128. source.hubspot_source.hubspot.email_event_delivered 128. source.hubspot_source.hubspot.email_event_delivered 128. source.hubspot_source.hubspot.email_event_delivered->70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp 129. source.hubspot_source.hubspot.email_event_dropped 129. source.hubspot_source.hubspot.email_event_dropped 129. source.hubspot_source.hubspot.email_event_dropped->72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 130. source.hubspot_source.hubspot.email_event_forward 130. source.hubspot_source.hubspot.email_event_forward 130. source.hubspot_source.hubspot.email_event_forward->74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 131. source.hubspot_source.hubspot.email_event_open 131. source.hubspot_source.hubspot.email_event_open 131. source.hubspot_source.hubspot.email_event_open->76. model.hubspot_source.stg_hubspot__email_event_open_tmp 132. source.hubspot_source.hubspot.email_event_print 132. source.hubspot_source.hubspot.email_event_print 132. source.hubspot_source.hubspot.email_event_print->78. model.hubspot_source.stg_hubspot__email_event_print_tmp 133. source.hubspot_source.hubspot.email_event_sent 133. source.hubspot_source.hubspot.email_event_sent 133. source.hubspot_source.hubspot.email_event_sent->80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 134. source.hubspot_source.hubspot.email_event_spam_report 134. source.hubspot_source.hubspot.email_event_spam_report 134. source.hubspot_source.hubspot.email_event_spam_report->82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp 135. source.hubspot_source.hubspot.email_event_status_change 135. source.hubspot_source.hubspot.email_event_status_change 135. source.hubspot_source.hubspot.email_event_status_change->84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 136. source.hubspot_source.hubspot.engagement 136. source.hubspot_source.hubspot.engagement 136. source.hubspot_source.hubspot.engagement->103. model.hubspot_source.stg_hubspot__engagement_tmp 137. source.hubspot_source.hubspot.engagement_call 137. source.hubspot_source.hubspot.engagement_call 137. source.hubspot_source.hubspot.engagement_call->88. model.hubspot_source.stg_hubspot__engagement_call_tmp 138. source.hubspot_source.hubspot.engagement_company 138. source.hubspot_source.hubspot.engagement_company 138. source.hubspot_source.hubspot.engagement_company->90. model.hubspot_source.stg_hubspot__engagement_company_tmp 139. source.hubspot_source.hubspot.engagement_contact 139. source.hubspot_source.hubspot.engagement_contact 139. source.hubspot_source.hubspot.engagement_contact->92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 140. source.hubspot_source.hubspot.engagement_deal 140. source.hubspot_source.hubspot.engagement_deal 140. source.hubspot_source.hubspot.engagement_deal->94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 141. source.hubspot_source.hubspot.engagement_email 141. source.hubspot_source.hubspot.engagement_email 141. source.hubspot_source.hubspot.engagement_email->96. model.hubspot_source.stg_hubspot__engagement_email_tmp 142. source.hubspot_source.hubspot.engagement_meeting 142. source.hubspot_source.hubspot.engagement_meeting 142. source.hubspot_source.hubspot.engagement_meeting->98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 143. source.hubspot_source.hubspot.engagement_note 143. source.hubspot_source.hubspot.engagement_note 143. source.hubspot_source.hubspot.engagement_note->100. model.hubspot_source.stg_hubspot__engagement_note_tmp 144. source.hubspot_source.hubspot.engagement_task 144. source.hubspot_source.hubspot.engagement_task 144. source.hubspot_source.hubspot.engagement_task->102. model.hubspot_source.stg_hubspot__engagement_task_tmp 145. source.hubspot_source.hubspot.owner 145. source.hubspot_source.hubspot.owner 145. source.hubspot_source.hubspot.owner->105. model.hubspot_source.stg_hubspot__owner_tmp 146. source.hubspot_source.hubspot.property 146. source.hubspot_source.hubspot.property 146. source.hubspot_source.hubspot.property->109. model.hubspot_source.stg_hubspot__property_tmp 147. source.hubspot_source.hubspot.property_option 147. source.hubspot_source.hubspot.property_option 147. source.hubspot_source.hubspot.property_option->108. model.hubspot_source.stg_hubspot__property_option_tmp
1. model.hubspot.hubspot__companies

This SQL query integrates company data with engagement data from HubSpot. It counts different types of engagements (notes, tasks, calls, meetings, emails) for each company and joins this aggregated engagement data with the main company information. The result is a comprehensive view of each company with their details and engagement metrics.

IntegrationAggregationFeaturization
SQL Query
WITH companies AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__company
), engagements AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.hubspot__engagements
), engagement_companies AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_company
), engagement_companies_joined AS (
  SELECT
    engagements.engagement_type,
    engagement_companies.company_id
  FROM engagements
  INNER JOIN engagement_companies
    USING (engagement_id)
), engagement_companies_agg AS (
  SELECT
    company_id,
    COUNT(CASE WHEN engagement_type = 'NOTE' THEN company_id END) AS count_engagement_notes,
    COUNT(CASE WHEN engagement_type = 'TASK' THEN company_id END) AS count_engagement_tasks,
    COUNT(CASE WHEN engagement_type = 'CALL' THEN company_id END) AS count_engagement_calls,
    COUNT(CASE WHEN engagement_type = 'MEETING' THEN company_id END) AS count_engagement_meetings,
    COUNT(CASE WHEN engagement_type = 'EMAIL' THEN company_id END) AS count_engagement_emails,
    COUNT(CASE WHEN engagement_type = 'INCOMING_EMAIL' THEN company_id END) AS count_engagement_incoming_emails,
    COUNT(CASE WHEN engagement_type = 'FORWARDED_EMAIL' THEN company_id END) AS count_engagement_forwarded_emails
  FROM engagement_companies_joined
  GROUP BY
    1
), joined AS (
  SELECT
    companies.*,
    COALESCE(engagement_companies_agg.count_engagement_notes, 0) AS count_engagement_notes,
    COALESCE(engagement_companies_agg.count_engagement_tasks, 0) AS count_engagement_tasks,
    COALESCE(engagement_companies_agg.count_engagement_calls, 0) AS count_engagement_calls,
    COALESCE(engagement_companies_agg.count_engagement_meetings, 0) AS count_engagement_meetings,
    COALESCE(engagement_companies_agg.count_engagement_emails, 0) AS count_engagement_emails,
    COALESCE(engagement_companies_agg.count_engagement_incoming_emails, 0) AS count_engagement_incoming_emails,
    COALESCE(engagement_companies_agg.count_engagement_forwarded_emails, 0) AS count_engagement_forwarded_emails
  FROM companies
  LEFT JOIN engagement_companies_agg
    USING (company_id)
)
SELECT
  *
FROM joined
%3 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies company_id portal_id is_company_deleted count_engagement_notes count_engagement_tasks count_engagement_calls count_engagement_meetings count_engagement_emails count_engagement_incoming_emails count_engagement_forwarded_emails _fivetran_synced company_name description created_date industry street_address street_address_2 city state country company_annual_revenue 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_id engagement_type company_ids 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f3 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f8 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f9 27. model.hubspot.hubspot__engagements:f2->1. model.hubspot.hubspot__companies:f0 27. model.hubspot.hubspot__engagements:f2->1. model.hubspot.hubspot__companies:f3 27. model.hubspot.hubspot__engagements:f2->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f2->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f2->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f2->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f2->1. model.hubspot.hubspot__companies:f8 27. model.hubspot.hubspot__engagements:f2->1. model.hubspot.hubspot__companies:f9 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company _fivetran_synced is_company_deleted company_id company_name description created_date industry street_address street_address_2 city state country company_annual_revenue 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f10 34. model.hubspot_source.stg_hubspot__company:f1->1. model.hubspot.hubspot__companies:f2 34. model.hubspot_source.stg_hubspot__company:f2->1. model.hubspot.hubspot__companies:f0 34. model.hubspot_source.stg_hubspot__company:f3->1. model.hubspot.hubspot__companies:f11 34. model.hubspot_source.stg_hubspot__company:f4->1. model.hubspot.hubspot__companies:f12 34. model.hubspot_source.stg_hubspot__company:f5->1. model.hubspot.hubspot__companies:f13 34. model.hubspot_source.stg_hubspot__company:f6->1. model.hubspot.hubspot__companies:f14 34. model.hubspot_source.stg_hubspot__company:f7->1. model.hubspot.hubspot__companies:f15 34. model.hubspot_source.stg_hubspot__company:f8->1. model.hubspot.hubspot__companies:f16 34. model.hubspot_source.stg_hubspot__company:f9->1. model.hubspot.hubspot__companies:f17 34. model.hubspot_source.stg_hubspot__company:f10->1. model.hubspot.hubspot__companies:f18 34. model.hubspot_source.stg_hubspot__company:f11->1. model.hubspot.hubspot__companies:f19 34. model.hubspot_source.stg_hubspot__company:f12->1. model.hubspot.hubspot__companies:f20 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company company_id engagement_id engagement_type 89. model.hubspot_source.stg_hubspot__engagement_company:f0->1. model.hubspot.hubspot__companies:f0 89. model.hubspot_source.stg_hubspot__engagement_company:f2->1. model.hubspot.hubspot__companies:f3 89. model.hubspot_source.stg_hubspot__engagement_company:f2->1. model.hubspot.hubspot__companies:f4 89. model.hubspot_source.stg_hubspot__engagement_company:f2->1. model.hubspot.hubspot__companies:f5 89. model.hubspot_source.stg_hubspot__engagement_company:f2->1. model.hubspot.hubspot__companies:f6 89. model.hubspot_source.stg_hubspot__engagement_company:f2->1. model.hubspot.hubspot__companies:f7 89. model.hubspot_source.stg_hubspot__engagement_company:f2->1. model.hubspot.hubspot__companies:f8 89. model.hubspot_source.stg_hubspot__engagement_company:f2->1. model.hubspot.hubspot__companies:f9
Name Type Comment
company_id bigint The ID of the company.
portal_id None The hub ID.
is_company_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
count_engagement_notes bigint The total number of related note engagements.
count_engagement_tasks bigint The total number of related task engagements.
count_engagement_calls bigint The total number of related call engagements.
count_engagement_meetings bigint The total number of related meeting engagements.
count_engagement_emails bigint The total number of related email engagements.
count_engagement_incoming_emails bigint The total number of related incoming email engagements.
count_engagement_forwarded_emails bigint The total number of related forwarded email engagements.
_fivetran_synced timestamp without time zone None
company_name text None
description text None
created_date timestamp without time zone None
industry text None
street_address text None
street_address_2 text None
city text None
state text None
country text None
company_annual_revenue integer None
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements company_ids 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies company_id count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f0 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f2 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company company_id 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company company_id 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 89. model.hubspot_source.stg_hubspot__engagement_company:f0->1. model.hubspot.hubspot__companies:f0 37. model.hubspot_source.stg_hubspot__company_tmp 37. model.hubspot_source.stg_hubspot__company_tmp id 37. model.hubspot_source.stg_hubspot__company_tmp:f0->34. model.hubspot_source.stg_hubspot__company:f0 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp company_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[company_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • company_ids: The company_id is aggregated into the company_ids array in the output
34. model.hubspot_source.stg_hubspot__company
  • Input Column: 37. model.hubspot_source.stg_hubspot__company_tmp[id]
    • Cleaning The column is cleaned by casting it to INT type
    • Integration The column is likely used as the primary key for the company record
    • Output Columns:
      • company_id: The 'id' column is directly mapped to 'company_id' after casting to INT
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly copied to the output column
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Integration This column is indirectly used through the join between engagements and engagement_companies tables using the engagement_id.
    • Aggregation The company_id (derived from this list) is used to group engagements by company.
    • Output Columns:
      • company_id: The company_id is used to link engagements to companies and is ultimately mapped to the company_id in the final output.
      • count_engagement_notes: Aggregated count based on this column and engagement_type.
      • count_engagement_tasks: Aggregated count based on this column and engagement_type.
      • count_engagement_calls: Aggregated count based on this column and engagement_type.
      • count_engagement_meetings: Aggregated count based on this column and engagement_type.
      • count_engagement_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_incoming_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_forwarded_emails: Aggregated count based on this column and engagement_type.
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[company_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as the key to join the companies table with the engagement_companies_agg CTE
    • Output Columns:
      • company_id: Directly copied to the output
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[company_id]
    • Integration Used as a key to join tables
    • Aggregation Used as the grouping key for aggregating engagement counts
    • Output Columns:
      • company_id: Directly copied to the output
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company is_company_deleted 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies is_company_deleted 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0 37. model.hubspot_source.stg_hubspot__company_tmp 37. model.hubspot_source.stg_hubspot__company_tmp is_deleted 37. model.hubspot_source.stg_hubspot__company_tmp:f0->34. model.hubspot_source.stg_hubspot__company:f0
34. model.hubspot_source.stg_hubspot__company
  • Input Column: 37. model.hubspot_source.stg_hubspot__company_tmp[is_deleted]
    • Cleaning The column is cleaned by casting it to BOOLEAN type
    • Output Columns:
      • is_company_deleted: The 'is_deleted' column is directly mapped to 'is_company_deleted' after casting to BOOLEAN
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[is_company_deleted]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_company_deleted: Directly copied to the output
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements company_ids engagement_type 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies company_id count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f2 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f3 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f0 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f2 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f3 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company company_id engagement_type 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f6 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f7 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f1 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f5 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f2 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f4 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f1 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp company_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly copied to the output column
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[company_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • company_ids: The company_id is aggregated into the company_ids array in the output
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Featurization Used to create separate counts for each engagement type
    • Output Columns:
      • count_engagement_notes: Counted when engagement_type = 'NOTE'
      • count_engagement_tasks: Counted when engagement_type = 'TASK'
      • count_engagement_calls: Counted when engagement_type = 'CALL'
      • count_engagement_meetings: Counted when engagement_type = 'MEETING'
      • count_engagement_emails: Counted when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Counted when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Counted when engagement_type = 'FORWARDED_EMAIL'
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Integration This column is indirectly used through the join between engagements and engagement_companies tables using the engagement_id.
    • Aggregation The company_id (derived from this list) is used to group engagements by company.
    • Output Columns:
      • company_id: The company_id is used to link engagements to companies and is ultimately mapped to the company_id in the final output.
      • count_engagement_notes: Aggregated count based on this column and engagement_type.
      • count_engagement_tasks: Aggregated count based on this column and engagement_type.
      • count_engagement_calls: Aggregated count based on this column and engagement_type.
      • count_engagement_meetings: Aggregated count based on this column and engagement_type.
      • count_engagement_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_incoming_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_forwarded_emails: Aggregated count based on this column and engagement_type.
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[engagement_type]
    • Featurization Used to categorize different types of engagements
    • Aggregation Used in CASE statements to count different engagement types
    • Output Columns:
      • count_engagement_notes: Aggregated count when engagement_type = 'NOTE'
      • count_engagement_tasks: Aggregated count when engagement_type = 'TASK'
      • count_engagement_calls: Aggregated count when engagement_type = 'CALL'
      • count_engagement_meetings: Aggregated count when engagement_type = 'MEETING'
      • count_engagement_emails: Aggregated count when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count when engagement_type = 'FORWARDED_EMAIL'
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements company_ids engagement_type 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies company_id count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f2 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f3 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f0 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f2 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f3 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company company_id engagement_type 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f6 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f7 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f1 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f5 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f2 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f4 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f1 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp company_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly copied to the output column
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[company_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • company_ids: The company_id is aggregated into the company_ids array in the output
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Featurization Used to create separate counts for each engagement type
    • Output Columns:
      • count_engagement_notes: Counted when engagement_type = 'NOTE'
      • count_engagement_tasks: Counted when engagement_type = 'TASK'
      • count_engagement_calls: Counted when engagement_type = 'CALL'
      • count_engagement_meetings: Counted when engagement_type = 'MEETING'
      • count_engagement_emails: Counted when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Counted when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Counted when engagement_type = 'FORWARDED_EMAIL'
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Integration This column is indirectly used through the join between engagements and engagement_companies tables using the engagement_id.
    • Aggregation The company_id (derived from this list) is used to group engagements by company.
    • Output Columns:
      • company_id: The company_id is used to link engagements to companies and is ultimately mapped to the company_id in the final output.
      • count_engagement_notes: Aggregated count based on this column and engagement_type.
      • count_engagement_tasks: Aggregated count based on this column and engagement_type.
      • count_engagement_calls: Aggregated count based on this column and engagement_type.
      • count_engagement_meetings: Aggregated count based on this column and engagement_type.
      • count_engagement_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_incoming_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_forwarded_emails: Aggregated count based on this column and engagement_type.
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[engagement_type]
    • Featurization Used to categorize different types of engagements
    • Aggregation Used in CASE statements to count different engagement types
    • Output Columns:
      • count_engagement_notes: Aggregated count when engagement_type = 'NOTE'
      • count_engagement_tasks: Aggregated count when engagement_type = 'TASK'
      • count_engagement_calls: Aggregated count when engagement_type = 'CALL'
      • count_engagement_meetings: Aggregated count when engagement_type = 'MEETING'
      • count_engagement_emails: Aggregated count when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count when engagement_type = 'FORWARDED_EMAIL'
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements company_ids engagement_type 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies company_id count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f2 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f3 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f0 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f2 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f3 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company company_id engagement_type 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f6 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f7 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f1 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f5 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f2 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f4 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f1 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp company_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly copied to the output column
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[company_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • company_ids: The company_id is aggregated into the company_ids array in the output
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Featurization Used to create separate counts for each engagement type
    • Output Columns:
      • count_engagement_notes: Counted when engagement_type = 'NOTE'
      • count_engagement_tasks: Counted when engagement_type = 'TASK'
      • count_engagement_calls: Counted when engagement_type = 'CALL'
      • count_engagement_meetings: Counted when engagement_type = 'MEETING'
      • count_engagement_emails: Counted when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Counted when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Counted when engagement_type = 'FORWARDED_EMAIL'
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Integration This column is indirectly used through the join between engagements and engagement_companies tables using the engagement_id.
    • Aggregation The company_id (derived from this list) is used to group engagements by company.
    • Output Columns:
      • company_id: The company_id is used to link engagements to companies and is ultimately mapped to the company_id in the final output.
      • count_engagement_notes: Aggregated count based on this column and engagement_type.
      • count_engagement_tasks: Aggregated count based on this column and engagement_type.
      • count_engagement_calls: Aggregated count based on this column and engagement_type.
      • count_engagement_meetings: Aggregated count based on this column and engagement_type.
      • count_engagement_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_incoming_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_forwarded_emails: Aggregated count based on this column and engagement_type.
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[engagement_type]
    • Featurization Used to categorize different types of engagements
    • Aggregation Used in CASE statements to count different engagement types
    • Output Columns:
      • count_engagement_notes: Aggregated count when engagement_type = 'NOTE'
      • count_engagement_tasks: Aggregated count when engagement_type = 'TASK'
      • count_engagement_calls: Aggregated count when engagement_type = 'CALL'
      • count_engagement_meetings: Aggregated count when engagement_type = 'MEETING'
      • count_engagement_emails: Aggregated count when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count when engagement_type = 'FORWARDED_EMAIL'
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements company_ids engagement_type 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies company_id count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f2 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f3 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f0 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f2 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f3 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company company_id engagement_type 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f6 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f7 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f1 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f5 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f2 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f4 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f1 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp company_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly copied to the output column
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[company_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • company_ids: The company_id is aggregated into the company_ids array in the output
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Featurization Used to create separate counts for each engagement type
    • Output Columns:
      • count_engagement_notes: Counted when engagement_type = 'NOTE'
      • count_engagement_tasks: Counted when engagement_type = 'TASK'
      • count_engagement_calls: Counted when engagement_type = 'CALL'
      • count_engagement_meetings: Counted when engagement_type = 'MEETING'
      • count_engagement_emails: Counted when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Counted when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Counted when engagement_type = 'FORWARDED_EMAIL'
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Integration This column is indirectly used through the join between engagements and engagement_companies tables using the engagement_id.
    • Aggregation The company_id (derived from this list) is used to group engagements by company.
    • Output Columns:
      • company_id: The company_id is used to link engagements to companies and is ultimately mapped to the company_id in the final output.
      • count_engagement_notes: Aggregated count based on this column and engagement_type.
      • count_engagement_tasks: Aggregated count based on this column and engagement_type.
      • count_engagement_calls: Aggregated count based on this column and engagement_type.
      • count_engagement_meetings: Aggregated count based on this column and engagement_type.
      • count_engagement_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_incoming_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_forwarded_emails: Aggregated count based on this column and engagement_type.
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[engagement_type]
    • Featurization Used to categorize different types of engagements
    • Aggregation Used in CASE statements to count different engagement types
    • Output Columns:
      • count_engagement_notes: Aggregated count when engagement_type = 'NOTE'
      • count_engagement_tasks: Aggregated count when engagement_type = 'TASK'
      • count_engagement_calls: Aggregated count when engagement_type = 'CALL'
      • count_engagement_meetings: Aggregated count when engagement_type = 'MEETING'
      • count_engagement_emails: Aggregated count when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count when engagement_type = 'FORWARDED_EMAIL'
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements company_ids engagement_type 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies company_id count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f2 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f3 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f0 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f2 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f3 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company company_id engagement_type 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f6 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f7 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f1 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f5 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f2 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f4 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f1 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp company_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly copied to the output column
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[company_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • company_ids: The company_id is aggregated into the company_ids array in the output
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Featurization Used to create separate counts for each engagement type
    • Output Columns:
      • count_engagement_notes: Counted when engagement_type = 'NOTE'
      • count_engagement_tasks: Counted when engagement_type = 'TASK'
      • count_engagement_calls: Counted when engagement_type = 'CALL'
      • count_engagement_meetings: Counted when engagement_type = 'MEETING'
      • count_engagement_emails: Counted when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Counted when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Counted when engagement_type = 'FORWARDED_EMAIL'
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Integration This column is indirectly used through the join between engagements and engagement_companies tables using the engagement_id.
    • Aggregation The company_id (derived from this list) is used to group engagements by company.
    • Output Columns:
      • company_id: The company_id is used to link engagements to companies and is ultimately mapped to the company_id in the final output.
      • count_engagement_notes: Aggregated count based on this column and engagement_type.
      • count_engagement_tasks: Aggregated count based on this column and engagement_type.
      • count_engagement_calls: Aggregated count based on this column and engagement_type.
      • count_engagement_meetings: Aggregated count based on this column and engagement_type.
      • count_engagement_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_incoming_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_forwarded_emails: Aggregated count based on this column and engagement_type.
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[engagement_type]
    • Featurization Used to categorize different types of engagements
    • Aggregation Used in CASE statements to count different engagement types
    • Output Columns:
      • count_engagement_notes: Aggregated count when engagement_type = 'NOTE'
      • count_engagement_tasks: Aggregated count when engagement_type = 'TASK'
      • count_engagement_calls: Aggregated count when engagement_type = 'CALL'
      • count_engagement_meetings: Aggregated count when engagement_type = 'MEETING'
      • count_engagement_emails: Aggregated count when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count when engagement_type = 'FORWARDED_EMAIL'
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements company_ids engagement_type 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies company_id count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f2 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f3 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f0 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f2 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f3 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company company_id engagement_type 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f6 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f7 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f1 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f5 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f2 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f4 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f1 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp company_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly copied to the output column
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[company_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • company_ids: The company_id is aggregated into the company_ids array in the output
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Featurization Used to create separate counts for each engagement type
    • Output Columns:
      • count_engagement_notes: Counted when engagement_type = 'NOTE'
      • count_engagement_tasks: Counted when engagement_type = 'TASK'
      • count_engagement_calls: Counted when engagement_type = 'CALL'
      • count_engagement_meetings: Counted when engagement_type = 'MEETING'
      • count_engagement_emails: Counted when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Counted when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Counted when engagement_type = 'FORWARDED_EMAIL'
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Integration This column is indirectly used through the join between engagements and engagement_companies tables using the engagement_id.
    • Aggregation The company_id (derived from this list) is used to group engagements by company.
    • Output Columns:
      • company_id: The company_id is used to link engagements to companies and is ultimately mapped to the company_id in the final output.
      • count_engagement_notes: Aggregated count based on this column and engagement_type.
      • count_engagement_tasks: Aggregated count based on this column and engagement_type.
      • count_engagement_calls: Aggregated count based on this column and engagement_type.
      • count_engagement_meetings: Aggregated count based on this column and engagement_type.
      • count_engagement_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_incoming_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_forwarded_emails: Aggregated count based on this column and engagement_type.
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[engagement_type]
    • Featurization Used to categorize different types of engagements
    • Aggregation Used in CASE statements to count different engagement types
    • Output Columns:
      • count_engagement_notes: Aggregated count when engagement_type = 'NOTE'
      • count_engagement_tasks: Aggregated count when engagement_type = 'TASK'
      • count_engagement_calls: Aggregated count when engagement_type = 'CALL'
      • count_engagement_meetings: Aggregated count when engagement_type = 'MEETING'
      • count_engagement_emails: Aggregated count when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count when engagement_type = 'FORWARDED_EMAIL'
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements company_ids engagement_type 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies company_id count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f2 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f1->1. model.hubspot.hubspot__companies:f3 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f0 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f2 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f3 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company company_id engagement_type 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f6 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f7 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f1 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f5 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f2 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f4 89. model.hubspot_source.stg_hubspot__engagement_company:f1->1. model.hubspot.hubspot__companies:f3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f1 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp company_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly copied to the output column
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[company_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • company_ids: The company_id is aggregated into the company_ids array in the output
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Featurization Used to create separate counts for each engagement type
    • Output Columns:
      • count_engagement_notes: Counted when engagement_type = 'NOTE'
      • count_engagement_tasks: Counted when engagement_type = 'TASK'
      • count_engagement_calls: Counted when engagement_type = 'CALL'
      • count_engagement_meetings: Counted when engagement_type = 'MEETING'
      • count_engagement_emails: Counted when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Counted when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Counted when engagement_type = 'FORWARDED_EMAIL'
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Integration This column is indirectly used through the join between engagements and engagement_companies tables using the engagement_id.
    • Aggregation The company_id (derived from this list) is used to group engagements by company.
    • Output Columns:
      • company_id: The company_id is used to link engagements to companies and is ultimately mapped to the company_id in the final output.
      • count_engagement_notes: Aggregated count based on this column and engagement_type.
      • count_engagement_tasks: Aggregated count based on this column and engagement_type.
      • count_engagement_calls: Aggregated count based on this column and engagement_type.
      • count_engagement_meetings: Aggregated count based on this column and engagement_type.
      • count_engagement_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_incoming_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_forwarded_emails: Aggregated count based on this column and engagement_type.
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[engagement_type]
    • Featurization Used to categorize different types of engagements
    • Aggregation Used in CASE statements to count different engagement types
    • Output Columns:
      • count_engagement_notes: Aggregated count when engagement_type = 'NOTE'
      • count_engagement_tasks: Aggregated count when engagement_type = 'TASK'
      • count_engagement_calls: Aggregated count when engagement_type = 'CALL'
      • count_engagement_meetings: Aggregated count when engagement_type = 'MEETING'
      • count_engagement_emails: Aggregated count when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count when engagement_type = 'FORWARDED_EMAIL'
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company _fivetran_synced 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies _fivetran_synced 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company company_name 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies company_name 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[company_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • company_name: Directly copied to the output
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company description 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies description 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[description]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • description: Directly copied to the output
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company created_date 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies created_date 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[created_date]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_date: Directly copied to the output
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company industry 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies industry 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[industry]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • industry: Directly copied to the output
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company street_address 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies street_address 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[street_address]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • street_address: Directly copied to the output
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company street_address_2 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies street_address_2 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[street_address_2]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • street_address_2: Directly copied to the output
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company city 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies city 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[city]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • city: Directly copied to the output
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company state 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies state 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[state]
    • Direct The state column is directly copied without any transformation
    • Output Columns:
      • state: It is directly mapped to the output 'state' column
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company country 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies country 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[country]
    • Direct The country column is directly copied without any transformation
    • Output Columns:
      • country: It is directly mapped to the output 'country' column
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company company_annual_revenue 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies company_annual_revenue 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[company_annual_revenue]
    • Direct The company_annual_revenue column is directly copied without any transformation
    • Output Columns:
      • company_annual_revenue: It is directly mapped to the output 'company_annual_revenue' column
2. model.hubspot.hubspot__company_history

This SQL query processes company property history data to create a timeline of changes for each company and property. It establishes valid time ranges for each property value, generates a surrogate key for each record, and prepares the data for historical analysis.

FeaturizationOther
SQL Query
WITH history AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__company_property_history
), windows AS (
  SELECT
    company_id,
    field_name,
    change_source,
    change_source_id,
    change_timestamp AS valid_from,
    new_value,
    LEAD(change_timestamp) OVER (PARTITION BY company_id, field_name ORDER BY change_timestamp) AS valid_to
  FROM history
), surrogate AS (
  SELECT
    windows.*,
    MD5(
      CAST(COALESCE(CAST(field_name AS TEXT), '_dbt_utils_surrogate_key_null_') || '-' || COALESCE(CAST(company_id AS TEXT), '_dbt_utils_surrogate_key_null_') || '-' || COALESCE(CAST(valid_from AS TEXT), '_dbt_utils_surrogate_key_null_') AS TEXT)
    ) AS id
  FROM windows
)
SELECT
  *
FROM surrogate
%3 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history _fivetran_synced change_source change_source_id valid_from valid_to company_id field_name new_value id 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history change_source change_source_id change_timestamp company_id field_name new_value 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f1 35. model.hubspot_source.stg_hubspot__company_property_history:f1->2. model.hubspot.hubspot__company_history:f2 35. model.hubspot_source.stg_hubspot__company_property_history:f2->2. model.hubspot.hubspot__company_history:f3 35. model.hubspot_source.stg_hubspot__company_property_history:f2->2. model.hubspot.hubspot__company_history:f4 35. model.hubspot_source.stg_hubspot__company_property_history:f3->2. model.hubspot.hubspot__company_history:f5 35. model.hubspot_source.stg_hubspot__company_property_history:f3->2. model.hubspot.hubspot__company_history:f8 35. model.hubspot_source.stg_hubspot__company_property_history:f4->2. model.hubspot.hubspot__company_history:f6 35. model.hubspot_source.stg_hubspot__company_property_history:f4->2. model.hubspot.hubspot__company_history:f8 35. model.hubspot_source.stg_hubspot__company_property_history:f5->2. model.hubspot.hubspot__company_history:f7
Name Type Comment
_fivetran_synced None Timestamp of when Fivetran synced a record.
change_source text The source (reason) of the change.
change_source_id integer The ID of the object that caused the change, if applicable.
valid_from timestamp without time zone The timestamp the change was valid from.
valid_to timestamp without time zone The timestamp the change was valid to. Null if still valid.
company_id bigint The ID of the related company record.
field_name text The name of the field being changed.
new_value text The new value of the field.
id text The ID of the change.
Column Lineage
%3 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history change_source 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history change_source 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp source 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source: Renamed to change_source in the output
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[change_source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source: Directly copied to the output
Column Lineage
%3 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history change_source_id 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history change_source_id 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp source_id 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[source_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source_id: Renamed to change_source_id in the output
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[change_source_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source_id: Directly copied to the output
Column Lineage
%3 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history change_timestamp 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history valid_from valid_to 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f1 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp timestamp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[timestamp]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • change_timestamp: Cast as TIMESTAMP and renamed
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[change_timestamp]
    • Direct The column is directly copied as valid_from
    • Other Used in LEAD function to calculate valid_to
    • Deduplication Used in window function to order changes
    • Output Columns:
      • valid_from: Directly mapped to change_timestamp
      • valid_to: Indirectly used to calculate the next change timestamp
Column Lineage
%3 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history change_timestamp 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history valid_from valid_to 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f1 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp timestamp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[timestamp]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • change_timestamp: Cast as TIMESTAMP and renamed
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[change_timestamp]
    • Direct The column is directly copied as valid_from
    • Other Used in LEAD function to calculate valid_to
    • Deduplication Used in window function to order changes
    • Output Columns:
      • valid_from: Directly mapped to change_timestamp
      • valid_to: Indirectly used to calculate the next change timestamp
Column Lineage
%3 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history company_id 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history company_id id 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f1 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp company_id 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly mapped to the output column
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[company_id]
    • Direct The column is directly copied without any transformation
    • Deduplication Used in window function to partition changes by company
    • Other Used in surrogate key generation
    • Output Columns:
      • company_id: Directly copied to the output
      • id: Part of the surrogate key generation
Column Lineage
%3 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history field_name 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history field_name id 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f1 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp name 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • field_name: Renamed to field_name in the output
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[field_name]
    • Direct The column is directly copied without any transformation
    • Deduplication Used in window function to partition changes by field
    • Other Used in surrogate key generation
    • Output Columns:
      • field_name: Directly copied to the output
      • id: Part of the surrogate key generation
Column Lineage
%3 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history new_value 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history new_value 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp value 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[value]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • new_value: Renamed to new_value in the output
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[new_value]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • new_value: Directly copied to the output
Column Lineage
%3 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history company_id field_name 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history company_id field_name id 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f2 35. model.hubspot_source.stg_hubspot__company_property_history:f1->2. model.hubspot.hubspot__company_history:f1 35. model.hubspot_source.stg_hubspot__company_property_history:f1->2. model.hubspot.hubspot__company_history:f2 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp company_id name 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f1->35. model.hubspot_source.stg_hubspot__company_property_history:f1
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly mapped to the output column
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • field_name: Renamed to field_name in the output
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[company_id]
    • Direct The column is directly copied without any transformation
    • Deduplication Used in window function to partition changes by company
    • Other Used in surrogate key generation
    • Output Columns:
      • company_id: Directly copied to the output
      • id: Part of the surrogate key generation
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[field_name]
    • Direct The column is directly copied without any transformation
    • Deduplication Used in window function to partition changes by field
    • Other Used in surrogate key generation
    • Output Columns:
      • field_name: Directly copied to the output
      • id: Part of the surrogate key generation
3. model.hubspot.hubspot__contact_history

This SQL query processes contact property history data from Hubspot. It creates a timeline of changes for each contact's properties, including the source of the change and the time period for which each value was valid. The query also generates a unique identifier for each record using a hash function.

FeaturizationOther
SQL Query
WITH history AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__contact_property_history
), windows AS (
  SELECT
    contact_id,
    field_name,
    change_source,
    change_source_id,
    change_timestamp AS valid_from,
    new_value,
    LEAD(change_timestamp) OVER (PARTITION BY contact_id, field_name ORDER BY change_timestamp) AS valid_to
  FROM history
), surrogate AS (
  SELECT
    windows.*,
    MD5(
      CAST(COALESCE(CAST(field_name AS TEXT), '_dbt_utils_surrogate_key_null_') || '-' || COALESCE(CAST(contact_id AS TEXT), '_dbt_utils_surrogate_key_null_') || '-' || COALESCE(CAST(valid_from AS TEXT), '_dbt_utils_surrogate_key_null_') AS TEXT)
    ) AS id
  FROM windows
)
SELECT
  *
FROM surrogate
%3 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history _fivetran_synced change_source change_source_id valid_from valid_to contact_id field_name new_value id 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history change_source change_source_id change_timestamp contact_id field_name new_value 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f1 43. model.hubspot_source.stg_hubspot__contact_property_history:f1->3. model.hubspot.hubspot__contact_history:f2 43. model.hubspot_source.stg_hubspot__contact_property_history:f2->3. model.hubspot.hubspot__contact_history:f3 43. model.hubspot_source.stg_hubspot__contact_property_history:f2->3. model.hubspot.hubspot__contact_history:f4 43. model.hubspot_source.stg_hubspot__contact_property_history:f3->3. model.hubspot.hubspot__contact_history:f5 43. model.hubspot_source.stg_hubspot__contact_property_history:f3->3. model.hubspot.hubspot__contact_history:f8 43. model.hubspot_source.stg_hubspot__contact_property_history:f4->3. model.hubspot.hubspot__contact_history:f6 43. model.hubspot_source.stg_hubspot__contact_property_history:f4->3. model.hubspot.hubspot__contact_history:f8 43. model.hubspot_source.stg_hubspot__contact_property_history:f5->3. model.hubspot.hubspot__contact_history:f7
Name Type Comment
_fivetran_synced None Timestamp of when Fivetran synced a record.
change_source text The source (reason) of the change.
change_source_id text The ID of the object that caused the change, if applicable.
valid_from timestamp without time zone The timestamp the change was valid from.
valid_to timestamp without time zone The timestamp the change was valid to. Null if still valid.
contact_id integer The ID of the related contact record.
field_name text The name of the field being changed.
new_value text The new value of the field.
id text The ID of the change.
Column Lineage
%3 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history change_source 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history change_source 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp source 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source: Directly copied and renamed
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[change_source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source: Directly copied
Column Lineage
%3 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history change_source_id 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history change_source_id 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp source_id 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[source_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source_id: Directly copied and renamed
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[change_source_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source_id: Directly copied
Column Lineage
%3 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history change_timestamp 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history valid_from valid_to 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f1 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp timestamp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[timestamp]
    • Cleaning The column is cleaned by casting to TIMESTAMP data type
    • Output Columns:
      • change_timestamp: Casted to TIMESTAMP and renamed
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[change_timestamp]
    • Direct The column is directly copied as valid_from
    • Other Used to calculate the valid_to timestamp for each record
    • Deduplication Used in the PARTITION BY and ORDER BY clauses of the window function
    • Output Columns:
      • valid_from: Directly copied
      • valid_to: Used in LEAD function to calculate the next change timestamp
Column Lineage
%3 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history change_timestamp 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history valid_from valid_to 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f1 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp timestamp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[timestamp]
    • Cleaning The column is cleaned by casting to TIMESTAMP data type
    • Output Columns:
      • change_timestamp: Casted to TIMESTAMP and renamed
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[change_timestamp]
    • Direct The column is directly copied as valid_from
    • Other Used to calculate the valid_to timestamp for each record
    • Deduplication Used in the PARTITION BY and ORDER BY clauses of the window function
    • Output Columns:
      • valid_from: Directly copied
      • valid_to: Used in LEAD function to calculate the next change timestamp
Column Lineage
%3 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history contact_id 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history contact_id id 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f1 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp contact_id 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[contact_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_id: Directly copied
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[contact_id]
    • Direct The column is directly copied without any transformation
    • Deduplication Used in the PARTITION BY clause of the window function
    • Other Used in the surrogate key generation
    • Output Columns:
      • contact_id: Directly copied
      • id: Part of the MD5 hash for the surrogate key
Column Lineage
%3 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history field_name 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history field_name id 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f1 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp name 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • field_name: Directly copied and renamed
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[field_name]
    • Direct The column is directly copied without any transformation
    • Deduplication Used in the PARTITION BY clause of the window function
    • Other Used in the surrogate key generation
    • Output Columns:
      • field_name: Directly copied
      • id: Part of the MD5 hash for the surrogate key
Column Lineage
%3 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history new_value 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history new_value 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp value 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[value]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • new_value: Directly copied and renamed
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[new_value]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • new_value: Directly copied
Column Lineage
%3 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history contact_id field_name 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history contact_id field_name id 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f2 43. model.hubspot_source.stg_hubspot__contact_property_history:f1->3. model.hubspot.hubspot__contact_history:f1 43. model.hubspot_source.stg_hubspot__contact_property_history:f1->3. model.hubspot.hubspot__contact_history:f2 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp contact_id name 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f1->43. model.hubspot_source.stg_hubspot__contact_property_history:f1
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[contact_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_id: Directly copied
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • field_name: Directly copied and renamed
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[contact_id]
    • Direct The column is directly copied without any transformation
    • Deduplication Used in the PARTITION BY clause of the window function
    • Other Used in the surrogate key generation
    • Output Columns:
      • contact_id: Directly copied
      • id: Part of the MD5 hash for the surrogate key
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[field_name]
    • Direct The column is directly copied without any transformation
    • Deduplication Used in the PARTITION BY clause of the window function
    • Other Used in the surrogate key generation
    • Output Columns:
      • field_name: Directly copied
      • id: Part of the MD5 hash for the surrogate key
4. model.hubspot.hubspot__contact_lists

This SQL query integrates data from two tables: contact lists and email metrics. It performs a left join between these tables using the contact_list_id as the joining key. The query selects all columns from the contact_lists table, effectively combining contact list information with associated email metrics data, if available.

Integration
SQL Query
WITH contact_lists AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__contact_list
), email_metrics AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.int_hubspot__email_metrics__by_contact_list
), joined AS (
  SELECT
    contact_lists.*
  FROM contact_lists
  LEFT JOIN email_metrics
    USING (contact_list_id)
)
SELECT
  *
FROM joined
%3 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists _fivetran_synced contact_list_id contact_list_name is_contact_list_deleted created_timestamp is_deletable is_dynamic metadata_error metadata_last_processing_state_change_at metadata_last_size_change_at metadata_processing metadata_size portal_id updated_timestamp total_bounces total_clicks total_deferrals total_deliveries total_drops total_forwards total_opens total_prints total_spam_reports total_unsubscribes total_unique_bounces total_unique_clicks total_unique_deferrals total_unique_deliveries total_unique_drops total_unique_forwards total_unique_opens total_unique_prints total_unique_spam_reports total_unique_unsubscribes 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends bounces clicks deferrals deliveries drops forwards opens prints spam_reports unsubscribes was_bounced was_clicked was_deferred was_delivered was_forwarded was_opened was_printed was_spam_reported was_unsubcribed 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f14 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f24 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f15 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f25 21. model.hubspot.hubspot__email_sends:f2->4. model.hubspot.hubspot__contact_lists:f16 21. model.hubspot.hubspot__email_sends:f2->4. model.hubspot.hubspot__contact_lists:f26 21. model.hubspot.hubspot__email_sends:f3->4. model.hubspot.hubspot__contact_lists:f17 21. model.hubspot.hubspot__email_sends:f3->4. model.hubspot.hubspot__contact_lists:f27 21. model.hubspot.hubspot__email_sends:f4->4. model.hubspot.hubspot__contact_lists:f18 21. model.hubspot.hubspot__email_sends:f4->4. model.hubspot.hubspot__contact_lists:f28 21. model.hubspot.hubspot__email_sends:f5->4. model.hubspot.hubspot__contact_lists:f19 21. model.hubspot.hubspot__email_sends:f5->4. model.hubspot.hubspot__contact_lists:f29 21. model.hubspot.hubspot__email_sends:f6->4. model.hubspot.hubspot__contact_lists:f20 21. model.hubspot.hubspot__email_sends:f6->4. model.hubspot.hubspot__contact_lists:f30 21. model.hubspot.hubspot__email_sends:f7->4. model.hubspot.hubspot__contact_lists:f21 21. model.hubspot.hubspot__email_sends:f7->4. model.hubspot.hubspot__contact_lists:f31 21. model.hubspot.hubspot__email_sends:f8->4. model.hubspot.hubspot__contact_lists:f22 21. model.hubspot.hubspot__email_sends:f8->4. model.hubspot.hubspot__contact_lists:f32 21. model.hubspot.hubspot__email_sends:f9->4. model.hubspot.hubspot__contact_lists:f23 21. model.hubspot.hubspot__email_sends:f9->4. model.hubspot.hubspot__contact_lists:f33 21. model.hubspot.hubspot__email_sends:f10->4. model.hubspot.hubspot__contact_lists:f14 21. model.hubspot.hubspot__email_sends:f10->4. model.hubspot.hubspot__contact_lists:f24 21. model.hubspot.hubspot__email_sends:f11->4. model.hubspot.hubspot__contact_lists:f15 21. model.hubspot.hubspot__email_sends:f11->4. model.hubspot.hubspot__contact_lists:f25 21. model.hubspot.hubspot__email_sends:f12->4. model.hubspot.hubspot__contact_lists:f16 21. model.hubspot.hubspot__email_sends:f12->4. model.hubspot.hubspot__contact_lists:f26 21. model.hubspot.hubspot__email_sends:f13->4. model.hubspot.hubspot__contact_lists:f17 21. model.hubspot.hubspot__email_sends:f13->4. model.hubspot.hubspot__contact_lists:f27 21. model.hubspot.hubspot__email_sends:f14->4. model.hubspot.hubspot__contact_lists:f19 21. model.hubspot.hubspot__email_sends:f14->4. model.hubspot.hubspot__contact_lists:f29 21. model.hubspot.hubspot__email_sends:f15->4. model.hubspot.hubspot__contact_lists:f20 21. model.hubspot.hubspot__email_sends:f15->4. model.hubspot.hubspot__contact_lists:f30 21. model.hubspot.hubspot__email_sends:f16->4. model.hubspot.hubspot__contact_lists:f21 21. model.hubspot.hubspot__email_sends:f16->4. model.hubspot.hubspot__contact_lists:f31 21. model.hubspot.hubspot__email_sends:f17->4. model.hubspot.hubspot__contact_lists:f22 21. model.hubspot.hubspot__email_sends:f17->4. model.hubspot.hubspot__contact_lists:f32 21. model.hubspot.hubspot__email_sends:f18->4. model.hubspot.hubspot__contact_lists:f23 21. model.hubspot.hubspot__email_sends:f18->4. model.hubspot.hubspot__contact_lists:f33 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list contact_list_id total_bounces total_unique_bounces total_clicks total_unique_clicks total_deferrals total_unique_deferrals total_deliveries total_unique_deliveries total_drops total_forwards total_unique_forwards total_opens total_unique_opens total_prints total_unique_prints total_spam_reports total_unique_spam_reports total_unsubscribes 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f14 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f2->4. model.hubspot.hubspot__contact_lists:f24 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f3->4. model.hubspot.hubspot__contact_lists:f15 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f4->4. model.hubspot.hubspot__contact_lists:f25 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f5->4. model.hubspot.hubspot__contact_lists:f16 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f6->4. model.hubspot.hubspot__contact_lists:f26 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f7->4. model.hubspot.hubspot__contact_lists:f17 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f8->4. model.hubspot.hubspot__contact_lists:f27 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f9->4. model.hubspot.hubspot__contact_lists:f18 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f10->4. model.hubspot.hubspot__contact_lists:f19 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f11->4. model.hubspot.hubspot__contact_lists:f29 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f12->4. model.hubspot.hubspot__contact_lists:f20 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f13->4. model.hubspot.hubspot__contact_lists:f30 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f14->4. model.hubspot.hubspot__contact_lists:f21 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f15->4. model.hubspot.hubspot__contact_lists:f31 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f16->4. model.hubspot.hubspot__contact_lists:f22 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f17->4. model.hubspot.hubspot__contact_lists:f32 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f18->4. model.hubspot.hubspot__contact_lists:f23 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list is_contact_list_deleted _fivetran_synced contact_list_id contact_list_name created_timestamp is_deletable is_dynamic metadata_error metadata_last_processing_state_change_at metadata_last_size_change_at metadata_processing metadata_size portal_id updated_timestamp 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f3 39. model.hubspot_source.stg_hubspot__contact_list:f1->4. model.hubspot.hubspot__contact_lists:f0 39. model.hubspot_source.stg_hubspot__contact_list:f2->4. model.hubspot.hubspot__contact_lists:f1 39. model.hubspot_source.stg_hubspot__contact_list:f3->4. model.hubspot.hubspot__contact_lists:f2 39. model.hubspot_source.stg_hubspot__contact_list:f4->4. model.hubspot.hubspot__contact_lists:f4 39. model.hubspot_source.stg_hubspot__contact_list:f5->4. model.hubspot.hubspot__contact_lists:f5 39. model.hubspot_source.stg_hubspot__contact_list:f6->4. model.hubspot.hubspot__contact_lists:f6 39. model.hubspot_source.stg_hubspot__contact_list:f7->4. model.hubspot.hubspot__contact_lists:f7 39. model.hubspot_source.stg_hubspot__contact_list:f8->4. model.hubspot.hubspot__contact_lists:f8 39. model.hubspot_source.stg_hubspot__contact_list:f9->4. model.hubspot.hubspot__contact_lists:f9 39. model.hubspot_source.stg_hubspot__contact_list:f10->4. model.hubspot.hubspot__contact_lists:f10 39. model.hubspot_source.stg_hubspot__contact_list:f11->4. model.hubspot.hubspot__contact_lists:f11 39. model.hubspot_source.stg_hubspot__contact_list:f12->4. model.hubspot.hubspot__contact_lists:f12 39. model.hubspot_source.stg_hubspot__contact_list:f13->4. model.hubspot.hubspot__contact_lists:f13
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
contact_list_id integer The ID of the contact list.
contact_list_name text The name of the contact list.
is_contact_list_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
created_timestamp timestamp without time zone A timestamp of the time the list was created.
is_deletable boolean If this is false, this is a system list and cannot be deleted.
is_dynamic boolean Whether the contact list is dynamic.
metadata_error integer Any errors that happened the last time the list was processed.
metadata_last_processing_state_change_at timestamp without time zone A timestamp of the last time that the processing state changed.
metadata_last_size_change_at timestamp without time zone A timestamp of the last time that the size of the list changed.
metadata_processing text One of DONE, REFRESHING, INITIALIZING, or PROCESSING. DONE indicates the list has finished processing, any other value indicates that list membership is being evaluated.
metadata_size integer The approximate number of contacts in the list.
portal_id integer The hub ID.
updated_timestamp timestamp without time zone A timestamp of the time that the list was last modified.
total_bounces numeric The total number of bounce email events.
total_clicks numeric The total number of click email events.
total_deferrals numeric The total number of deferral email events.
total_deliveries numeric The total number of delivery email events.
total_drops numeric The total number of drop email events.
total_forwards numeric The total number of forward email events.
total_opens numeric The total number of open email events.
total_prints numeric The total number of print email events.
total_spam_reports numeric The total number of spam report email events.
total_unsubscribes numeric The total number of unsubscribe email events.
total_unique_bounces bigint The total number of unique email sends with a bounce email event.
total_unique_clicks bigint The total number of unique email sends with a click email event.
total_unique_deferrals bigint The total number of unique email sends with a deferral email event.
total_unique_deliveries bigint The total number of unique email sends with a delivery email event.
total_unique_drops bigint The total number of unique email sends with a drop email event.
total_unique_forwards bigint The total number of unique email sends with a forward email event.
total_unique_opens bigint The total number of unique email sends with a opens email event.
total_unique_prints bigint The total number of unique email sends with a print email event.
total_unique_spam_reports bigint The total number of unique email sends with a spam report email event.
total_unique_unsubscribes bigint The total number of unique email sends with a unsubscribe email event.
Column Lineage
%3 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list _fivetran_synced 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists _fivetran_synced 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp _fivetran_synced 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly mapped
Column Lineage
%3 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list contact_list_id 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists contact_list_id 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list contact_list_id 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 40. model.hubspot_source.stg_hubspot__contact_list_member 40. model.hubspot_source.stg_hubspot__contact_list_member contact_list_id 40. model.hubspot_source.stg_hubspot__contact_list_member:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp id 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp contact_list_id 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp:f0->40. model.hubspot_source.stg_hubspot__contact_list_member:f0
40. model.hubspot_source.stg_hubspot__contact_list_member
  • Input Column: 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp[contact_list_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT in the macro CTE
    • Output Columns:
      • contact_list_id: Directly mapped after casting
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 40. model.hubspot_source.stg_hubspot__contact_list_member[contact_list_id]
    • Integration This column is used in the LEFT JOIN operation to connect email sends with contact lists.
    • Filtering It's used in the WHERE clause to filter out null values.
    • Aggregation It's used in the GROUP BY clause to aggregate email metrics per contact list.
    • Output Columns:
      • contact_list_id: This column is directly copied to the output.
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[id]
    • Cleaning The column is cast as INT and renamed
    • Output Columns:
      • contact_list_id: Directly mapped after casting
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[contact_list_id]
    • Integration Used as the key to join the contact_lists and email_metrics tables
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • contact_list_id: Directly copied
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[contact_list_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as the key to join with the email_metrics table
    • Output Columns:
      • contact_list_id: Directly mapped
Column Lineage
%3 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list contact_list_name 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists contact_list_name 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp name 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[name]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • contact_list_name: Mapped after casting to TEXT and renamed
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[contact_list_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • contact_list_name: Directly mapped
Column Lineage
%3 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list is_contact_list_deleted 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists is_contact_list_deleted 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp _fivetran_deleted 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[_fivetran_deleted]
    • Cleaning The column is renamed with an 'is_' prefix
    • Output Columns:
      • is_contact_list_deleted: Directly mapped after renaming
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[is_contact_list_deleted]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_contact_list_deleted: Directly mapped
Column Lineage
%3 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list created_timestamp 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists created_timestamp 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp created_at 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[created_at]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • created_timestamp: Mapped after casting and renaming
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly mapped
Column Lineage
%3 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list is_deletable 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists is_deletable 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp deleteable 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[deleteable]
    • Cleaning The column is renamed with an 'is_' prefix
    • Output Columns:
      • is_deletable: Directly mapped after renaming
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[is_deletable]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_deletable: Directly mapped
Column Lineage
%3 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list is_dynamic 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists is_dynamic 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp dynamic 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[dynamic]
    • Cleaning The column is renamed with an 'is_' prefix
    • Output Columns:
      • is_dynamic: Directly mapped after renaming
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[is_dynamic]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_dynamic: Directly mapped
Column Lineage
%3 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list metadata_error 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists metadata_error 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp metadata_error 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[metadata_error]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • metadata_error: Directly mapped without changes
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[metadata_error]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • metadata_error: Directly mapped
Column Lineage
%3 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list metadata_last_processing_state_change_at 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists metadata_last_processing_state_change_at 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp metadata_last_processing_state_change_at 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[metadata_last_processing_state_change_at]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • metadata_last_processing_state_change_at: Directly mapped after casting
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[metadata_last_processing_state_change_at]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • metadata_last_processing_state_change_at: Directly mapped
Column Lineage
%3 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list metadata_last_size_change_at 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists metadata_last_size_change_at 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp metadata_last_size_change_at 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[metadata_last_size_change_at]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • metadata_last_size_change_at: Directly mapped after casting
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[metadata_last_size_change_at]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • metadata_last_size_change_at: Directly mapped
Column Lineage
%3 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list metadata_processing 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists metadata_processing 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp metadata_processing 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[metadata_processing]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • metadata_processing: Directly mapped without changes
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[metadata_processing]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • metadata_processing: Directly copied to the output
Column Lineage
%3 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list metadata_size 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists metadata_size 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp metadata_size 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[metadata_size]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT
    • Output Columns:
      • metadata_size: Directly mapped after casting to INT
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[metadata_size]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • metadata_size: Directly copied to the output
Column Lineage
%3 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list portal_id 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists portal_id 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp portal_id 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[portal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT
    • Output Columns:
      • portal_id: Directly mapped after casting to INT
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[portal_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • portal_id: Directly copied to the output
Column Lineage
%3 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list updated_timestamp 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists updated_timestamp 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp updated_at 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[updated_at]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • updated_timestamp: Mapped after casting to TIMESTAMP and renamed
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[updated_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • updated_timestamp: Directly copied to the output
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends bounces was_bounced 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_bounces total_unique_bounces 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_bounces total_unique_bounces 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[bounces]
    • Aggregation Likely aggregated to calculate total_bounces and total_unique_bounces
    • Output Columns:
      • total_bounces: Summed for each contact_list_id
      • total_unique_bounces: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_bounced]
    • Aggregation This column is aggregated to calculate total bounces and unique bounces
    • Output Columns:
      • total_bounces: Sum of all bounces
      • total_unique_bounces: Count of distinct bounces
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[bounces]
    • Aggregation This column is likely aggregated to calculate the total_bounces and total_unique_bounces in the email_metrics CTE
    • Output Columns:
      • total_bounces: Aggregated sum
      • total_unique_bounces: Aggregated count of unique occurrences
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_bounced]
    • Aggregation This column is aggregated to calculate the total bounces for each contact list.
    • Output Columns:
      • total_bounces: Aggregated sum of bounces for each contact list
      • total_unique_bounces: Aggregated count of unique bounces for each contact list
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_bounces]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_bounces: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends clicks was_clicked 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_clicks total_unique_clicks 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_clicks total_unique_clicks 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[clicks]
    • Aggregation Likely aggregated to calculate total_clicks and total_unique_clicks
    • Output Columns:
      • total_clicks: Summed for each contact_list_id
      • total_unique_clicks: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_clicked]
    • Aggregation This column is aggregated to calculate total clicks and unique clicks
    • Output Columns:
      • total_clicks: Sum of all clicks
      • total_unique_clicks: Count of distinct clicks
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[clicks]
    • Aggregation This column is likely aggregated to calculate the total_clicks and total_unique_clicks in the email_metrics CTE
    • Output Columns:
      • total_clicks: Aggregated sum
      • total_unique_clicks: Aggregated count of unique occurrences
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_clicked]
    • Aggregation This column is aggregated to calculate the total clicks for each contact list.
    • Output Columns:
      • total_clicks: Aggregated sum of clicks for each contact list
      • total_unique_clicks: Aggregated count of unique clicks for each contact list
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_clicks]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_clicks: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends deferrals was_deferred 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_deferrals total_unique_deferrals 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_deferrals total_unique_deferrals 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[deferrals]
    • Aggregation Likely aggregated to calculate total_deferrals and total_unique_deferrals
    • Output Columns:
      • total_deferrals: Summed for each contact_list_id
      • total_unique_deferrals: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_deferred]
    • Aggregation This column is aggregated to calculate total deferrals and unique deferrals
    • Output Columns:
      • total_deferrals: Sum of all deferrals
      • total_unique_deferrals: Count of distinct deferrals
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[deferrals]
    • Aggregation This column is likely aggregated to calculate the total_deferrals and total_unique_deferrals in the email_metrics CTE
    • Output Columns:
      • total_deferrals: Aggregated sum
      • total_unique_deferrals: Aggregated count of unique occurrences
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_deferred]
    • Aggregation This column is aggregated to calculate the total deferrals for each contact list.
    • Output Columns:
      • total_deferrals: Aggregated sum of deferrals for each contact list
      • total_unique_deferrals: Aggregated count of unique deferrals for each contact list
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_deferrals]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_deferrals: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends deliveries was_delivered 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_deliveries total_unique_deliveries 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_deliveries total_unique_deliveries 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[deliveries]
    • Aggregation Likely aggregated to calculate total_deliveries and total_unique_deliveries
    • Output Columns:
      • total_deliveries: Summed for each contact_list_id
      • total_unique_deliveries: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_delivered]
    • Aggregation This column is aggregated to calculate total deliveries and unique deliveries
    • Output Columns:
      • total_deliveries: Sum of all deliveries
      • total_unique_deliveries: Count of distinct deliveries
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[deliveries]
    • Aggregation This column is likely aggregated to calculate the total_deliveries and total_unique_deliveries in the email_metrics CTE
    • Output Columns:
      • total_deliveries: Aggregated sum
      • total_unique_deliveries: Aggregated count of unique occurrences
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_delivered]
    • Aggregation This column is aggregated to calculate the total deliveries for each contact list.
    • Output Columns:
      • total_deliveries: Aggregated sum of deliveries for each contact list
      • total_unique_deliveries: Aggregated count of unique deliveries for each contact list
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_deliveries]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_deliveries: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends drops 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_drops total_unique_drops 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_drops total_unique_drops 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[drops]
    • Aggregation Likely aggregated to calculate total_drops and total_unique_drops
    • Output Columns:
      • total_drops: Summed for each contact_list_id
      • total_unique_drops: Counted distinct for each contact_list_id
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[drops]
    • Aggregation This column is likely aggregated to calculate the total_drops and total_unique_drops in the email_metrics CTE
    • Output Columns:
      • total_drops: Aggregated sum
      • total_unique_drops: Aggregated count of unique occurrences
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_drops]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_drops: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends forwards was_forwarded 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_forwards total_unique_forwards 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_forwards total_unique_forwards 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[forwards]
    • Aggregation Likely aggregated to calculate total_forwards and total_unique_forwards
    • Output Columns:
      • total_forwards: Summed for each contact_list_id
      • total_unique_forwards: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_forwarded]
    • Aggregation This column is aggregated to calculate total forwards and unique forwards
    • Output Columns:
      • total_forwards: Sum of all forwards
      • total_unique_forwards: Count of distinct forwards
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[forwards]
    • Aggregation This column is likely aggregated to calculate the total_forwards and total_unique_forwards in the email_metrics CTE
    • Output Columns:
      • total_forwards: Aggregated sum
      • total_unique_forwards: Aggregated count of unique occurrences
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_forwarded]
    • Aggregation This column is aggregated to calculate the total forwards for each contact list.
    • Output Columns:
      • total_forwards: Aggregated sum of forwards for each contact list
      • total_unique_forwards: Aggregated count of unique forwards for each contact list
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_forwards]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_forwards: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends opens was_opened 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_opens total_unique_opens 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_opens total_unique_opens 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[opens]
    • Aggregation This column is aggregated to calculate total opens and unique opens
    • Output Columns:
      • total_opens: Sum of all opens
      • total_unique_opens: Count of distinct opens
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_opened]
    • Aggregation This column is aggregated to calculate total opens and unique opens
    • Output Columns:
      • total_opens: Sum of all opens
      • total_unique_opens: Count of distinct opens
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[opens]
    • Aggregation This column is aggregated to calculate the total opens for each contact list.
    • Output Columns:
      • total_opens: Aggregated sum of opens for each contact list
      • total_unique_opens: Aggregated count of unique opens for each contact list
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_opened]
    • Aggregation This column is aggregated to calculate the total opens for each contact list.
    • Output Columns:
      • total_opens: Aggregated sum of opens for each contact list
      • total_unique_opens: Aggregated count of unique opens for each contact list
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_opens]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_opens: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends prints was_printed 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_prints total_unique_prints 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_prints total_unique_prints 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[prints]
    • Aggregation This column is aggregated to calculate total prints and unique prints
    • Output Columns:
      • total_prints: Sum of all prints
      • total_unique_prints: Count of distinct prints
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_printed]
    • Aggregation This column is likely used to calculate the total_prints and total_unique_prints in the output
    • Output Columns:
      • total_prints: Aggregated count of all prints
      • total_unique_prints: Aggregated count of unique prints
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[prints]
    • Aggregation This column is aggregated to calculate the total prints for each contact list.
    • Output Columns:
      • total_prints: Aggregated sum of prints for each contact list
      • total_unique_prints: Aggregated count of unique prints for each contact list
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_printed]
    • Aggregation This column is likely aggregated to calculate the total number of print events and unique print events.
    • Output Columns:
      • total_prints: Aggregated count of all print events
      • total_unique_prints: Aggregated count of unique email sends with print events
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_prints]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_prints: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends spam_reports was_spam_reported 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_spam_reports total_unique_spam_reports 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_spam_reports total_unique_spam_reports 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[spam_reports]
    • Aggregation This column is aggregated to calculate total spam reports and unique spam reports
    • Output Columns:
      • total_spam_reports: Sum of all spam reports
      • total_unique_spam_reports: Count of distinct spam reports
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_spam_reported]
    • Aggregation This column is likely used to calculate the total_spam_reports and total_unique_spam_reports in the output
    • Output Columns:
      • total_spam_reports: Aggregated count of all spam reports
      • total_unique_spam_reports: Aggregated count of unique spam reports
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[spam_reports]
    • Aggregation This column is aggregated to calculate the total spam reports for each contact list.
    • Output Columns:
      • total_spam_reports: Aggregated sum of spam reports for each contact list
      • total_unique_spam_reports: Aggregated count of unique spam reports for each contact list
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_spam_reported]
    • Aggregation This column is likely aggregated to calculate the total number of spam report events and unique spam report events.
    • Output Columns:
      • total_spam_reports: Aggregated count of all spam report events
      • total_unique_spam_reports: Aggregated count of unique email sends with spam report events
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_spam_reports]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_spam_reports: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_id unsubscribes was_unsubcribed 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f2->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f2->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f2->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f2->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change email_send_id 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_id 20. model.hubspot.hubspot__email_event_status_change:f0->30. model.hubspot.int_hubspot__email_aggregate_status_change:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
30. model.hubspot.int_hubspot__email_aggregate_status_change
  • Input Column: 20. model.hubspot.hubspot__email_event_status_change[email_send_id]
    • Filtering The column is filtered to exclude null values (WHERE NOT email_send_id IS NULL)
    • Aggregation The column is used in the GROUP BY clause
    • Output Columns:
      • email_send_id: This column is directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate total unsubscribes and unique unsubscribes
    • Output Columns:
      • total_unsubscribes: Sum of all unsubscribes
      • total_unique_unsubscribes: Count of distinct unsubscribes
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is likely used to calculate the total_unsubscribes and total_unique_unsubscribes in the output
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribes
      • total_unique_unsubscribes: Aggregated count of unique unsubscribes
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate the total unsubscribes for each contact list.
    • Output Columns:
      • total_unsubscribes: Aggregated sum of unsubscribes for each contact list
      • total_unique_unsubscribes: Aggregated count of unique unsubscribes for each contact list
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is likely aggregated to calculate the total number of unsubscribe events and unique unsubscribe events.
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribe events
      • total_unique_unsubscribes: Aggregated count of unique email sends with unsubscribe events
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unsubscribes]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unsubscribes: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends bounces was_bounced 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_bounces total_unique_bounces 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_bounces total_unique_bounces 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[bounces]
    • Aggregation Likely aggregated to calculate total_bounces and total_unique_bounces
    • Output Columns:
      • total_bounces: Summed for each contact_list_id
      • total_unique_bounces: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_bounced]
    • Aggregation This column is aggregated to calculate total bounces and unique bounces
    • Output Columns:
      • total_bounces: Sum of all bounces
      • total_unique_bounces: Count of distinct bounces
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[bounces]
    • Aggregation This column is likely aggregated to calculate the total_bounces and total_unique_bounces in the email_metrics CTE
    • Output Columns:
      • total_bounces: Aggregated sum
      • total_unique_bounces: Aggregated count of unique occurrences
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_bounced]
    • Aggregation This column is aggregated to calculate the total bounces for each contact list.
    • Output Columns:
      • total_bounces: Aggregated sum of bounces for each contact list
      • total_unique_bounces: Aggregated count of unique bounces for each contact list
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_bounces]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_unique_bounces: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends clicks was_clicked 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_clicks total_unique_clicks 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_clicks total_unique_clicks 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[clicks]
    • Aggregation Likely aggregated to calculate total_clicks and total_unique_clicks
    • Output Columns:
      • total_clicks: Summed for each contact_list_id
      • total_unique_clicks: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_clicked]
    • Aggregation This column is aggregated to calculate total clicks and unique clicks
    • Output Columns:
      • total_clicks: Sum of all clicks
      • total_unique_clicks: Count of distinct clicks
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[clicks]
    • Aggregation This column is likely aggregated to calculate the total_clicks and total_unique_clicks in the email_metrics CTE
    • Output Columns:
      • total_clicks: Aggregated sum
      • total_unique_clicks: Aggregated count of unique occurrences
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_clicked]
    • Aggregation This column is aggregated to calculate the total clicks for each contact list.
    • Output Columns:
      • total_clicks: Aggregated sum of clicks for each contact list
      • total_unique_clicks: Aggregated count of unique clicks for each contact list
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_clicks]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_unique_clicks: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends deferrals was_deferred 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_deferrals total_unique_deferrals 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_deferrals total_unique_deferrals 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[deferrals]
    • Aggregation Likely aggregated to calculate total_deferrals and total_unique_deferrals
    • Output Columns:
      • total_deferrals: Summed for each contact_list_id
      • total_unique_deferrals: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_deferred]
    • Aggregation This column is aggregated to calculate total deferrals and unique deferrals
    • Output Columns:
      • total_deferrals: Sum of all deferrals
      • total_unique_deferrals: Count of distinct deferrals
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[deferrals]
    • Aggregation This column is likely aggregated to calculate the total_deferrals and total_unique_deferrals in the email_metrics CTE
    • Output Columns:
      • total_deferrals: Aggregated sum
      • total_unique_deferrals: Aggregated count of unique occurrences
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_deferred]
    • Aggregation This column is aggregated to calculate the total deferrals for each contact list.
    • Output Columns:
      • total_deferrals: Aggregated sum of deferrals for each contact list
      • total_unique_deferrals: Aggregated count of unique deferrals for each contact list
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_deferrals]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_unique_deferrals: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends deliveries was_delivered 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_deliveries total_unique_deliveries 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_deliveries total_unique_deliveries 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[deliveries]
    • Aggregation Likely aggregated to calculate total_deliveries and total_unique_deliveries
    • Output Columns:
      • total_deliveries: Summed for each contact_list_id
      • total_unique_deliveries: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_delivered]
    • Aggregation This column is aggregated to calculate total deliveries and unique deliveries
    • Output Columns:
      • total_deliveries: Sum of all deliveries
      • total_unique_deliveries: Count of distinct deliveries
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[deliveries]
    • Aggregation This column is likely aggregated to calculate the total_deliveries and total_unique_deliveries in the email_metrics CTE
    • Output Columns:
      • total_deliveries: Aggregated sum
      • total_unique_deliveries: Aggregated count of unique occurrences
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_delivered]
    • Aggregation This column is aggregated to calculate the total deliveries for each contact list.
    • Output Columns:
      • total_deliveries: Aggregated sum of deliveries for each contact list
      • total_unique_deliveries: Aggregated count of unique deliveries for each contact list
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_deliveries]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_unique_deliveries: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends drops 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_drops total_unique_drops 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[drops]
    • Aggregation This column is likely aggregated to calculate the total_drops and total_unique_drops in the email_metrics CTE
    • Output Columns:
      • total_drops: Aggregated sum
      • total_unique_drops: Aggregated count of unique occurrences
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends forwards was_forwarded 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_forwards total_unique_forwards 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_forwards total_unique_forwards 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[forwards]
    • Aggregation Likely aggregated to calculate total_forwards and total_unique_forwards
    • Output Columns:
      • total_forwards: Summed for each contact_list_id
      • total_unique_forwards: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_forwarded]
    • Aggregation This column is aggregated to calculate total forwards and unique forwards
    • Output Columns:
      • total_forwards: Sum of all forwards
      • total_unique_forwards: Count of distinct forwards
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[forwards]
    • Aggregation This column is likely aggregated to calculate the total_forwards and total_unique_forwards in the email_metrics CTE
    • Output Columns:
      • total_forwards: Aggregated sum
      • total_unique_forwards: Aggregated count of unique occurrences
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_forwarded]
    • Aggregation This column is aggregated to calculate the total forwards for each contact list.
    • Output Columns:
      • total_forwards: Aggregated sum of forwards for each contact list
      • total_unique_forwards: Aggregated count of unique forwards for each contact list
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_forwards]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unique_forwards: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends opens was_opened 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_opens total_unique_opens 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_opens total_unique_opens 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[opens]
    • Aggregation This column is aggregated to calculate total opens and unique opens
    • Output Columns:
      • total_opens: Sum of all opens
      • total_unique_opens: Count of distinct opens
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_opened]
    • Aggregation This column is aggregated to calculate total opens and unique opens
    • Output Columns:
      • total_opens: Sum of all opens
      • total_unique_opens: Count of distinct opens
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[opens]
    • Aggregation This column is aggregated to calculate the total opens for each contact list.
    • Output Columns:
      • total_opens: Aggregated sum of opens for each contact list
      • total_unique_opens: Aggregated count of unique opens for each contact list
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_opened]
    • Aggregation This column is aggregated to calculate the total opens for each contact list.
    • Output Columns:
      • total_opens: Aggregated sum of opens for each contact list
      • total_unique_opens: Aggregated count of unique opens for each contact list
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_opens]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unique_opens: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends prints was_printed 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_prints total_unique_prints 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_prints total_unique_prints 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[prints]
    • Aggregation This column is aggregated to calculate total prints and unique prints
    • Output Columns:
      • total_prints: Sum of all prints
      • total_unique_prints: Count of distinct prints
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_printed]
    • Aggregation This column is likely used to calculate the total_prints and total_unique_prints in the output
    • Output Columns:
      • total_prints: Aggregated count of all prints
      • total_unique_prints: Aggregated count of unique prints
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[prints]
    • Aggregation This column is aggregated to calculate the total prints for each contact list.
    • Output Columns:
      • total_prints: Aggregated sum of prints for each contact list
      • total_unique_prints: Aggregated count of unique prints for each contact list
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_printed]
    • Aggregation This column is likely aggregated to calculate the total number of print events and unique print events.
    • Output Columns:
      • total_prints: Aggregated count of all print events
      • total_unique_prints: Aggregated count of unique email sends with print events
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_prints]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unique_prints: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends spam_reports was_spam_reported 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_spam_reports total_unique_spam_reports 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_spam_reports total_unique_spam_reports 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[spam_reports]
    • Aggregation This column is aggregated to calculate total spam reports and unique spam reports
    • Output Columns:
      • total_spam_reports: Sum of all spam reports
      • total_unique_spam_reports: Count of distinct spam reports
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_spam_reported]
    • Aggregation This column is likely used to calculate the total_spam_reports and total_unique_spam_reports in the output
    • Output Columns:
      • total_spam_reports: Aggregated count of all spam reports
      • total_unique_spam_reports: Aggregated count of unique spam reports
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[spam_reports]
    • Aggregation This column is aggregated to calculate the total spam reports for each contact list.
    • Output Columns:
      • total_spam_reports: Aggregated sum of spam reports for each contact list
      • total_unique_spam_reports: Aggregated count of unique spam reports for each contact list
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_spam_reported]
    • Aggregation This column is likely aggregated to calculate the total number of spam report events and unique spam report events.
    • Output Columns:
      • total_spam_reports: Aggregated count of all spam report events
      • total_unique_spam_reports: Aggregated count of unique email sends with spam report events
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_spam_reports]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unique_spam_reports: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_id unsubscribes was_unsubcribed 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f2->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f2->4. model.hubspot.hubspot__contact_lists:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change email_send_id 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_id 20. model.hubspot.hubspot__email_event_status_change:f0->30. model.hubspot.int_hubspot__email_aggregate_status_change:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
30. model.hubspot.int_hubspot__email_aggregate_status_change
  • Input Column: 20. model.hubspot.hubspot__email_event_status_change[email_send_id]
    • Filtering The column is filtered to exclude null values (WHERE NOT email_send_id IS NULL)
    • Aggregation The column is used in the GROUP BY clause
    • Output Columns:
      • email_send_id: This column is directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
4. model.hubspot.hubspot__contact_lists
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate the total unsubscribes for each contact list.
    • Output Columns:
      • total_unsubscribes: Aggregated sum of unsubscribes for each contact list
      • total_unique_unsubscribes: Aggregated count of unique unsubscribes for each contact list
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is likely aggregated to calculate the total number of unsubscribe events and unique unsubscribe events.
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribe events
      • total_unique_unsubscribes: Aggregated count of unique email sends with unsubscribe events
5. model.hubspot.hubspot__contacts

This SQL query integrates contact data from Hubspot with engagement metrics and email send information. It combines data from multiple tables, including contacts, engagements, and email sends. The query calculates various engagement counts (notes, tasks, calls, meetings, emails) for each contact and joins this information with the main contact data. It also checks if a contact's email address has been used in email sends.

IntegrationAggregationFeaturization
SQL Query
WITH __dbt__cte__int_hubspot__engagement_metrics__by_contact AS (
  WITH engagements AS (
    SELECT
      *
    FROM TEST.PUBLIC_hubspot.hubspot__engagements
  ), engagement_contacts AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_contact
  ), engagement_contacts_joined AS (
    SELECT
      engagements.engagement_type,
      engagement_contacts.contact_id
    FROM engagements
    INNER JOIN engagement_contacts
      USING (engagement_id)
  ), engagement_contacts_agg AS (
    SELECT
      contact_id,
      COUNT(CASE WHEN engagement_type = 'NOTE' THEN contact_id END) AS count_engagement_notes,
      COUNT(CASE WHEN engagement_type = 'TASK' THEN contact_id END) AS count_engagement_tasks,
      COUNT(CASE WHEN engagement_type = 'CALL' THEN contact_id END) AS count_engagement_calls,
      COUNT(CASE WHEN engagement_type = 'MEETING' THEN contact_id END) AS count_engagement_meetings,
      COUNT(CASE WHEN engagement_type = 'EMAIL' THEN contact_id END) AS count_engagement_emails,
      COUNT(CASE WHEN engagement_type = 'INCOMING_EMAIL' THEN contact_id END) AS count_engagement_incoming_emails,
      COUNT(CASE WHEN engagement_type = 'FORWARDED_EMAIL' THEN contact_id END) AS count_engagement_forwarded_emails
    FROM engagement_contacts_joined
    GROUP BY
      1
  )
  SELECT
    *
  FROM engagement_contacts_agg
), contacts AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.int_hubspot__contact_merge_adjust
), email_sends AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.hubspot__email_sends
), email_metrics AS (
  SELECT
    recipient_email_address
  FROM email_sends
  GROUP BY
    1
), email_joined AS (
  SELECT
    contacts.*
  FROM contacts
  LEFT JOIN email_metrics
    ON contacts.email = email_metrics.recipient_email_address
), engagements AS (
  SELECT
    *
  FROM __dbt__cte__int_hubspot__engagement_metrics__by_contact
), engagements_joined AS (
  SELECT
    email_joined.*,
    COALESCE(engagements.count_engagement_notes, 0) AS count_engagement_notes,
    COALESCE(engagements.count_engagement_tasks, 0) AS count_engagement_tasks,
    COALESCE(engagements.count_engagement_calls, 0) AS count_engagement_calls,
    COALESCE(engagements.count_engagement_meetings, 0) AS count_engagement_meetings,
    COALESCE(engagements.count_engagement_emails, 0) AS count_engagement_emails,
    COALESCE(engagements.count_engagement_incoming_emails, 0) AS count_engagement_incoming_emails,
    COALESCE(engagements.count_engagement_forwarded_emails, 0) AS count_engagement_forwarded_emails
  FROM email_joined
  LEFT JOIN engagements
    USING (contact_id)
)
SELECT
  *
FROM engagements_joined
%3 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts is_contact_deleted _fivetran_synced contact_id contact_company first_name last_name email created_date job_title company_annual_revenue total_bounces total_clicks total_deferrals total_deliveries total_drops total_forwards total_opens total_prints total_spam_reports total_unsubscribes total_unique_bounces total_unique_clicks total_unique_deferrals total_unique_deliveries total_unique_drops total_unique_forwards total_unique_opens total_unique_prints total_unique_spam_reports total_unique_unsubscribes count_engagement_notes count_engagement_tasks count_engagement_calls count_engagement_meetings count_engagement_emails count_engagement_incoming_emails count_engagement_forwarded_emails calculated_merged_vids 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends recipient_email_address contact_id bounces clicks deferrals deliveries drops forwards opens prints spam_reports unsubscribes was_bounced was_clicked was_deferred was_delivered was_forwarded was_printed was_spam_reported was_unsubcribed 21. model.hubspot.hubspot__email_sends:f2->5. model.hubspot.hubspot__contacts:f10 21. model.hubspot.hubspot__email_sends:f2->5. model.hubspot.hubspot__contacts:f20 21. model.hubspot.hubspot__email_sends:f3->5. model.hubspot.hubspot__contacts:f11 21. model.hubspot.hubspot__email_sends:f3->5. model.hubspot.hubspot__contacts:f21 21. model.hubspot.hubspot__email_sends:f4->5. model.hubspot.hubspot__contacts:f12 21. model.hubspot.hubspot__email_sends:f4->5. model.hubspot.hubspot__contacts:f22 21. model.hubspot.hubspot__email_sends:f5->5. model.hubspot.hubspot__contacts:f13 21. model.hubspot.hubspot__email_sends:f5->5. model.hubspot.hubspot__contacts:f23 21. model.hubspot.hubspot__email_sends:f6->5. model.hubspot.hubspot__contacts:f14 21. model.hubspot.hubspot__email_sends:f6->5. model.hubspot.hubspot__contacts:f24 21. model.hubspot.hubspot__email_sends:f7->5. model.hubspot.hubspot__contacts:f15 21. model.hubspot.hubspot__email_sends:f7->5. model.hubspot.hubspot__contacts:f25 21. model.hubspot.hubspot__email_sends:f8->5. model.hubspot.hubspot__contacts:f16 21. model.hubspot.hubspot__email_sends:f8->5. model.hubspot.hubspot__contacts:f26 21. model.hubspot.hubspot__email_sends:f9->5. model.hubspot.hubspot__contacts:f17 21. model.hubspot.hubspot__email_sends:f9->5. model.hubspot.hubspot__contacts:f27 21. model.hubspot.hubspot__email_sends:f10->5. model.hubspot.hubspot__contacts:f18 21. model.hubspot.hubspot__email_sends:f10->5. model.hubspot.hubspot__contacts:f28 21. model.hubspot.hubspot__email_sends:f11->5. model.hubspot.hubspot__contacts:f19 21. model.hubspot.hubspot__email_sends:f11->5. model.hubspot.hubspot__contacts:f29 21. model.hubspot.hubspot__email_sends:f12->5. model.hubspot.hubspot__contacts:f10 21. model.hubspot.hubspot__email_sends:f12->5. model.hubspot.hubspot__contacts:f20 21. model.hubspot.hubspot__email_sends:f13->5. model.hubspot.hubspot__contacts:f11 21. model.hubspot.hubspot__email_sends:f13->5. model.hubspot.hubspot__contacts:f21 21. model.hubspot.hubspot__email_sends:f14->5. model.hubspot.hubspot__contacts:f12 21. model.hubspot.hubspot__email_sends:f14->5. model.hubspot.hubspot__contacts:f22 21. model.hubspot.hubspot__email_sends:f15->5. model.hubspot.hubspot__contacts:f13 21. model.hubspot.hubspot__email_sends:f15->5. model.hubspot.hubspot__contacts:f23 21. model.hubspot.hubspot__email_sends:f16->5. model.hubspot.hubspot__contacts:f15 21. model.hubspot.hubspot__email_sends:f16->5. model.hubspot.hubspot__contacts:f25 21. model.hubspot.hubspot__email_sends:f17->5. model.hubspot.hubspot__contacts:f17 21. model.hubspot.hubspot__email_sends:f17->5. model.hubspot.hubspot__contacts:f27 21. model.hubspot.hubspot__email_sends:f18->5. model.hubspot.hubspot__contacts:f18 21. model.hubspot.hubspot__email_sends:f18->5. model.hubspot.hubspot__contacts:f28 21. model.hubspot.hubspot__email_sends:f19->5. model.hubspot.hubspot__contacts:f19 21. model.hubspot.hubspot__email_sends:f19->5. model.hubspot.hubspot__contacts:f29 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id is_contact_deleted calculated_merged_vids email contact_company first_name last_name created_date job_title company_annual_revenue _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f2 28. model.hubspot.int_hubspot__contact_merge_adjust:f1->5. model.hubspot.hubspot__contacts:f0 28. model.hubspot.int_hubspot__contact_merge_adjust:f2->5. model.hubspot.hubspot__contacts:f37 28. model.hubspot.int_hubspot__contact_merge_adjust:f3->5. model.hubspot.hubspot__contacts:f6 28. model.hubspot.int_hubspot__contact_merge_adjust:f4->5. model.hubspot.hubspot__contacts:f3 28. model.hubspot.int_hubspot__contact_merge_adjust:f5->5. model.hubspot.hubspot__contacts:f4 28. model.hubspot.int_hubspot__contact_merge_adjust:f6->5. model.hubspot.hubspot__contacts:f5 28. model.hubspot.int_hubspot__contact_merge_adjust:f7->5. model.hubspot.hubspot__contacts:f7 28. model.hubspot.int_hubspot__contact_merge_adjust:f8->5. model.hubspot.hubspot__contacts:f8 28. model.hubspot.int_hubspot__contact_merge_adjust:f9->5. model.hubspot.hubspot__contacts:f9 28. model.hubspot.int_hubspot__contact_merge_adjust:f10->5. model.hubspot.hubspot__contacts:f1 33. model.hubspot.int_hubspot__engagement_metrics__by_contact 33. model.hubspot.int_hubspot__engagement_metrics__by_contact contact_id 33. model.hubspot.int_hubspot__engagement_metrics__by_contact:f0->5. model.hubspot.hubspot__contacts:f2
Name Type Comment
is_contact_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
contact_id integer The ID of the contact.
contact_company text The name of the contact's company
first_name text The contact's first name.
last_name text The contact's last name.
email text The email address of the contact.
created_date timestamp without time zone The date that the contact was created in your HubSpot account.
job_title integer The contact's job title.
company_annual_revenue integer The contact's annual company revenue.
total_bounces numeric The total number of bounce email events.
total_clicks numeric The total number of click email events.
total_deferrals numeric The total number of deferral email events.
total_deliveries numeric The total number of delivery email events.
total_drops numeric The total number of drop email events.
total_forwards numeric The total number of forward email events.
total_opens numeric The total number of open email events.
total_prints numeric The total number of print email events.
total_spam_reports numeric The total number of spam report email events.
total_unsubscribes numeric The total number of unsubscribe email events.
total_unique_bounces bigint The total number of unique email sends with a bounce email event.
total_unique_clicks bigint The total number of unique email sends with a click email event.
total_unique_deferrals bigint The total number of unique email sends with a deferral email event.
total_unique_deliveries bigint The total number of unique email sends with a delivery email event.
total_unique_drops bigint The total number of unique email sends with a drop email event.
total_unique_forwards bigint The total number of unique email sends with a forward email event.
total_unique_opens bigint The total number of unique email sends with a opens email event.
total_unique_prints bigint The total number of unique email sends with a print email event.
total_unique_spam_reports bigint The total number of unique email sends with a spam report email event.
total_unique_unsubscribes bigint The total number of unique email sends with a unsubscribe email event.
count_engagement_notes bigint The total number of related note engagements.
count_engagement_tasks bigint The total number of related task engagements.
count_engagement_calls bigint The total number of related call engagements.
count_engagement_meetings bigint The total number of related meeting engagements.
count_engagement_emails bigint The total number of related email engagements.
count_engagement_incoming_emails bigint The total number of related incoming email engagements.
count_engagement_forwarded_emails bigint The total number of related forwarded email engagements.
calculated_merged_vids text List of mappings representing contact IDs that have been merged into the contact at hand. Format: :;: This field has replaced the `CONTACT_MERGE_AUDIT` table, which was deprecated by the Hubspot v3 CRM API.
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust is_contact_deleted 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact is_contact_deleted 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_deleted 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_deleted]
    • Cleaning This column is likely used to determine the 'is_contact_deleted' field, though not explicitly shown in the provided SQL.
    • Output Columns:
      • is_contact_deleted: Likely transformed to determine if the contact is deleted
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust _fivetran_synced 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_synced 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_synced]
    • Direct The column is directly copied with a cast to TIMESTAMP.
    • Output Columns:
      • _fivetran_synced: Directly mapped with a TIMESTAMP cast
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output column with the same name
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 33. model.hubspot.int_hubspot__engagement_metrics__by_contact 33. model.hubspot.int_hubspot__engagement_metrics__by_contact contact_id 33. model.hubspot.int_hubspot__engagement_metrics__by_contact:f0->5. model.hubspot.hubspot__contacts:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_id 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements contact_ids 27. model.hubspot.hubspot__engagements:f0->33. model.hubspot.int_hubspot__engagement_metrics__by_contact:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp id 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact contact_id 91. model.hubspot_source.stg_hubspot__engagement_contact:f0->27. model.hubspot.hubspot__engagements:f0 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp contact_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[contact_id]
    • Cleaning The column is cast to INT data type in the macro CTE
    • Output Columns:
      • contact_id: It is directly mapped after casting
27. model.hubspot.hubspot__engagements
  • Input Column: 91. model.hubspot_source.stg_hubspot__engagement_contact[contact_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Integration It's used in the GROUP BY clause to create the aggregated array
    • Output Columns:
      • contact_ids: The contact_id values are aggregated into the contact_ids array in the output
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[id]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_id: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with the contact_merge_audit CTE
    • Filtering Used in the WHERE clause to filter out merged contacts
    • Output Columns:
      • contact_id: Directly copied to the output
33. model.hubspot.int_hubspot__engagement_metrics__by_contact
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Integration This column is indirectly used through the join with the engagement_contacts table, which likely contains the individual contact IDs derived from this list.
    • Aggregation The contact IDs are used in the GROUP BY clause to aggregate engagement counts per contact.
    • Output Columns:
      • contact_id: The individual contact IDs from this list are mapped to the output 'contact_id' column.
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with engagement metrics
    • Output Columns:
      • contact_id: Directly copied
  • Input Column: 33. model.hubspot.int_hubspot__engagement_metrics__by_contact[contact_id]
    • Integration This column is used as the key to join the engagement metrics with the main contact data in the LEFT JOIN operation.
    • Direct The column is directly copied to the output without transformation.
    • Output Columns:
      • contact_id: Directly copied to the output column with the same name.
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_company 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts contact_company 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_company 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_company 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_company]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_company: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_company]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_company: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_company]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_company: Directly copied
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust first_name 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts first_name 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact first_name 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_firstname 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_firstname]
    • Direct The column is directly copied.
    • Output Columns:
      • first_name: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[first_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • first_name: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[first_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • first_name: Directly copied
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust last_name 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts last_name 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact last_name 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_lastname 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_lastname]
    • Direct The column is directly copied.
    • Output Columns:
      • last_name: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[last_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • last_name: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[last_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • last_name: Directly copied
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust email 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts email 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact email 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_email 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_email]
    • Direct The column is directly copied.
    • Output Columns:
      • email: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[email]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Direct The column is directly copied without any transformation
    • Integration Used to join with email metrics
    • Output Columns:
      • email: Directly copied
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust created_date 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts created_date 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact created_date 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_created_at property_createdate 45. model.hubspot_source.stg_hubspot__contact_tmp:f1->38. model.hubspot_source.stg_hubspot__contact:f0 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_createdate]
    • Cleaning The column is cast to TIMESTAMP.
    • Output Columns:
      • created_date: Mapped with a TIMESTAMP cast
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_created_at]
    • Cleaning The column is cast to TIMESTAMP type
    • Output Columns:
      • created_date: This column is mapped to created_date after casting to TIMESTAMP
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[created_date]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • created_date: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[created_date]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • created_date: Directly copied
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust job_title 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts job_title 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact job_title 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_jobtitle 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_jobtitle]
    • Direct The column is directly copied.
    • Output Columns:
      • job_title: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[job_title]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • job_title: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[job_title]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • job_title: Directly copied
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust company_annual_revenue 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts company_annual_revenue 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact company_annual_revenue 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_annualrevenue 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_annualrevenue]
    • Cleaning The column is cast to INT type
    • Output Columns:
      • company_annual_revenue: This column is directly mapped to company_annual_revenue after casting
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[company_annual_revenue]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_annual_revenue: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[company_annual_revenue]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_annual_revenue: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends bounces was_bounced 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_bounces total_unique_bounces 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[bounces]
    • Aggregation aggregated to calculate total and unique bounces
    • Output Columns:
      • total_bounces: summed up
      • total_unique_bounces: counted uniquely
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_bounced]
    • Aggregation This column is aggregated to calculate the total number of bounced emails.
    • Output Columns:
      • total_bounces: Summed up for each contact
      • total_unique_bounces: Counted as unique occurrences for each contact
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends clicks was_clicked 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_clicks total_unique_clicks 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[clicks]
    • Aggregation aggregated to calculate total and unique clicks
    • Output Columns:
      • total_clicks: summed up
      • total_unique_clicks: counted uniquely
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_clicked]
    • Aggregation This column is aggregated to calculate the total number of clicked emails.
    • Output Columns:
      • total_clicks: Summed up for each contact
      • total_unique_clicks: Counted as unique occurrences for each contact
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends deferrals was_deferred 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_deferrals total_unique_deferrals 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[deferrals]
    • Aggregation aggregated to calculate total and unique deferrals
    • Output Columns:
      • total_deferrals: summed up
      • total_unique_deferrals: counted uniquely
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_deferred]
    • Aggregation This column is aggregated to calculate the total number of deferred emails.
    • Output Columns:
      • total_deferrals: Summed up for each contact
      • total_unique_deferrals: Counted as unique occurrences for each contact
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends deliveries was_delivered 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_deliveries total_unique_deliveries 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[deliveries]
    • Aggregation aggregated to calculate total and unique deliveries
    • Output Columns:
      • total_deliveries: summed up
      • total_unique_deliveries: counted uniquely
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_delivered]
    • Aggregation This column is aggregated to calculate the total number of delivered emails.
    • Output Columns:
      • total_deliveries: Summed up for each contact
      • total_unique_deliveries: Counted as unique occurrences for each contact
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends drops 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_drops total_unique_drops 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[drops]
    • Aggregation aggregated to calculate total and unique drops
    • Output Columns:
      • total_drops: summed up
      • total_unique_drops: counted uniquely
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends forwards was_forwarded 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_forwards total_unique_forwards 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[forwards]
    • Aggregation aggregated to calculate total and unique forwards
    • Output Columns:
      • total_forwards: summed up
      • total_unique_forwards: counted uniquely
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_forwarded]
    • Aggregation This column is aggregated to calculate the total number of forwarded emails.
    • Output Columns:
      • total_forwards: Summed up for each contact
      • total_unique_forwards: Counted as unique occurrences for each contact
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends opens 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_opens total_unique_opens 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[opens]
    • Aggregation This column is aggregated to calculate the total number of open email events.
    • Output Columns:
      • total_opens: Summed up for each contact
      • total_unique_opens: Counted as unique occurrences for each contact
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends prints was_printed 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_prints total_unique_prints 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[prints]
    • Aggregation This column is aggregated to calculate the total number of print email events.
    • Output Columns:
      • total_prints: Summed up for each contact
      • total_unique_prints: Counted as unique occurrences for each contact
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_printed]
    • Aggregation This column is used to count the total number of print email events and unique print email events.
    • Output Columns:
      • total_prints: Aggregated count of all print events
      • total_unique_prints: Aggregated count of unique print events
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends spam_reports was_spam_reported 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_spam_reports total_unique_spam_reports 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[spam_reports]
    • Aggregation This column is aggregated to calculate the total number of spam report email events.
    • Output Columns:
      • total_spam_reports: Summed up for each contact
      • total_unique_spam_reports: Counted as unique occurrences for each contact
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_spam_reported]
    • Aggregation This column is used to count the total number of spam report email events and unique spam report email events.
    • Output Columns:
      • total_spam_reports: Aggregated count of all spam report events
      • total_unique_spam_reports: Aggregated count of unique spam report events
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_id unsubscribes was_unsubcribed 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f2->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f2->5. model.hubspot.hubspot__contacts:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change email_send_id 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_id 20. model.hubspot.hubspot__email_event_status_change:f0->30. model.hubspot.int_hubspot__email_aggregate_status_change:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
30. model.hubspot.int_hubspot__email_aggregate_status_change
  • Input Column: 20. model.hubspot.hubspot__email_event_status_change[email_send_id]
    • Filtering The column is filtered to exclude null values (WHERE NOT email_send_id IS NULL)
    • Aggregation The column is used in the GROUP BY clause
    • Output Columns:
      • email_send_id: This column is directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate the total number of unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Summed up for each contact
      • total_unique_unsubscribes: Counted as unique occurrences for each contact
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is used to count the total number of unsubscribe email events and unique unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribe events
      • total_unique_unsubscribes: Aggregated count of unique unsubscribe events
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends bounces was_bounced 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_bounces total_unique_bounces 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[bounces]
    • Aggregation aggregated to calculate total and unique bounces
    • Output Columns:
      • total_bounces: summed up
      • total_unique_bounces: counted uniquely
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_bounced]
    • Aggregation This column is aggregated to calculate the total number of bounced emails.
    • Output Columns:
      • total_bounces: Summed up for each contact
      • total_unique_bounces: Counted as unique occurrences for each contact
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends clicks was_clicked 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_clicks total_unique_clicks 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[clicks]
    • Aggregation aggregated to calculate total and unique clicks
    • Output Columns:
      • total_clicks: summed up
      • total_unique_clicks: counted uniquely
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_clicked]
    • Aggregation This column is aggregated to calculate the total number of clicked emails.
    • Output Columns:
      • total_clicks: Summed up for each contact
      • total_unique_clicks: Counted as unique occurrences for each contact
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends deferrals was_deferred 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_deferrals total_unique_deferrals 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[deferrals]
    • Aggregation aggregated to calculate total and unique deferrals
    • Output Columns:
      • total_deferrals: summed up
      • total_unique_deferrals: counted uniquely
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_deferred]
    • Aggregation This column is aggregated to calculate the total number of deferred emails.
    • Output Columns:
      • total_deferrals: Summed up for each contact
      • total_unique_deferrals: Counted as unique occurrences for each contact
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends deliveries was_delivered 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_deliveries total_unique_deliveries 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[deliveries]
    • Aggregation aggregated to calculate total and unique deliveries
    • Output Columns:
      • total_deliveries: summed up
      • total_unique_deliveries: counted uniquely
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_delivered]
    • Aggregation This column is aggregated to calculate the total number of delivered emails.
    • Output Columns:
      • total_deliveries: Summed up for each contact
      • total_unique_deliveries: Counted as unique occurrences for each contact
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends drops 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_drops total_unique_drops 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[drops]
    • Aggregation aggregated to calculate total and unique drops
    • Output Columns:
      • total_drops: summed up
      • total_unique_drops: counted uniquely
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends forwards was_forwarded 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_forwards total_unique_forwards 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[forwards]
    • Aggregation aggregated to calculate total and unique forwards
    • Output Columns:
      • total_forwards: summed up
      • total_unique_forwards: counted uniquely
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_forwarded]
    • Aggregation This column is aggregated to calculate the total number of forwarded emails.
    • Output Columns:
      • total_forwards: Summed up for each contact
      • total_unique_forwards: Counted as unique occurrences for each contact
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends opens 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_opens total_unique_opens 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[opens]
    • Aggregation This column is aggregated to calculate the total number of open email events.
    • Output Columns:
      • total_opens: Summed up for each contact
      • total_unique_opens: Counted as unique occurrences for each contact
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends prints was_printed 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_prints total_unique_prints 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[prints]
    • Aggregation This column is aggregated to calculate the total number of print email events.
    • Output Columns:
      • total_prints: Summed up for each contact
      • total_unique_prints: Counted as unique occurrences for each contact
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_printed]
    • Aggregation This column is used to count the total number of print email events and unique print email events.
    • Output Columns:
      • total_prints: Aggregated count of all print events
      • total_unique_prints: Aggregated count of unique print events
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends spam_reports was_spam_reported 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_spam_reports total_unique_spam_reports 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[spam_reports]
    • Aggregation This column is aggregated to calculate the total number of spam report email events.
    • Output Columns:
      • total_spam_reports: Summed up for each contact
      • total_unique_spam_reports: Counted as unique occurrences for each contact
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_spam_reported]
    • Aggregation This column is used to count the total number of spam report email events and unique spam report email events.
    • Output Columns:
      • total_spam_reports: Aggregated count of all spam report events
      • total_unique_spam_reports: Aggregated count of unique spam report events
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_id unsubscribes was_unsubcribed 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f2->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f2->5. model.hubspot.hubspot__contacts:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change email_send_id 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_id 20. model.hubspot.hubspot__email_event_status_change:f0->30. model.hubspot.int_hubspot__email_aggregate_status_change:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
30. model.hubspot.int_hubspot__email_aggregate_status_change
  • Input Column: 20. model.hubspot.hubspot__email_event_status_change[email_send_id]
    • Filtering The column is filtered to exclude null values (WHERE NOT email_send_id IS NULL)
    • Aggregation The column is used in the GROUP BY clause
    • Output Columns:
      • email_send_id: This column is directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate the total number of unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Summed up for each contact
      • total_unique_unsubscribes: Counted as unique occurrences for each contact
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is used to count the total number of unsubscribe email events and unique unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribe events
      • total_unique_unsubscribes: Aggregated count of unique unsubscribe events
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust calculated_merged_vids 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts calculated_merged_vids 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[calculated_merged_vids]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • calculated_merged_vids: Directly copied
6. model.hubspot.hubspot__deal_history

This SQL query processes deal property history data from Hubspot. It creates a comprehensive view of deal property changes over time by establishing valid time ranges for each property value. The query also generates a unique identifier for each record using a combination of field name, deal ID, and valid from date.

FeaturizationOther
SQL Query
WITH history AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal_property_history
), windows AS (
  SELECT
    deal_id,
    field_name,
    change_source,
    change_source_id,
    change_timestamp AS valid_from,
    new_value,
    LEAD(change_timestamp) OVER (PARTITION BY deal_id, field_name ORDER BY change_timestamp) AS valid_to
  FROM history
), surrogate AS (
  SELECT
    windows.*,
    MD5(
      CAST(COALESCE(CAST(field_name AS TEXT), '_dbt_utils_surrogate_key_null_') || '-' || COALESCE(CAST(deal_id AS TEXT), '_dbt_utils_surrogate_key_null_') || '-' || COALESCE(CAST(valid_from AS TEXT), '_dbt_utils_surrogate_key_null_') AS TEXT)
    ) AS id
  FROM windows
)
SELECT
  *
FROM surrogate
%3 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history _fivetran_synced change_source change_source_id valid_from valid_to deal_id field_name new_value id 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history change_source change_source_id change_timestamp deal_id field_name new_value 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f1 55. model.hubspot_source.stg_hubspot__deal_property_history:f1->6. model.hubspot.hubspot__deal_history:f2 55. model.hubspot_source.stg_hubspot__deal_property_history:f2->6. model.hubspot.hubspot__deal_history:f3 55. model.hubspot_source.stg_hubspot__deal_property_history:f2->6. model.hubspot.hubspot__deal_history:f4 55. model.hubspot_source.stg_hubspot__deal_property_history:f2->6. model.hubspot.hubspot__deal_history:f8 55. model.hubspot_source.stg_hubspot__deal_property_history:f3->6. model.hubspot.hubspot__deal_history:f5 55. model.hubspot_source.stg_hubspot__deal_property_history:f3->6. model.hubspot.hubspot__deal_history:f8 55. model.hubspot_source.stg_hubspot__deal_property_history:f4->6. model.hubspot.hubspot__deal_history:f6 55. model.hubspot_source.stg_hubspot__deal_property_history:f4->6. model.hubspot.hubspot__deal_history:f8 55. model.hubspot_source.stg_hubspot__deal_property_history:f5->6. model.hubspot.hubspot__deal_history:f7
Name Type Comment
_fivetran_synced None Timestamp of when Fivetran synced a record.
change_source text The source (reason) of the change.
change_source_id text The ID of the object that caused the change, if applicable.
valid_from timestamp without time zone The timestamp the change was valid from.
valid_to timestamp without time zone The timestamp the change was valid to. Null if still valid.
deal_id bigint The ID of the related deal record.
field_name text The name of the field being changed.
new_value text The new value of the field.
id text The ID of the change.
Column Lineage
%3 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history change_source 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history change_source 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp source 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[source]
    • Other The column is renamed to 'change_source'
    • Output Columns:
      • change_source: Renamed from 'source'
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[change_source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source: Directly copied
Column Lineage
%3 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history change_source_id 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history change_source_id 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp source_id 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[source_id]
    • Other The column is renamed to 'change_source_id'
    • Output Columns:
      • change_source_id: Renamed from 'source_id'
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[change_source_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source_id: Directly copied
Column Lineage
%3 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history change_timestamp 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history id valid_from valid_to 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f1 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f2 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp timestamp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[timestamp]
    • Cleaning The column is cast to TIMESTAMP data type
    • Other The column is renamed to 'change_timestamp'
    • Output Columns:
      • change_timestamp: Renamed from 'timestamp' and cast to TIMESTAMP
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[change_timestamp]
    • Direct The column is directly copied as valid_from
    • Other Used in LEAD function to calculate valid_to
    • Featurization Used in MD5 function to create a unique id
    • Output Columns:
      • valid_from: Directly copied
      • valid_to: Used in LEAD function
      • id: Part of MD5 hash
Column Lineage
%3 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history change_timestamp 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history id valid_from valid_to 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f1 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f2 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp timestamp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[timestamp]
    • Cleaning The column is cast to TIMESTAMP data type
    • Other The column is renamed to 'change_timestamp'
    • Output Columns:
      • change_timestamp: Renamed from 'timestamp' and cast to TIMESTAMP
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[change_timestamp]
    • Direct The column is directly copied as valid_from
    • Other Used in LEAD function to calculate valid_to
    • Featurization Used in MD5 function to create a unique id
    • Output Columns:
      • valid_from: Directly copied
      • valid_to: Used in LEAD function
      • id: Part of MD5 hash
Column Lineage
%3 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history deal_id 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history deal_id id 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f1 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp deal_id 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly copied and cast to INT
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[deal_id]
    • Direct The column is directly copied
    • Deduplication Used in PARTITION BY clause for windowing
    • Featurization Used in MD5 function to create a unique id
    • Output Columns:
      • deal_id: Directly copied
      • id: Part of MD5 hash
Column Lineage
%3 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history field_name 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history field_name id 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f1 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp name 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[name]
    • Other The column is renamed to 'field_name'
    • Output Columns:
      • field_name: Renamed from 'name'
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[field_name]
    • Direct The column is directly copied
    • Deduplication Used in PARTITION BY clause for windowing
    • Featurization Used in MD5 function to create a unique id
    • Output Columns:
      • field_name: Directly copied
      • id: Part of MD5 hash
Column Lineage
%3 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history new_value 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history new_value 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp value 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[value]
    • Other The column is renamed to 'new_value'
    • Output Columns:
      • new_value: Renamed from 'value'
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[new_value]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • new_value: Directly copied
Column Lineage
%3 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history change_timestamp deal_id field_name 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history deal_id field_name id valid_from valid_to 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f3 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f4 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f2 55. model.hubspot_source.stg_hubspot__deal_property_history:f1->6. model.hubspot.hubspot__deal_history:f0 55. model.hubspot_source.stg_hubspot__deal_property_history:f1->6. model.hubspot.hubspot__deal_history:f2 55. model.hubspot_source.stg_hubspot__deal_property_history:f2->6. model.hubspot.hubspot__deal_history:f1 55. model.hubspot_source.stg_hubspot__deal_property_history:f2->6. model.hubspot.hubspot__deal_history:f2 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp deal_id name timestamp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f2->55. model.hubspot_source.stg_hubspot__deal_property_history:f0 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f1 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f1->55. model.hubspot_source.stg_hubspot__deal_property_history:f2
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[timestamp]
    • Cleaning The column is cast to TIMESTAMP data type
    • Other The column is renamed to 'change_timestamp'
    • Output Columns:
      • change_timestamp: Renamed from 'timestamp' and cast to TIMESTAMP
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly copied and cast to INT
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[name]
    • Other The column is renamed to 'field_name'
    • Output Columns:
      • field_name: Renamed from 'name'
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[change_timestamp]
    • Direct The column is directly copied as valid_from
    • Other Used in LEAD function to calculate valid_to
    • Featurization Used in MD5 function to create a unique id
    • Output Columns:
      • valid_from: Directly copied
      • valid_to: Used in LEAD function
      • id: Part of MD5 hash
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[deal_id]
    • Direct The column is directly copied
    • Deduplication Used in PARTITION BY clause for windowing
    • Featurization Used in MD5 function to create a unique id
    • Output Columns:
      • deal_id: Directly copied
      • id: Part of MD5 hash
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[field_name]
    • Direct The column is directly copied
    • Deduplication Used in PARTITION BY clause for windowing
    • Featurization Used in MD5 function to create a unique id
    • Output Columns:
      • field_name: Directly copied
      • id: Part of MD5 hash
7. model.hubspot.hubspot__deal_stages

This SQL query integrates data from multiple Hubspot-related tables (deals, pipelines, pipeline stages, owners) to create a comprehensive view of deal stages. It combines information about deals, their associated pipelines, stages, and owners, while also adding some derived fields. The query creates a unique identifier for each deal stage, includes various status flags, and incorporates temporal information about stage transitions.

IntegrationFeaturizationCleaning
SQL Query
WITH __dbt__cte__int_hubspot__deals_enhanced AS (
  WITH deals AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal
  ), pipelines AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal_pipeline
  ), pipeline_stages AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal_pipeline_stage
  ), owners AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__owner
  ), deal_fields_joined AS (
    SELECT
      deals.*,
      COALESCE(pipelines.is_deal_pipeline_deleted, FALSE) AS is_deal_pipeline_deleted,
      pipelines.pipeline_label,
      pipelines.is_active AS is_pipeline_active,
      COALESCE(pipeline_stages.is_deal_pipeline_stage_deleted, FALSE) AS is_deal_pipeline_stage_deleted,
      pipelines.deal_pipeline_created_at,
      pipelines.deal_pipeline_updated_at,
      pipeline_stages.pipeline_stage_label,
      owners.email_address AS owner_email_address,
      owners.full_name AS owner_full_name
    FROM deals
    LEFT JOIN pipelines
      ON deals.deal_pipeline_id = pipelines.deal_pipeline_id
    LEFT JOIN pipeline_stages
      ON deals.deal_pipeline_stage_id = pipeline_stages.deal_pipeline_stage_id
    LEFT JOIN owners
      ON deals.owner_id = owners.owner_id
  )
  SELECT
    *
  FROM deal_fields_joined
), deals_enhanced AS (
  SELECT
    *
  FROM __dbt__cte__int_hubspot__deals_enhanced
), deal_stage AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal_stage
), pipeline_stage AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal_pipeline_stage
), pipeline AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal_pipeline
), final AS (
  SELECT
    deal_stage.deal_id || '-' || ROW_NUMBER() OVER (PARTITION BY deal_stage.deal_id ORDER BY deal_stage.date_entered ASC) AS deal_stage_id,
    deals_enhanced.deal_id,
    deals_enhanced.deal_name,
    deal_stage._fivetran_start AS date_stage_entered,
    deal_stage._fivetran_end AS date_stage_exited,
    deal_stage._fivetran_active AS is_stage_active,
    deal_stage.deal_stage_name AS pipeline_stage_id,
    pipeline_stage.pipeline_stage_label,
    pipeline_stage.deal_pipeline_id AS pipeline_id,
    pipeline.pipeline_label,
    deal_stage.source,
    deal_stage.source_id,
    pipeline_stage.is_active AS is_pipeline_stage_active,
    pipeline.is_active AS is_pipeline_active,
    pipeline_stage.is_closed_won AS is_pipeline_stage_closed_won,
    pipeline_stage.display_order AS pipeline_stage_display_order,
    pipeline.display_order AS pipeline_display_order,
    pipeline_stage.probability AS pipeline_stage_probability,
    COALESCE(pipeline.is_deal_pipeline_deleted, FALSE) AS is_deal_pipeline_deleted,
    COALESCE(pipeline_stage.is_deal_pipeline_stage_deleted, FALSE) AS is_deal_pipeline_stage_deleted,
    COALESCE(deals_enhanced.is_deal_deleted, FALSE) AS is_deal_deleted,
    pipeline_stage.deal_pipeline_stage_created_at,
    pipeline_stage.deal_pipeline_stage_updated_at
  FROM deal_stage
  LEFT JOIN pipeline_stage
    ON deal_stage.deal_stage_name = pipeline_stage.deal_pipeline_stage_id
  LEFT JOIN pipeline
    ON pipeline_stage.deal_pipeline_id = pipeline.deal_pipeline_id
  LEFT JOIN deals_enhanced
    ON deal_stage.deal_id = deals_enhanced.deal_id
)
SELECT
  *
FROM final
%3 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages deal_stage_id is_deal_pipeline_deleted is_deal_pipeline_stage_deleted is_deal_deleted pipeline_stage_id date_stage_entered date_stage_exited is_stage_active deal_id merged_deal_ids pipeline_id pipeline_label is_pipeline_active is_pipeline_stage_active pipeline_stage_label source source_id is_pipeline_stage_closed_won pipeline_stage_display_order pipeline_display_order pipeline_stage_probability deal_name deal_pipeline_stage_created_at deal_pipeline_stage_updated_at 29. model.hubspot.int_hubspot__deals_enhanced 29. model.hubspot.int_hubspot__deals_enhanced 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline is_deal_pipeline_deleted deal_pipeline_id display_order is_active pipeline_label 51. model.hubspot_source.stg_hubspot__deal_pipeline:f0->7. model.hubspot.hubspot__deal_stages:f1 51. model.hubspot_source.stg_hubspot__deal_pipeline:f1->7. model.hubspot.hubspot__deal_stages:f10 51. model.hubspot_source.stg_hubspot__deal_pipeline:f2->7. model.hubspot.hubspot__deal_stages:f19 51. model.hubspot_source.stg_hubspot__deal_pipeline:f3->7. model.hubspot.hubspot__deal_stages:f12 51. model.hubspot_source.stg_hubspot__deal_pipeline:f4->7. model.hubspot.hubspot__deal_stages:f11 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage is_deal_pipeline_stage_deleted deal_pipeline_id deal_pipeline_stage_id display_order is_active is_closed_won pipeline_stage_label probability deal_pipeline_stage_created_at deal_pipeline_stage_updated_at 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f2 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f1->7. model.hubspot.hubspot__deal_stages:f10 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f2->7. model.hubspot.hubspot__deal_stages:f4 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f3->7. model.hubspot.hubspot__deal_stages:f18 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f4->7. model.hubspot.hubspot__deal_stages:f13 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f5->7. model.hubspot.hubspot__deal_stages:f17 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f6->7. model.hubspot.hubspot__deal_stages:f14 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f7->7. model.hubspot.hubspot__deal_stages:f20 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f8->7. model.hubspot.hubspot__deal_stages:f22 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f9->7. model.hubspot.hubspot__deal_stages:f23 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage _fivetran_active _fivetran_end _fivetran_start date_entered deal_id source source_id deal_stage_name 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f7 57. model.hubspot_source.stg_hubspot__deal_stage:f1->7. model.hubspot.hubspot__deal_stages:f6 57. model.hubspot_source.stg_hubspot__deal_stage:f2->7. model.hubspot.hubspot__deal_stages:f5 57. model.hubspot_source.stg_hubspot__deal_stage:f3->7. model.hubspot.hubspot__deal_stages:f0 57. model.hubspot_source.stg_hubspot__deal_stage:f4->7. model.hubspot.hubspot__deal_stages:f8 57. model.hubspot_source.stg_hubspot__deal_stage:f4->7. model.hubspot.hubspot__deal_stages:f0 57. model.hubspot_source.stg_hubspot__deal_stage:f5->7. model.hubspot.hubspot__deal_stages:f15 57. model.hubspot_source.stg_hubspot__deal_stage:f6->7. model.hubspot.hubspot__deal_stages:f16 57. model.hubspot_source.stg_hubspot__deal_stage:f7->7. model.hubspot.hubspot__deal_stages:f4
Name Type Comment
deal_stage_id text The unique deal stage identifier.
is_deal_pipeline_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
is_deal_pipeline_stage_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
is_deal_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
pipeline_stage_id text The ID of the deal's pipeline stage.
date_stage_entered timestamp without time zone The timestamp the deal stage was entered.
date_stage_exited timestamp without time zone The Fivetran calculated exit time of the deal stage.
is_stage_active boolean Boolean indicating whether the deal stage active.
deal_id bigint The ID of the deal.
merged_deal_ids None A list of deals that had previously been merged into this record.
pipeline_id text The ID of the deal's pipeline.
pipeline_label text The label of the deal's pipeline.
is_pipeline_active boolean Boolean indicating if the pipeline is active.
is_pipeline_stage_active boolean Boolean indicating if the pipeline stage is active.
pipeline_stage_label text The label of the deal's pipeline stage.
source text The relevant source of the deal stage.
source_id text Reference to the source.
is_pipeline_stage_closed_won boolean Whether the stage represents a Closed Won deal.
pipeline_stage_display_order integer Used to determine the order in which the stages appear when viewed in HubSpot.
pipeline_display_order integer Used to determine the order in which the pipelines appear when viewed in HubSpot.
pipeline_stage_probability double precision The probability that the deal will close. Used for the deal forecast.
deal_name text The name you have given this deal.
deal_pipeline_stage_created_at text A timestamp representing when the deal_pipeline_stage was created.
deal_pipeline_stage_updated_at text A timestamp representing when the deal_pipeline_stage was updated.
Column Lineage
%3 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage date_entered deal_id 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages deal_id deal_stage_id 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f1 57. model.hubspot_source.stg_hubspot__deal_stage:f1->7. model.hubspot.hubspot__deal_stages:f0 57. model.hubspot_source.stg_hubspot__deal_stage:f1->7. model.hubspot.hubspot__deal_stages:f1 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp date_entered deal_id 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f1->57. model.hubspot_source.stg_hubspot__deal_stage:f1
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[date_entered]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • date_entered: Directly mapped after casting
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[deal_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • deal_id: Directly mapped
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[date_entered]
    • Deduplication Used in the ROW_NUMBER() function to create a unique identifier
    • Output Columns:
      • deal_stage_id: Partially used in creating this unique identifier
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[deal_id]
    • Direct Directly copied to the output
    • Integration Used to join with the deals_enhanced CTE
    • Deduplication Used in creating a unique identifier for deal_stage_id
    • Output Columns:
      • deal_id: Directly mapped to this output column
      • deal_stage_id: Partially used in creating this unique identifier
Column Lineage
%3 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline is_deal_pipeline_deleted 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages is_deal_pipeline_deleted 51. model.hubspot_source.stg_hubspot__deal_pipeline:f0->7. model.hubspot.hubspot__deal_stages:f0 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp _fivetran_deleted 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[_fivetran_deleted]
    • Cleaning The column is renamed
    • Output Columns:
      • is_deal_pipeline_deleted: It is directly copied and renamed
7. model.hubspot.hubspot__deal_stages
  • Input Column: 51. model.hubspot_source.stg_hubspot__deal_pipeline[is_deal_pipeline_deleted]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cleaned by applying a COALESCE function to handle NULL values
    • Output Columns:
      • is_deal_pipeline_deleted: Directly mapped after COALESCE
Column Lineage
%3 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage is_deal_pipeline_stage_deleted 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages is_deal_pipeline_stage_deleted 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp _fivetran_deleted 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[_fivetran_deleted]
    • Cleaning The column is cast to BOOLEAN and renamed
    • Output Columns:
      • is_deal_pipeline_stage_deleted: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[is_deal_pipeline_stage_deleted]
    • Direct The column is directly copied to the output
    • Cleaning The column is cleaned by applying a COALESCE function to handle NULL values
    • Output Columns:
      • is_deal_pipeline_stage_deleted: Directly copied and cleaned with COALESCE
Column Lineage
%3 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage deal_pipeline_stage_id 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_stage_id 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage deal_stage_name 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp stage_id 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp value 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[stage_id]
    • Cleaning The column is cast to TEXT and renamed
    • Output Columns:
      • deal_pipeline_stage_id: Directly mapped after casting
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[value]
    • Other The column is renamed to 'deal_stage_name'
    • Output Columns:
      • deal_stage_name: Mapped with renaming
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[deal_pipeline_stage_id]
    • Integration The column is used as a key to join with the deal_stage table
    • Output Columns:
      • pipeline_stage_id: Indirectly mapped through the join operation
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[deal_stage_name]
    • Integration Used to join with the pipeline_stage CTE
    • Direct Directly copied to the output
    • Output Columns:
      • pipeline_stage_id: Directly mapped to this output column
Column Lineage
%3 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage _fivetran_start 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages date_stage_entered 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp _fivetran_start 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[_fivetran_start]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_start: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[_fivetran_start]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • date_stage_entered: Directly mapped to this output column
Column Lineage
%3 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage _fivetran_end 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages date_stage_exited 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp _fivetran_end 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[_fivetran_end]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_end: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[_fivetran_end]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • date_stage_exited: Directly mapped to this output column
Column Lineage
%3 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage _fivetran_active 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages is_stage_active 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp _fivetran_active 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[_fivetran_active]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • _fivetran_active: Directly mapped
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[_fivetran_active]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • is_stage_active: Directly mapped to this output column
Column Lineage
%3 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage deal_id 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages deal_id deal_stage_id 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f1 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp deal_id 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[deal_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • deal_id: Directly mapped
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[deal_id]
    • Direct Directly copied to the output
    • Integration Used to join with the deals_enhanced CTE
    • Deduplication Used in creating a unique identifier for deal_stage_id
    • Output Columns:
      • deal_id: Directly mapped to this output column
      • deal_stage_id: Partially used in creating this unique identifier
Column Lineage
%3 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline deal_pipeline_id 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_id 51. model.hubspot_source.stg_hubspot__deal_pipeline:f0->7. model.hubspot.hubspot__deal_stages:f0 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage deal_pipeline_id 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp pipeline_id 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp pipeline_id 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[pipeline_id]
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • deal_pipeline_id: It is directly copied after casting
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[pipeline_id]
    • Cleaning The column is cast to TEXT and renamed
    • Output Columns:
      • deal_pipeline_id: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 51. model.hubspot_source.stg_hubspot__deal_pipeline[deal_pipeline_id]
    • Integration The column is used as a key to join with other tables
    • Output Columns:
      • pipeline_id: Mapped through joins and selection in the final subquery
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[deal_pipeline_id]
    • Integration The column is used as a key to join with the pipeline table
    • Output Columns:
      • pipeline_id: Indirectly mapped through the join operation
Column Lineage
%3 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline pipeline_label 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_label 51. model.hubspot_source.stg_hubspot__deal_pipeline:f0->7. model.hubspot.hubspot__deal_stages:f0 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp label 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[label]
    • Cleaning The column is renamed
    • Output Columns:
      • pipeline_label: It is directly copied and renamed
7. model.hubspot.hubspot__deal_stages
  • Input Column: 51. model.hubspot_source.stg_hubspot__deal_pipeline[pipeline_label]
    • Direct The column is directly selected in the final subquery
    • Output Columns:
      • pipeline_label: Directly mapped in the final SELECT statement
Column Lineage
%3 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline is_active 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages is_pipeline_active 51. model.hubspot_source.stg_hubspot__deal_pipeline:f0->7. model.hubspot.hubspot__deal_stages:f0 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp active 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[active]
    • Cleaning The column is renamed
    • Output Columns:
      • is_active: It is directly copied and renamed
7. model.hubspot.hubspot__deal_stages
  • Input Column: 51. model.hubspot_source.stg_hubspot__deal_pipeline[is_active]
    • Direct The column is directly selected in the final subquery
    • Output Columns:
      • is_pipeline_active: Directly mapped in the final SELECT statement
Column Lineage
%3 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage is_active 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages is_pipeline_stage_active 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp active 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[active]
    • Cleaning The column is cast to BOOLEAN and renamed
    • Output Columns:
      • is_active: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[is_active]
    • Direct The column is directly copied to the output
    • Output Columns:
      • is_pipeline_stage_active: Directly copied
Column Lineage
%3 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage pipeline_stage_label 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_stage_label 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp label 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[label]
    • Cleaning The column is cast to TEXT and renamed
    • Output Columns:
      • pipeline_stage_label: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[pipeline_stage_label]
    • Direct The column is directly copied to the output
    • Output Columns:
      • pipeline_stage_label: Directly copied
Column Lineage
%3 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage source 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages source 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp source 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[source]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • source: Directly mapped
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[source]
    • Direct Directly copied to the output
    • Output Columns:
      • source: Directly mapped to this output column
Column Lineage
%3 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage source_id 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages source_id 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp source_id 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[source_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • source_id: Directly mapped
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[source_id]
    • Direct Directly copied to the output
    • Output Columns:
      • source_id: Directly mapped to this output column
Column Lineage
%3 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage is_closed_won 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages is_pipeline_stage_closed_won 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp closed_won 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[closed_won]
    • Cleaning The column is cast to BOOLEAN and renamed
    • Output Columns:
      • is_closed_won: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[is_closed_won]
    • Direct The column is directly copied to the output
    • Output Columns:
      • is_pipeline_stage_closed_won: Directly copied
Column Lineage
%3 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage display_order 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_stage_display_order 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp display_order 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[display_order]
    • Cleaning The column is cast to INT
    • Direct The column is directly copied after casting
    • Output Columns:
      • display_order: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[display_order]
    • Direct The column is directly copied to the output
    • Output Columns:
      • pipeline_stage_display_order: Directly copied
Column Lineage
%3 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline display_order 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_display_order 51. model.hubspot_source.stg_hubspot__deal_pipeline:f0->7. model.hubspot.hubspot__deal_stages:f0 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp display_order 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[display_order]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • display_order: It is directly copied
7. model.hubspot.hubspot__deal_stages
  • Input Column: 51. model.hubspot_source.stg_hubspot__deal_pipeline[display_order]
    • Direct The column is directly selected in the final subquery
    • Output Columns:
      • pipeline_display_order: Directly mapped in the final SELECT statement
Column Lineage
%3 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage probability 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_stage_probability 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp probability 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[probability]
    • Cleaning The column is cast to FLOAT
    • Direct The column is directly copied after casting
    • Output Columns:
      • probability: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[probability]
    • Direct The column is directly copied to the output
    • Output Columns:
      • pipeline_stage_probability: Directly copied
Column Lineage
%3 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage deal_pipeline_stage_created_at 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages deal_pipeline_stage_created_at 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp created_at 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[created_at]
    • Cleaning The column is cast to TIMESTAMP and renamed
    • Output Columns:
      • deal_pipeline_stage_created_at: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[deal_pipeline_stage_created_at]
    • Direct The column is directly copied to the output
    • Output Columns:
      • deal_pipeline_stage_created_at: Directly copied
Column Lineage
%3 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage deal_pipeline_stage_updated_at 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages deal_pipeline_stage_updated_at 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp updated_at 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[updated_at]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cleaned by casting it to a TIMESTAMP data type
    • Output Columns:
      • deal_pipeline_stage_updated_at: The 'updated_at' column is directly mapped to 'deal_pipeline_stage_updated_at' with a TIMESTAMP cast
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[deal_pipeline_stage_updated_at]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • deal_pipeline_stage_updated_at: It is directly copied to the output column with the same name
8. model.hubspot.hubspot__deals

This SQL query integrates data from multiple Hubspot-related tables to create a comprehensive view of deals. It combines deal information with related pipeline, stage, and owner details. The query also aggregates engagement data (notes, tasks, calls, meetings, emails) for each deal. The result is a detailed dataset that includes deal attributes, associated metadata, and engagement counts.

IntegrationAggregationFeaturization
SQL Query
WITH __dbt__cte__int_hubspot__deals_enhanced AS (
  WITH deals AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal
  ), pipelines AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal_pipeline
  ), pipeline_stages AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal_pipeline_stage
  ), owners AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__owner
  ), deal_fields_joined AS (
    SELECT
      deals.*,
      COALESCE(pipelines.is_deal_pipeline_deleted, FALSE) AS is_deal_pipeline_deleted,
      pipelines.pipeline_label,
      pipelines.is_active AS is_pipeline_active,
      COALESCE(pipeline_stages.is_deal_pipeline_stage_deleted, FALSE) AS is_deal_pipeline_stage_deleted,
      pipelines.deal_pipeline_created_at,
      pipelines.deal_pipeline_updated_at,
      pipeline_stages.pipeline_stage_label,
      owners.email_address AS owner_email_address,
      owners.full_name AS owner_full_name
    FROM deals
    LEFT JOIN pipelines
      ON deals.deal_pipeline_id = pipelines.deal_pipeline_id
    LEFT JOIN pipeline_stages
      ON deals.deal_pipeline_stage_id = pipeline_stages.deal_pipeline_stage_id
    LEFT JOIN owners
      ON deals.owner_id = owners.owner_id
  )
  SELECT
    *
  FROM deal_fields_joined
), deals_enhanced AS (
  SELECT
    *
  FROM __dbt__cte__int_hubspot__deals_enhanced
), engagements AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.hubspot__engagements
), engagement_deals AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_deal
), engagement_deal_joined AS (
  SELECT
    engagements.engagement_type,
    engagement_deals.deal_id
  FROM engagements
  INNER JOIN engagement_deals
    ON CAST(engagements.engagement_id AS BIGINT) = CAST(engagement_deals.engagement_id AS BIGINT)
), engagement_deal_agg AS (
  SELECT
    deal_id,
    COUNT(CASE WHEN engagement_type = 'NOTE' THEN deal_id END) AS count_engagement_notes,
    COUNT(CASE WHEN engagement_type = 'TASK' THEN deal_id END) AS count_engagement_tasks,
    COUNT(CASE WHEN engagement_type = 'CALL' THEN deal_id END) AS count_engagement_calls,
    COUNT(CASE WHEN engagement_type = 'MEETING' THEN deal_id END) AS count_engagement_meetings,
    COUNT(CASE WHEN engagement_type = 'EMAIL' THEN deal_id END) AS count_engagement_emails,
    COUNT(CASE WHEN engagement_type = 'INCOMING_EMAIL' THEN deal_id END) AS count_engagement_incoming_emails,
    COUNT(CASE WHEN engagement_type = 'FORWARDED_EMAIL' THEN deal_id END) AS count_engagement_forwarded_emails
  FROM engagement_deal_joined
  GROUP BY
    1
), engagements_joined AS (
  SELECT
    deals_enhanced.*,
    COALESCE(engagement_deal_agg.count_engagement_notes, 0) AS count_engagement_notes,
    COALESCE(engagement_deal_agg.count_engagement_tasks, 0) AS count_engagement_tasks,
    COALESCE(engagement_deal_agg.count_engagement_calls, 0) AS count_engagement_calls,
    COALESCE(engagement_deal_agg.count_engagement_meetings, 0) AS count_engagement_meetings,
    COALESCE(engagement_deal_agg.count_engagement_emails, 0) AS count_engagement_emails,
    COALESCE(engagement_deal_agg.count_engagement_incoming_emails, 0) AS count_engagement_incoming_emails,
    COALESCE(engagement_deal_agg.count_engagement_forwarded_emails, 0) AS count_engagement_forwarded_emails
  FROM deals_enhanced
  LEFT JOIN engagement_deal_agg
    ON CAST(deals_enhanced.deal_id AS BIGINT) = CAST(engagement_deal_agg.deal_id AS BIGINT)
)
SELECT
  *
FROM engagements_joined
%3 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals _fivetran_synced description amount closed_date created_date deal_id deal_name merged_deal_ids is_deal_deleted is_deal_pipeline_deleted is_deal_pipeline_stage_deleted portal_id deal_pipeline_id deal_pipeline_stage_id owner_id count_engagement_notes count_engagement_tasks count_engagement_calls count_engagement_meetings count_engagement_emails count_engagement_incoming_emails count_engagement_forwarded_emails is_pipeline_active pipeline_label pipeline_stage_label owner_email_address owner_full_name deal_pipeline_created_at deal_pipeline_updated_at 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_id engagement_type deal_ids 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f15 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f16 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f17 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f18 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f19 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f20 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f21 27. model.hubspot.hubspot__engagements:f2->8. model.hubspot.hubspot__deals:f15 27. model.hubspot.hubspot__engagements:f2->8. model.hubspot.hubspot__deals:f16 27. model.hubspot.hubspot__engagements:f2->8. model.hubspot.hubspot__deals:f17 27. model.hubspot.hubspot__engagements:f2->8. model.hubspot.hubspot__deals:f18 27. model.hubspot.hubspot__engagements:f2->8. model.hubspot.hubspot__deals:f19 27. model.hubspot.hubspot__engagements:f2->8. model.hubspot.hubspot__deals:f20 27. model.hubspot.hubspot__engagements:f2->8. model.hubspot.hubspot__deals:f21 29. model.hubspot.int_hubspot__deals_enhanced 29. model.hubspot.int_hubspot__deals_enhanced 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal deal_id engagement_id engagement_type 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->8. model.hubspot.hubspot__deals:f5 93. model.hubspot_source.stg_hubspot__engagement_deal:f2->8. model.hubspot.hubspot__deals:f15 93. model.hubspot_source.stg_hubspot__engagement_deal:f2->8. model.hubspot.hubspot__deals:f16 93. model.hubspot_source.stg_hubspot__engagement_deal:f2->8. model.hubspot.hubspot__deals:f17 93. model.hubspot_source.stg_hubspot__engagement_deal:f2->8. model.hubspot.hubspot__deals:f18 93. model.hubspot_source.stg_hubspot__engagement_deal:f2->8. model.hubspot.hubspot__deals:f19 93. model.hubspot_source.stg_hubspot__engagement_deal:f2->8. model.hubspot.hubspot__deals:f20 93. model.hubspot_source.stg_hubspot__engagement_deal:f2->8. model.hubspot.hubspot__deals:f21
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
description text A brief description of the deal.
amount integer The total value of the deal in the deal's currency.
closed_date timestamp without time zone The day the deal is expected to close, or was closed.
created_date timestamp without time zone The date the deal was created. This property is set automatically by HubSpot.
deal_id bigint The ID of the deal
deal_name text The name you have given this deal.
merged_deal_ids None A list of deals that had previously been merged into this record.
is_deal_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
is_deal_pipeline_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
is_deal_pipeline_stage_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
portal_id integer The hub ID.
deal_pipeline_id text The ID of the deal's pipeline.
deal_pipeline_stage_id text The ID of the deal's pipeline stage.
owner_id bigint The ID of the deal's owner.
count_engagement_notes bigint The total number of related note engagements.
count_engagement_tasks bigint The total number of related task engagements.
count_engagement_calls bigint The total number of related call engagements.
count_engagement_meetings bigint The total number of related meeting engagements.
count_engagement_emails bigint The total number of related email engagements.
count_engagement_incoming_emails bigint The total number of related incoming email engagements.
count_engagement_forwarded_emails bigint The total number of related forwarded email engagements.
is_pipeline_active boolean Boolean indicating if the pipeline is active.
pipeline_label text The label of the deal's pipeline.
pipeline_stage_label text The label of the deal's pipeline stage.
owner_email_address text The email address of the deal's owner.
owner_full_name text The full name of the deal's owner.
deal_pipeline_created_at text A timestamp representing when the deal_pipeline was created.
deal_pipeline_updated_at text A timestamp representing when the deal_pipeline was updated.
Column Lineage
%3 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal deal_id 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals deal_id 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->8. model.hubspot.hubspot__deals:f0 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp deal_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly mapped after casting to INT
8. model.hubspot.hubspot__deals
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[deal_id]
    • Integration Used as a key to join with the deals_enhanced table
    • Aggregation Used as the grouping column for engagement counts
    • Output Columns:
      • deal_id: Indirectly mapped as it's used to join and aggregate, but not directly output
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements deal_ids engagement_type 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f2 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f2 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal deal_id engagement_type 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f5 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f6 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f0 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f4 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f1 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f3 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f2 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f1 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp deal_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly mapped after casting to INT
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[deal_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • deal_ids: The deal_id is aggregated into the deal_ids array in the output
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Output Columns:
      • count_engagement_notes: Aggregated into this output column
      • count_engagement_tasks: Aggregated into this output column
      • count_engagement_calls: Aggregated into this output column
      • count_engagement_meetings: Aggregated into this output column
      • count_engagement_emails: Aggregated into this output column
      • count_engagement_incoming_emails: Aggregated into this output column
      • count_engagement_forwarded_emails: Aggregated into this output column
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Integration This column is used to join the engagements table with the engagement_deals table
    • Aggregation It's indirectly used for aggregation after joining with engagement_deals
    • Output Columns:
      • count_engagement_notes: Aggregated count of engagements where type is 'NOTE'
      • count_engagement_tasks: Aggregated count of engagements where type is 'TASK'
      • count_engagement_calls: Aggregated count of engagements where type is 'CALL'
      • count_engagement_meetings: Aggregated count of engagements where type is 'MEETING'
      • count_engagement_emails: Aggregated count of engagements where type is 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count of engagements where type is 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count of engagements where type is 'FORWARDED_EMAIL'
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[engagement_type]
    • Featurization Used to create separate count features for different engagement types
    • Aggregation Aggregated to create count features
    • Output Columns:
      • count_engagement_notes: Aggregated count when engagement_type = 'NOTE'
      • count_engagement_tasks: Aggregated count when engagement_type = 'TASK'
      • count_engagement_calls: Aggregated count when engagement_type = 'CALL'
      • count_engagement_meetings: Aggregated count when engagement_type = 'MEETING'
      • count_engagement_emails: Aggregated count when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count when engagement_type = 'FORWARDED_EMAIL'
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements deal_ids engagement_type 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f2 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f2 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal deal_id engagement_type 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f5 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f6 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f0 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f4 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f1 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f3 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f2 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f1 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp deal_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly mapped after casting to INT
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[deal_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • deal_ids: The deal_id is aggregated into the deal_ids array in the output
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Output Columns:
      • count_engagement_notes: Aggregated into this output column
      • count_engagement_tasks: Aggregated into this output column
      • count_engagement_calls: Aggregated into this output column
      • count_engagement_meetings: Aggregated into this output column
      • count_engagement_emails: Aggregated into this output column
      • count_engagement_incoming_emails: Aggregated into this output column
      • count_engagement_forwarded_emails: Aggregated into this output column
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Integration This column is used to join the engagements table with the engagement_deals table
    • Aggregation It's indirectly used for aggregation after joining with engagement_deals
    • Output Columns:
      • count_engagement_notes: Aggregated count of engagements where type is 'NOTE'
      • count_engagement_tasks: Aggregated count of engagements where type is 'TASK'
      • count_engagement_calls: Aggregated count of engagements where type is 'CALL'
      • count_engagement_meetings: Aggregated count of engagements where type is 'MEETING'
      • count_engagement_emails: Aggregated count of engagements where type is 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count of engagements where type is 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count of engagements where type is 'FORWARDED_EMAIL'
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[engagement_type]
    • Featurization Used to create separate count features for different engagement types
    • Aggregation Aggregated to create count features
    • Output Columns:
      • count_engagement_notes: Aggregated count when engagement_type = 'NOTE'
      • count_engagement_tasks: Aggregated count when engagement_type = 'TASK'
      • count_engagement_calls: Aggregated count when engagement_type = 'CALL'
      • count_engagement_meetings: Aggregated count when engagement_type = 'MEETING'
      • count_engagement_emails: Aggregated count when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count when engagement_type = 'FORWARDED_EMAIL'
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements deal_ids engagement_type 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f2 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f2 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal deal_id engagement_type 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f5 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f6 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f0 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f4 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f1 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f3 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f2 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f1 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp deal_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly mapped after casting to INT
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[deal_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • deal_ids: The deal_id is aggregated into the deal_ids array in the output
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Output Columns:
      • count_engagement_notes: Aggregated into this output column
      • count_engagement_tasks: Aggregated into this output column
      • count_engagement_calls: Aggregated into this output column
      • count_engagement_meetings: Aggregated into this output column
      • count_engagement_emails: Aggregated into this output column
      • count_engagement_incoming_emails: Aggregated into this output column
      • count_engagement_forwarded_emails: Aggregated into this output column
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Integration This column is used to join the engagements table with the engagement_deals table
    • Aggregation It's indirectly used for aggregation after joining with engagement_deals
    • Output Columns:
      • count_engagement_notes: Aggregated count of engagements where type is 'NOTE'
      • count_engagement_tasks: Aggregated count of engagements where type is 'TASK'
      • count_engagement_calls: Aggregated count of engagements where type is 'CALL'
      • count_engagement_meetings: Aggregated count of engagements where type is 'MEETING'
      • count_engagement_emails: Aggregated count of engagements where type is 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count of engagements where type is 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count of engagements where type is 'FORWARDED_EMAIL'
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[engagement_type]
    • Featurization Used to create separate count features for different engagement types
    • Aggregation Aggregated to create count features
    • Output Columns:
      • count_engagement_notes: Aggregated count when engagement_type = 'NOTE'
      • count_engagement_tasks: Aggregated count when engagement_type = 'TASK'
      • count_engagement_calls: Aggregated count when engagement_type = 'CALL'
      • count_engagement_meetings: Aggregated count when engagement_type = 'MEETING'
      • count_engagement_emails: Aggregated count when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count when engagement_type = 'FORWARDED_EMAIL'
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements deal_ids engagement_type 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f2 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f2 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal deal_id engagement_type 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f5 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f6 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f0 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f4 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f1 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f3 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f2 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f1 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp deal_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly mapped after casting to INT
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[deal_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • deal_ids: The deal_id is aggregated into the deal_ids array in the output
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Output Columns:
      • count_engagement_notes: Aggregated into this output column
      • count_engagement_tasks: Aggregated into this output column
      • count_engagement_calls: Aggregated into this output column
      • count_engagement_meetings: Aggregated into this output column
      • count_engagement_emails: Aggregated into this output column
      • count_engagement_incoming_emails: Aggregated into this output column
      • count_engagement_forwarded_emails: Aggregated into this output column
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Integration This column is used to join the engagements table with the engagement_deals table
    • Aggregation It's indirectly used for aggregation after joining with engagement_deals
    • Output Columns:
      • count_engagement_notes: Aggregated count of engagements where type is 'NOTE'
      • count_engagement_tasks: Aggregated count of engagements where type is 'TASK'
      • count_engagement_calls: Aggregated count of engagements where type is 'CALL'
      • count_engagement_meetings: Aggregated count of engagements where type is 'MEETING'
      • count_engagement_emails: Aggregated count of engagements where type is 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count of engagements where type is 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count of engagements where type is 'FORWARDED_EMAIL'
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[engagement_type]
    • Featurization Used to create separate count features for different engagement types
    • Aggregation Aggregated to create count features
    • Output Columns:
      • count_engagement_notes: Aggregated count when engagement_type = 'NOTE'
      • count_engagement_tasks: Aggregated count when engagement_type = 'TASK'
      • count_engagement_calls: Aggregated count when engagement_type = 'CALL'
      • count_engagement_meetings: Aggregated count when engagement_type = 'MEETING'
      • count_engagement_emails: Aggregated count when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count when engagement_type = 'FORWARDED_EMAIL'
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements deal_ids engagement_type 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f2 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f2 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal deal_id engagement_type 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f5 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f6 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f0 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f4 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f1 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f3 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f2 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f1 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp deal_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly mapped after casting to INT
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[deal_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • deal_ids: The deal_id is aggregated into the deal_ids array in the output
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Output Columns:
      • count_engagement_notes: Aggregated into this output column
      • count_engagement_tasks: Aggregated into this output column
      • count_engagement_calls: Aggregated into this output column
      • count_engagement_meetings: Aggregated into this output column
      • count_engagement_emails: Aggregated into this output column
      • count_engagement_incoming_emails: Aggregated into this output column
      • count_engagement_forwarded_emails: Aggregated into this output column
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Integration This column is used to join the engagements table with the engagement_deals table
    • Aggregation It's indirectly used for aggregation after joining with engagement_deals
    • Output Columns:
      • count_engagement_notes: Aggregated count of engagements where type is 'NOTE'
      • count_engagement_tasks: Aggregated count of engagements where type is 'TASK'
      • count_engagement_calls: Aggregated count of engagements where type is 'CALL'
      • count_engagement_meetings: Aggregated count of engagements where type is 'MEETING'
      • count_engagement_emails: Aggregated count of engagements where type is 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count of engagements where type is 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count of engagements where type is 'FORWARDED_EMAIL'
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[engagement_type]
    • Featurization Used to create separate count features for different engagement types
    • Aggregation Aggregated to create count features
    • Output Columns:
      • count_engagement_notes: Aggregated count when engagement_type = 'NOTE'
      • count_engagement_tasks: Aggregated count when engagement_type = 'TASK'
      • count_engagement_calls: Aggregated count when engagement_type = 'CALL'
      • count_engagement_meetings: Aggregated count when engagement_type = 'MEETING'
      • count_engagement_emails: Aggregated count when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count when engagement_type = 'FORWARDED_EMAIL'
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements deal_ids engagement_type 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f2 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f2 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal deal_id engagement_type 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f5 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f6 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f0 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f4 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f1 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f3 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f2 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f1 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp deal_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly mapped after casting to INT
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[deal_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • deal_ids: The deal_id is aggregated into the deal_ids array in the output
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Output Columns:
      • count_engagement_notes: Aggregated into this output column
      • count_engagement_tasks: Aggregated into this output column
      • count_engagement_calls: Aggregated into this output column
      • count_engagement_meetings: Aggregated into this output column
      • count_engagement_emails: Aggregated into this output column
      • count_engagement_incoming_emails: Aggregated into this output column
      • count_engagement_forwarded_emails: Aggregated into this output column
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Integration This column is used to join the engagements table with the engagement_deals table
    • Aggregation It's indirectly used for aggregation after joining with engagement_deals
    • Output Columns:
      • count_engagement_notes: Aggregated count of engagements where type is 'NOTE'
      • count_engagement_tasks: Aggregated count of engagements where type is 'TASK'
      • count_engagement_calls: Aggregated count of engagements where type is 'CALL'
      • count_engagement_meetings: Aggregated count of engagements where type is 'MEETING'
      • count_engagement_emails: Aggregated count of engagements where type is 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count of engagements where type is 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count of engagements where type is 'FORWARDED_EMAIL'
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[engagement_type]
    • Featurization Used to create separate count features for different engagement types
    • Aggregation Aggregated to create count features
    • Output Columns:
      • count_engagement_notes: Aggregated count when engagement_type = 'NOTE'
      • count_engagement_tasks: Aggregated count when engagement_type = 'TASK'
      • count_engagement_calls: Aggregated count when engagement_type = 'CALL'
      • count_engagement_meetings: Aggregated count when engagement_type = 'MEETING'
      • count_engagement_emails: Aggregated count when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count when engagement_type = 'FORWARDED_EMAIL'
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements deal_ids engagement_type 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f1->8. model.hubspot.hubspot__deals:f2 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f2 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal deal_id engagement_type 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f5 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f6 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f0 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f4 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f1 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f3 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->8. model.hubspot.hubspot__deals:f2 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f1 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp deal_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly mapped after casting to INT
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[deal_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • deal_ids: The deal_id is aggregated into the deal_ids array in the output
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Output Columns:
      • count_engagement_notes: Aggregated into this output column
      • count_engagement_tasks: Aggregated into this output column
      • count_engagement_calls: Aggregated into this output column
      • count_engagement_meetings: Aggregated into this output column
      • count_engagement_emails: Aggregated into this output column
      • count_engagement_incoming_emails: Aggregated into this output column
      • count_engagement_forwarded_emails: Aggregated into this output column
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Integration This column is used to join the engagements table with the engagement_deals table
    • Aggregation It's indirectly used for aggregation after joining with engagement_deals
    • Output Columns:
      • count_engagement_notes: Aggregated count of engagements where type is 'NOTE'
      • count_engagement_tasks: Aggregated count of engagements where type is 'TASK'
      • count_engagement_calls: Aggregated count of engagements where type is 'CALL'
      • count_engagement_meetings: Aggregated count of engagements where type is 'MEETING'
      • count_engagement_emails: Aggregated count of engagements where type is 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count of engagements where type is 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count of engagements where type is 'FORWARDED_EMAIL'
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[engagement_type]
    • Featurization Used to create separate count features for different engagement types
    • Aggregation Aggregated to create count features
    • Output Columns:
      • count_engagement_notes: Aggregated count when engagement_type = 'NOTE'
      • count_engagement_tasks: Aggregated count when engagement_type = 'TASK'
      • count_engagement_calls: Aggregated count when engagement_type = 'CALL'
      • count_engagement_meetings: Aggregated count when engagement_type = 'MEETING'
      • count_engagement_emails: Aggregated count when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count when engagement_type = 'FORWARDED_EMAIL'
9. model.hubspot.hubspot__email_campaigns

This SQL query joins data from two tables: 'stg_hubspot__email_campaign' and 'hubspot__email_sends'. It first creates CTEs for each table, then groups the email sends data by email_campaign_id. Finally, it performs a left join between the campaigns data and the grouped email metrics data, returning all columns from the campaigns table along with the matching email campaign IDs from the email metrics.

IntegrationAggregation
SQL Query
WITH campaigns AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_campaign
), email_sends AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.hubspot__email_sends
), email_metrics AS (
  SELECT
    email_campaign_id
  FROM email_sends
  GROUP BY
    1
), joined AS (
  SELECT
    campaigns.*
  FROM campaigns
  LEFT JOIN email_metrics
    ON campaigns.email_campaign_id = email_metrics.email_campaign_id
)
SELECT
  *
FROM joined
%3 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns _fivetran_synced app_id app_name content_id email_campaign_id email_campaign_name email_campaign_sub_type email_campaign_subject email_campaign_type num_included num_queued total_bounces total_clicks total_deferrals total_deliveries total_drops total_forwards total_opens total_prints total_spam_reports total_unsubscribes total_unique_bounces total_unique_clicks total_unique_deferrals total_unique_deliveries total_unique_drops total_unique_forwards total_unique_opens total_unique_prints total_unique_spam_reports total_unique_unsubscribes 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_campaign_id bounces clicks deferrals deliveries drops forwards opens prints spam_reports unsubscribes was_bounced was_clicked was_deferred was_delivered was_forwarded was_opened was_printed was_spam_reported was_unsubcribed 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f4 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f11 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f21 21. model.hubspot.hubspot__email_sends:f2->9. model.hubspot.hubspot__email_campaigns:f12 21. model.hubspot.hubspot__email_sends:f2->9. model.hubspot.hubspot__email_campaigns:f22 21. model.hubspot.hubspot__email_sends:f3->9. model.hubspot.hubspot__email_campaigns:f13 21. model.hubspot.hubspot__email_sends:f3->9. model.hubspot.hubspot__email_campaigns:f23 21. model.hubspot.hubspot__email_sends:f4->9. model.hubspot.hubspot__email_campaigns:f14 21. model.hubspot.hubspot__email_sends:f4->9. model.hubspot.hubspot__email_campaigns:f24 21. model.hubspot.hubspot__email_sends:f5->9. model.hubspot.hubspot__email_campaigns:f15 21. model.hubspot.hubspot__email_sends:f5->9. model.hubspot.hubspot__email_campaigns:f25 21. model.hubspot.hubspot__email_sends:f6->9. model.hubspot.hubspot__email_campaigns:f16 21. model.hubspot.hubspot__email_sends:f6->9. model.hubspot.hubspot__email_campaigns:f26 21. model.hubspot.hubspot__email_sends:f7->9. model.hubspot.hubspot__email_campaigns:f17 21. model.hubspot.hubspot__email_sends:f7->9. model.hubspot.hubspot__email_campaigns:f27 21. model.hubspot.hubspot__email_sends:f8->9. model.hubspot.hubspot__email_campaigns:f18 21. model.hubspot.hubspot__email_sends:f8->9. model.hubspot.hubspot__email_campaigns:f28 21. model.hubspot.hubspot__email_sends:f9->9. model.hubspot.hubspot__email_campaigns:f19 21. model.hubspot.hubspot__email_sends:f9->9. model.hubspot.hubspot__email_campaigns:f29 21. model.hubspot.hubspot__email_sends:f10->9. model.hubspot.hubspot__email_campaigns:f20 21. model.hubspot.hubspot__email_sends:f10->9. model.hubspot.hubspot__email_campaigns:f30 21. model.hubspot.hubspot__email_sends:f11->9. model.hubspot.hubspot__email_campaigns:f11 21. model.hubspot.hubspot__email_sends:f11->9. model.hubspot.hubspot__email_campaigns:f21 21. model.hubspot.hubspot__email_sends:f12->9. model.hubspot.hubspot__email_campaigns:f12 21. model.hubspot.hubspot__email_sends:f12->9. model.hubspot.hubspot__email_campaigns:f22 21. model.hubspot.hubspot__email_sends:f13->9. model.hubspot.hubspot__email_campaigns:f13 21. model.hubspot.hubspot__email_sends:f13->9. model.hubspot.hubspot__email_campaigns:f23 21. model.hubspot.hubspot__email_sends:f14->9. model.hubspot.hubspot__email_campaigns:f14 21. model.hubspot.hubspot__email_sends:f14->9. model.hubspot.hubspot__email_campaigns:f24 21. model.hubspot.hubspot__email_sends:f15->9. model.hubspot.hubspot__email_campaigns:f16 21. model.hubspot.hubspot__email_sends:f15->9. model.hubspot.hubspot__email_campaigns:f26 21. model.hubspot.hubspot__email_sends:f16->9. model.hubspot.hubspot__email_campaigns:f17 21. model.hubspot.hubspot__email_sends:f16->9. model.hubspot.hubspot__email_campaigns:f27 21. model.hubspot.hubspot__email_sends:f17->9. model.hubspot.hubspot__email_campaigns:f18 21. model.hubspot.hubspot__email_sends:f17->9. model.hubspot.hubspot__email_campaigns:f28 21. model.hubspot.hubspot__email_sends:f18->9. model.hubspot.hubspot__email_campaigns:f19 21. model.hubspot.hubspot__email_sends:f18->9. model.hubspot.hubspot__email_campaigns:f29 21. model.hubspot.hubspot__email_sends:f19->9. model.hubspot.hubspot__email_campaigns:f20 21. model.hubspot.hubspot__email_sends:f19->9. model.hubspot.hubspot__email_campaigns:f30 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign _fivetran_synced app_id app_name content_id email_campaign_id email_campaign_name email_campaign_sub_type email_campaign_subject email_campaign_type num_included num_queued 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0 60. model.hubspot_source.stg_hubspot__email_campaign:f1->9. model.hubspot.hubspot__email_campaigns:f1 60. model.hubspot_source.stg_hubspot__email_campaign:f2->9. model.hubspot.hubspot__email_campaigns:f2 60. model.hubspot_source.stg_hubspot__email_campaign:f3->9. model.hubspot.hubspot__email_campaigns:f3 60. model.hubspot_source.stg_hubspot__email_campaign:f4->9. model.hubspot.hubspot__email_campaigns:f4 60. model.hubspot_source.stg_hubspot__email_campaign:f5->9. model.hubspot.hubspot__email_campaigns:f5 60. model.hubspot_source.stg_hubspot__email_campaign:f6->9. model.hubspot.hubspot__email_campaigns:f6 60. model.hubspot_source.stg_hubspot__email_campaign:f7->9. model.hubspot.hubspot__email_campaigns:f7 60. model.hubspot_source.stg_hubspot__email_campaign:f8->9. model.hubspot.hubspot__email_campaigns:f8 60. model.hubspot_source.stg_hubspot__email_campaign:f9->9. model.hubspot.hubspot__email_campaigns:f9 60. model.hubspot_source.stg_hubspot__email_campaign:f10->9. model.hubspot.hubspot__email_campaigns:f10
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
app_id integer The app ID.
app_name text The app name.
content_id bigint The ID of the content.
email_campaign_id bigint The ID of the email campaign.
email_campaign_name text The name of the email campaign.
email_campaign_sub_type integer The email campaign sub-type.
email_campaign_subject text The subject of the email campaign.
email_campaign_type text The email campaign type.
num_included integer The number of messages included as part of the email campaign.
num_queued integer The number of messages queued as part of the email campaign.
total_bounces numeric The total number of bounce email events.
total_clicks numeric The total number of click email events.
total_deferrals numeric The total number of deferral email events.
total_deliveries numeric The total number of delivery email events.
total_drops numeric The total number of drop email events.
total_forwards numeric The total number of forward email events.
total_opens numeric The total number of open email events.
total_prints numeric The total number of print email events.
total_spam_reports numeric The total number of spam report email events.
total_unsubscribes numeric The total number of unsubscribe email events.
total_unique_bounces bigint The total number of unique email sends with a bounce email event.
total_unique_clicks bigint The total number of unique email sends with a click email event.
total_unique_deferrals bigint The total number of unique email sends with a deferral email event.
total_unique_deliveries bigint The total number of unique email sends with a delivery email event.
total_unique_drops bigint The total number of unique email sends with a drop email event.
total_unique_forwards bigint The total number of unique email sends with a forward email event.
total_unique_opens bigint The total number of unique email sends with a opens email event.
total_unique_prints bigint The total number of unique email sends with a print email event.
total_unique_spam_reports bigint The total number of unique email sends with a spam report email event.
total_unique_unsubscribes bigint The total number of unique email sends with a unsubscribe email event.
Column Lineage
%3 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign _fivetran_synced 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns _fivetran_synced 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp _fivetran_synced 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[_fivetran_synced]
    • Cleaning The column is cast to TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign app_id 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns app_id 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp app_id 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[app_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • app_id: Directly mapped
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[app_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • app_id: Directly copied to the output
Column Lineage
%3 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign app_name 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns app_name 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp app_name 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[app_name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • app_name: Directly mapped
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[app_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • app_name: Directly copied to the output
Column Lineage
%3 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign content_id 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns content_id 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp content_id 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[content_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • content_id: Directly mapped
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[content_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • content_id: Directly copied to the output
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_campaign_id 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_id 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign email_campaign_id 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent email_campaign_id 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp id 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp email_campaign_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[email_campaign_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • email_campaign_id: Directly mapped
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used to join with the email_aggregate_status_change CTE
    • Output Columns:
      • email_campaign_id: Directly copied
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[id]
    • Cleaning The column is cast to INT and renamed
    • Output Columns:
      • email_campaign_id: Directly mapped after casting and renaming
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[email_campaign_id]
    • Integration This column is used as the key to join the email_sends table with the campaigns table
    • Aggregation This column is used in the GROUP BY clause of the email_metrics CTE
    • Output Columns:
      • email_campaign_id: It is indirectly mapped to the output email_campaign_id through the join operation
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as the key to join with the email_metrics CTE
    • Output Columns:
      • email_campaign_id: Directly copied to the output
Column Lineage
%3 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign email_campaign_name 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_name 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp name 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[name]
    • Cleaning The column is renamed
    • Output Columns:
      • email_campaign_name: Directly mapped after renaming
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[email_campaign_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_name: Directly copied to the output
Column Lineage
%3 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign email_campaign_sub_type 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_sub_type 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp sub_type 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[sub_type]
    • Cleaning The column is renamed
    • Output Columns:
      • email_campaign_sub_type: Directly mapped after renaming
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[email_campaign_sub_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_sub_type: Directly copied to the output
Column Lineage
%3 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign email_campaign_subject 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_subject 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp subject 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[subject]
    • Cleaning The column is cast as TEXT and renamed to 'email_campaign_subject'
    • Output Columns:
      • email_campaign_subject: The 'subject' column is directly mapped to 'email_campaign_subject' after being cast as TEXT
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[email_campaign_subject]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_subject: Directly copied to the output
Column Lineage
%3 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign email_campaign_type 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_type 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp type 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[type]
    • Cleaning The column is renamed
    • Output Columns:
      • email_campaign_type: Directly mapped after renaming
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[email_campaign_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_type: Directly copied to the output
Column Lineage
%3 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign num_included 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns num_included 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp num_included 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[num_included]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • num_included: Directly mapped
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[num_included]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • num_included: Directly copied to the output
Column Lineage
%3 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign num_queued 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns num_queued 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp num_queued 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[num_queued]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • num_queued: Directly mapped
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[num_queued]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • num_queued: The column is directly copied to the output 'num_queued' column
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends bounces was_bounced 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_bounces total_unique_bounces 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[bounces]
    • Aggregation This column is aggregated to calculate the total bounces for each email campaign
    • Output Columns:
      • total_bounces: Summed up for each email campaign
      • total_unique_bounces: Counted distinctly for each email campaign
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_bounced]
    • Aggregation This column is aggregated to calculate the total number of bounced emails.
    • Output Columns:
      • total_bounces: Summed up to get the total number of bounce events.
      • total_unique_bounces: Counted to get the number of unique email sends with bounce events.
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends clicks was_clicked 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_clicks total_unique_clicks 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[clicks]
    • Aggregation This column is aggregated to calculate the total clicks for each email campaign
    • Output Columns:
      • total_clicks: Summed up for each email campaign
      • total_unique_clicks: Counted distinctly for each email campaign
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_clicked]
    • Aggregation This column is aggregated to calculate the total number of clicked emails.
    • Output Columns:
      • total_clicks: Summed up to get the total number of click events.
      • total_unique_clicks: Counted to get the number of unique email sends with click events.
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends deferrals was_deferred 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_deferrals total_unique_deferrals 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[deferrals]
    • Aggregation This column is aggregated to calculate the total deferrals for each email campaign
    • Output Columns:
      • total_deferrals: Summed up for each email campaign
      • total_unique_deferrals: Counted distinctly for each email campaign
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_deferred]
    • Aggregation This column is aggregated to calculate the total number of deferred emails.
    • Output Columns:
      • total_deferrals: Summed up to get the total number of deferral events.
      • total_unique_deferrals: Counted to get the number of unique email sends with deferral events.
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends deliveries was_delivered 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_deliveries total_unique_deliveries 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[deliveries]
    • Aggregation This column is aggregated to calculate the total deliveries for each email campaign
    • Output Columns:
      • total_deliveries: Summed up for each email campaign
      • total_unique_deliveries: Counted distinctly for each email campaign
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_delivered]
    • Aggregation This column is aggregated to calculate the total number of delivered emails.
    • Output Columns:
      • total_deliveries: Summed up to get the total number of delivery events.
      • total_unique_deliveries: Counted to get the number of unique email sends with delivery events.
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends drops 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_drops total_unique_drops 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[drops]
    • Aggregation This column is aggregated to calculate the total drops for each email campaign
    • Output Columns:
      • total_drops: Summed up for each email campaign
      • total_unique_drops: Counted distinctly for each email campaign
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends forwards was_forwarded 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_forwards total_unique_forwards 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[forwards]
    • Aggregation This column is aggregated to calculate the total forwards for each email campaign
    • Output Columns:
      • total_forwards: Summed up for each email campaign
      • total_unique_forwards: Counted distinctly for each email campaign
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_forwarded]
    • Aggregation This column is aggregated to calculate the total number of forwarded emails.
    • Output Columns:
      • total_forwards: Summed up to get the total number of forward events.
      • total_unique_forwards: Counted to get the number of unique email sends with forward events.
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends opens was_opened 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_opens total_unique_opens 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[opens]
    • Aggregation This column is aggregated to calculate the total number of open email events.
    • Output Columns:
      • total_opens: Summed up to get the total number of open events.
      • total_unique_opens: Counted to get the number of unique email sends with open events.
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_opened]
    • Aggregation This column is aggregated to calculate the total number of opened emails.
    • Output Columns:
      • total_opens: Summed up to get the total number of open events.
      • total_unique_opens: Counted to get the number of unique email sends with open events.
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends prints was_printed 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_prints total_unique_prints 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[prints]
    • Aggregation This column is aggregated to calculate the total number of print email events.
    • Output Columns:
      • total_prints: Summed up to get the total number of print events.
      • total_unique_prints: Counted to get the number of unique email sends with print events.
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_printed]
    • Aggregation This column is likely used to calculate the total_prints and total_unique_prints metrics in the output.
    • Output Columns:
      • total_prints: Aggregated count of all prints
      • total_unique_prints: Aggregated count of unique prints
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends spam_reports was_spam_reported 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_spam_reports total_unique_spam_reports 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[spam_reports]
    • Aggregation This column is aggregated to calculate the total number of spam report email events.
    • Output Columns:
      • total_spam_reports: Summed up to get the total number of spam report events.
      • total_unique_spam_reports: Counted to get the number of unique email sends with spam report events.
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_spam_reported]
    • Aggregation This column is likely used to calculate the total_spam_reports and total_unique_spam_reports metrics in the output.
    • Output Columns:
      • total_spam_reports: Aggregated count of all spam reports
      • total_unique_spam_reports: Aggregated count of unique spam reports
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_id unsubscribes was_unsubcribed 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f2->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f2->9. model.hubspot.hubspot__email_campaigns:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change email_send_id 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_id 20. model.hubspot.hubspot__email_event_status_change:f0->30. model.hubspot.int_hubspot__email_aggregate_status_change:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
30. model.hubspot.int_hubspot__email_aggregate_status_change
  • Input Column: 20. model.hubspot.hubspot__email_event_status_change[email_send_id]
    • Filtering The column is filtered to exclude null values (WHERE NOT email_send_id IS NULL)
    • Aggregation The column is used in the GROUP BY clause
    • Output Columns:
      • email_send_id: This column is directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate the total number of unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Summed up to get the total number of unsubscribe events.
      • total_unique_unsubscribes: Counted to get the number of unique email sends with unsubscribe events.
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is likely used to calculate the total_unsubscribes and total_unique_unsubscribes metrics in the output.
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribes
      • total_unique_unsubscribes: Aggregated count of unique unsubscribes
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends bounces was_bounced 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_bounces total_unique_bounces 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[bounces]
    • Aggregation This column is aggregated to calculate the total bounces for each email campaign
    • Output Columns:
      • total_bounces: Summed up for each email campaign
      • total_unique_bounces: Counted distinctly for each email campaign
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_bounced]
    • Aggregation This column is aggregated to calculate the total number of bounced emails.
    • Output Columns:
      • total_bounces: Summed up to get the total number of bounce events.
      • total_unique_bounces: Counted to get the number of unique email sends with bounce events.
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends clicks was_clicked 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_clicks total_unique_clicks 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[clicks]
    • Aggregation This column is aggregated to calculate the total clicks for each email campaign
    • Output Columns:
      • total_clicks: Summed up for each email campaign
      • total_unique_clicks: Counted distinctly for each email campaign
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_clicked]
    • Aggregation This column is aggregated to calculate the total number of clicked emails.
    • Output Columns:
      • total_clicks: Summed up to get the total number of click events.
      • total_unique_clicks: Counted to get the number of unique email sends with click events.
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends deferrals was_deferred 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_deferrals total_unique_deferrals 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[deferrals]
    • Aggregation This column is aggregated to calculate the total deferrals for each email campaign
    • Output Columns:
      • total_deferrals: Summed up for each email campaign
      • total_unique_deferrals: Counted distinctly for each email campaign
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_deferred]
    • Aggregation This column is aggregated to calculate the total number of deferred emails.
    • Output Columns:
      • total_deferrals: Summed up to get the total number of deferral events.
      • total_unique_deferrals: Counted to get the number of unique email sends with deferral events.
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends deliveries was_delivered 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_deliveries total_unique_deliveries 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[deliveries]
    • Aggregation This column is aggregated to calculate the total deliveries for each email campaign
    • Output Columns:
      • total_deliveries: Summed up for each email campaign
      • total_unique_deliveries: Counted distinctly for each email campaign
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_delivered]
    • Aggregation This column is aggregated to calculate the total number of delivered emails.
    • Output Columns:
      • total_deliveries: Summed up to get the total number of delivery events.
      • total_unique_deliveries: Counted to get the number of unique email sends with delivery events.
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends drops 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_drops total_unique_drops 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[drops]
    • Aggregation This column is aggregated to calculate the total drops for each email campaign
    • Output Columns:
      • total_drops: Summed up for each email campaign
      • total_unique_drops: Counted distinctly for each email campaign
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends forwards was_forwarded 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_forwards total_unique_forwards 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[forwards]
    • Aggregation This column is aggregated to calculate the total forwards for each email campaign
    • Output Columns:
      • total_forwards: Summed up for each email campaign
      • total_unique_forwards: Counted distinctly for each email campaign
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_forwarded]
    • Aggregation This column is aggregated to calculate the total number of forwarded emails.
    • Output Columns:
      • total_forwards: Summed up to get the total number of forward events.
      • total_unique_forwards: Counted to get the number of unique email sends with forward events.
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends opens was_opened 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_opens total_unique_opens 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[opens]
    • Aggregation This column is aggregated to calculate the total number of open email events.
    • Output Columns:
      • total_opens: Summed up to get the total number of open events.
      • total_unique_opens: Counted to get the number of unique email sends with open events.
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_opened]
    • Aggregation This column is aggregated to calculate the total number of opened emails.
    • Output Columns:
      • total_opens: Summed up to get the total number of open events.
      • total_unique_opens: Counted to get the number of unique email sends with open events.
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends prints was_printed 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_prints total_unique_prints 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[prints]
    • Aggregation This column is aggregated to calculate the total number of print email events.
    • Output Columns:
      • total_prints: Summed up to get the total number of print events.
      • total_unique_prints: Counted to get the number of unique email sends with print events.
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_printed]
    • Aggregation This column is likely used to calculate the total_prints and total_unique_prints metrics in the output.
    • Output Columns:
      • total_prints: Aggregated count of all prints
      • total_unique_prints: Aggregated count of unique prints
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends spam_reports was_spam_reported 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_spam_reports total_unique_spam_reports 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[spam_reports]
    • Aggregation This column is aggregated to calculate the total number of spam report email events.
    • Output Columns:
      • total_spam_reports: Summed up to get the total number of spam report events.
      • total_unique_spam_reports: Counted to get the number of unique email sends with spam report events.
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_spam_reported]
    • Aggregation This column is likely used to calculate the total_spam_reports and total_unique_spam_reports metrics in the output.
    • Output Columns:
      • total_spam_reports: Aggregated count of all spam reports
      • total_unique_spam_reports: Aggregated count of unique spam reports
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_id unsubscribes was_unsubcribed 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f2->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f2->9. model.hubspot.hubspot__email_campaigns:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change email_send_id 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_id 20. model.hubspot.hubspot__email_event_status_change:f0->30. model.hubspot.int_hubspot__email_aggregate_status_change:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
30. model.hubspot.int_hubspot__email_aggregate_status_change
  • Input Column: 20. model.hubspot.hubspot__email_event_status_change[email_send_id]
    • Filtering The column is filtered to exclude null values (WHERE NOT email_send_id IS NULL)
    • Aggregation The column is used in the GROUP BY clause
    • Output Columns:
      • email_send_id: This column is directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate the total number of unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Summed up to get the total number of unsubscribe events.
      • total_unique_unsubscribes: Counted to get the number of unique email sends with unsubscribe events.
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is likely used to calculate the total_unsubscribes and total_unique_unsubscribes metrics in the output.
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribes
      • total_unique_unsubscribes: Aggregated count of unique unsubscribes
10. model.hubspot.hubspot__email_event_bounce

This SQL query integrates data from multiple tables related to Hubspot email events, specifically focusing on email bounce events. It joins the base email bounce event data with general email event data and contact information. The query enriches the bounce event data with additional details such as creation timestamp, campaign ID, recipient email, send timestamp, and contact information. It also includes a flag to indicate if the contact has been deleted.

IntegrationCleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_bounce
), events AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event
), contacts AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.int_hubspot__contact_merge_adjust
), events_joined AS (
  SELECT
    base.*,
    events.created_timestamp,
    events.email_campaign_id,
    events.recipient_email_address,
    events.sent_timestamp AS email_send_timestamp,
    events.sent_by_event_id AS email_send_id
  FROM base
  LEFT JOIN events
    USING (event_id)
), contacts_joined AS (
  SELECT
    events_joined.*,
    contacts.contact_id,
    COALESCE(contacts.is_contact_deleted, FALSE) AS is_contact_deleted
  FROM events_joined
  LEFT JOIN contacts
    ON events_joined.recipient_email_address = contacts.email
)
SELECT
  *
FROM contacts_joined
%3 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce _fivetran_synced is_contact_deleted bounce_category event_id returned_response returned_status created_timestamp email_campaign_id recipient_email_address email_send_timestamp email_send_id contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id is_contact_deleted email _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->10. model.hubspot.hubspot__email_event_bounce:f11 28. model.hubspot.int_hubspot__contact_merge_adjust:f1->10. model.hubspot.hubspot__email_event_bounce:f1 28. model.hubspot.int_hubspot__contact_merge_adjust:f3->10. model.hubspot.hubspot__email_event_bounce:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced created_timestamp email_campaign_id event_id recipient_email_address sent_timestamp sent_by_event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 62. model.hubspot_source.stg_hubspot__email_event:f1->10. model.hubspot.hubspot__email_event_bounce:f6 62. model.hubspot_source.stg_hubspot__email_event:f2->10. model.hubspot.hubspot__email_event_bounce:f7 62. model.hubspot_source.stg_hubspot__email_event:f3->10. model.hubspot.hubspot__email_event_bounce:f3 62. model.hubspot_source.stg_hubspot__email_event:f4->10. model.hubspot.hubspot__email_event_bounce:f8 62. model.hubspot_source.stg_hubspot__email_event:f5->10. model.hubspot.hubspot__email_event_bounce:f9 62. model.hubspot_source.stg_hubspot__email_event:f6->10. model.hubspot.hubspot__email_event_bounce:f10 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce _fivetran_synced bounce_category event_id returned_response returned_status 63. model.hubspot_source.stg_hubspot__email_event_bounce:f0->10. model.hubspot.hubspot__email_event_bounce:f0 63. model.hubspot_source.stg_hubspot__email_event_bounce:f1->10. model.hubspot.hubspot__email_event_bounce:f2 63. model.hubspot_source.stg_hubspot__email_event_bounce:f2->10. model.hubspot.hubspot__email_event_bounce:f3 63. model.hubspot_source.stg_hubspot__email_event_bounce:f3->10. model.hubspot.hubspot__email_event_bounce:f4 63. model.hubspot_source.stg_hubspot__email_event_bounce:f4->10. model.hubspot.hubspot__email_event_bounce:f5
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
is_contact_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
bounce_category text The best-guess of the type of bounce encountered. If an appropriate category couldn't be determined, this property is omitted. See below for the possible values. Note that this is a derived value, and may be modified at any time to improve the accuracy of classification.
event_id text The ID of the event.
returned_response text The full response from the recipient's email server.
returned_status integer The status code returned from the recipient's email server.
created_timestamp timestamp without time zone The created timestamp of the event.
email_campaign_id integer The ID of the related email campaign.
recipient_email_address text The email address of the contact related to the event.
email_send_timestamp timestamp without time zone The timestamp of the SENT event related to this event.
email_send_id text The event ID which uniquely identifies the email message's SENT event. If not applicable, this property is omitted.
contact_id integer The ID of the related contact.
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust _fivetran_synced 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->10. model.hubspot.hubspot__email_event_bounce:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce _fivetran_synced 63. model.hubspot_source.stg_hubspot__email_event_bounce:f0->10. model.hubspot.hubspot__email_event_bounce:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp _fivetran_synced 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp _fivetran_synced 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f0->63. model.hubspot_source.stg_hubspot__email_event_bounce:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_synced 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_synced]
    • Direct The column is directly copied with a cast to TIMESTAMP.
    • Output Columns:
      • _fivetran_synced: Directly mapped with a TIMESTAMP cast
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Cast as TIMESTAMP
63. model.hubspot_source.stg_hubspot__email_event_bounce
  • Input Column: 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TIMESTAMP in both the macro and fields CTEs
    • Output Columns:
      • _fivetran_synced: It is directly mapped to _fivetran_synced after casting
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: The column is directly copied to the output '_fivetran_synced' column
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
  • Input Column: 63. model.hubspot_source.stg_hubspot__email_event_bounce[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust is_contact_deleted 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->10. model.hubspot.hubspot__email_event_bounce:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact is_contact_deleted 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_deleted 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_deleted]
    • Cleaning This column is likely used to determine the 'is_contact_deleted' field, though not explicitly shown in the provided SQL.
    • Output Columns:
      • is_contact_deleted: Likely transformed to determine if the contact is deleted
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied to the output
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, with a COALESCE function applied
    • Cleaning The column is cleaned by applying a COALESCE function to handle NULL values
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
Column Lineage
%3 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce bounce_category 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce bounce_category 63. model.hubspot_source.stg_hubspot__email_event_bounce:f0->10. model.hubspot.hubspot__email_event_bounce:f0 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp category 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f0->63. model.hubspot_source.stg_hubspot__email_event_bounce:f0
63. model.hubspot_source.stg_hubspot__email_event_bounce
  • Input Column: 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp[category]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • bounce_category: It is directly mapped to bounce_category after casting
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 63. model.hubspot_source.stg_hubspot__email_event_bounce[bounce_category]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • bounce_category: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event event_id 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce event_id 63. model.hubspot_source.stg_hubspot__email_event_bounce:f0->10. model.hubspot.hubspot__email_event_bounce:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp id 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f0->63. model.hubspot_source.stg_hubspot__email_event_bounce:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped and renamed
63. model.hubspot_source.stg_hubspot__email_event_bounce
  • Input Column: 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp[id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • event_id: It is directly mapped to event_id after casting
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join the base table with the events table
    • Output Columns:
      • event_id: Directly copied to the output
  • Input Column: 63. model.hubspot_source.stg_hubspot__email_event_bounce[event_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as a key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce returned_response 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce returned_response 63. model.hubspot_source.stg_hubspot__email_event_bounce:f0->10. model.hubspot.hubspot__email_event_bounce:f0 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp response 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f0->63. model.hubspot_source.stg_hubspot__email_event_bounce:f0
63. model.hubspot_source.stg_hubspot__email_event_bounce
  • Input Column: 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp[response]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • returned_response: It is directly mapped to returned_response after casting
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 63. model.hubspot_source.stg_hubspot__email_event_bounce[returned_response]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • returned_response: Directly copied to the output
Column Lineage
%3 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce returned_status 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce returned_status 63. model.hubspot_source.stg_hubspot__email_event_bounce:f0->10. model.hubspot.hubspot__email_event_bounce:f0 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp status 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f0->63. model.hubspot_source.stg_hubspot__email_event_bounce:f0
63. model.hubspot_source.stg_hubspot__email_event_bounce
  • Input Column: 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp[status]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • returned_status: It is directly mapped to returned_status after casting
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 63. model.hubspot_source.stg_hubspot__email_event_bounce[returned_status]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • returned_status: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event created_timestamp 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[created]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • created_timestamp: Cast as TIMESTAMP and renamed
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event email_campaign_id 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp email_campaign_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[email_campaign_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • email_campaign_id: Directly mapped
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event recipient_email_address 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp recipient 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[recipient]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • recipient_email_address: Directly mapped without changes
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct This column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_timestamp 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_created]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • sent_timestamp: Directly mapped after casting to TIMESTAMP
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->10. model.hubspot.hubspot__email_event_bounce:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_id 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp id 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[id]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_id: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with the contact_merge_audit CTE
    • Filtering Used in the WHERE clause to filter out merged contacts
    • Output Columns:
      • contact_id: Directly copied to the output
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as the key to join with the events data
    • Output Columns:
      • contact_id: Directly copied to the output
11. model.hubspot.hubspot__email_event_clicks

This SQL query integrates information from multiple tables related to Hubspot email event clicks. It starts with the base table of email event clicks, then joins it with the email events table to get additional event details. Finally, it joins with the contacts table to add contact information. The query also includes some basic data cleaning by coalescing the 'is_contact_deleted' field with a default value of FALSE.

IntegrationCleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_click
), events AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event
), contacts AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.int_hubspot__contact_merge_adjust
), events_joined AS (
  SELECT
    base.*,
    events.created_timestamp,
    events.email_campaign_id,
    events.recipient_email_address,
    events.sent_timestamp AS email_send_timestamp,
    events.sent_by_event_id AS email_send_id
  FROM base
  LEFT JOIN events
    USING (event_id)
), contacts_joined AS (
  SELECT
    events_joined.*,
    contacts.contact_id,
    COALESCE(contacts.is_contact_deleted, FALSE) AS is_contact_deleted
  FROM events_joined
  LEFT JOIN contacts
    ON events_joined.recipient_email_address = contacts.email
)
SELECT
  *
FROM contacts_joined
%3 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks _fivetran_synced is_contact_deleted browser click_url event_id geo_location ip_address referer_url user_agent created_timestamp email_campaign_id recipient_email_address email_send_timestamp email_send_id contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id is_contact_deleted email _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->11. model.hubspot.hubspot__email_event_clicks:f14 28. model.hubspot.int_hubspot__contact_merge_adjust:f1->11. model.hubspot.hubspot__email_event_clicks:f1 28. model.hubspot.int_hubspot__contact_merge_adjust:f3->11. model.hubspot.hubspot__email_event_clicks:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced created_timestamp email_campaign_id event_id recipient_email_address sent_by_event_id sent_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 62. model.hubspot_source.stg_hubspot__email_event:f1->11. model.hubspot.hubspot__email_event_clicks:f9 62. model.hubspot_source.stg_hubspot__email_event:f2->11. model.hubspot.hubspot__email_event_clicks:f10 62. model.hubspot_source.stg_hubspot__email_event:f3->11. model.hubspot.hubspot__email_event_clicks:f4 62. model.hubspot_source.stg_hubspot__email_event:f4->11. model.hubspot.hubspot__email_event_clicks:f11 62. model.hubspot_source.stg_hubspot__email_event:f5->11. model.hubspot.hubspot__email_event_clicks:f13 62. model.hubspot_source.stg_hubspot__email_event:f6->11. model.hubspot.hubspot__email_event_clicks:f12 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click _fivetran_synced browser click_url event_id geo_location ip_address referer_url user_agent 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0 65. model.hubspot_source.stg_hubspot__email_event_click:f1->11. model.hubspot.hubspot__email_event_clicks:f2 65. model.hubspot_source.stg_hubspot__email_event_click:f2->11. model.hubspot.hubspot__email_event_clicks:f3 65. model.hubspot_source.stg_hubspot__email_event_click:f3->11. model.hubspot.hubspot__email_event_clicks:f4 65. model.hubspot_source.stg_hubspot__email_event_click:f4->11. model.hubspot.hubspot__email_event_clicks:f5 65. model.hubspot_source.stg_hubspot__email_event_click:f5->11. model.hubspot.hubspot__email_event_clicks:f6 65. model.hubspot_source.stg_hubspot__email_event_click:f6->11. model.hubspot.hubspot__email_event_clicks:f7 65. model.hubspot_source.stg_hubspot__email_event_click:f7->11. model.hubspot.hubspot__email_event_clicks:f8
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
is_contact_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
browser text A JSON object representing the browser which serviced the event. Its comprised of the properties: 'name', 'family', 'producer', 'producer_url', 'type', 'url', 'version'.
click_url text The URL within the message that the recipient clicked.
event_id text The ID of the event.
geo_location text A JSON object representing the location where the event occurred. It's comprised of the properties: 'city', 'state', 'country'.
ip_address integer The contact's IP address when the event occurred.
referer_url integer The URL of the webpage that linked to the URL clicked. Whether this is provided, and what its value is, is determined by the recipient's email client.
user_agent text The user agent responsible for the event, e.g. “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36”
created_timestamp timestamp without time zone The created timestamp of the event.
email_campaign_id integer The ID of the related email campaign.
recipient_email_address text The email address of the contact related to the event.
email_send_timestamp timestamp without time zone The timestamp of the SENT event related to this event.
email_send_id text The event ID which uniquely identifies the email message's SENT event. If not applicable, this property is omitted.
contact_id integer The ID of the related contact.
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust _fivetran_synced 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->11. model.hubspot.hubspot__email_event_clicks:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click _fivetran_synced 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp _fivetran_synced 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp _fivetran_synced 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_synced 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_synced]
    • Direct The column is directly copied with a cast to TIMESTAMP.
    • Output Columns:
      • _fivetran_synced: Directly mapped with a TIMESTAMP cast
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Cast as TIMESTAMP
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: It is directly mapped to the output column of the same name
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust is_contact_deleted 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->11. model.hubspot.hubspot__email_event_clicks:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact is_contact_deleted 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_deleted 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_deleted]
    • Cleaning This column is likely used to determine the 'is_contact_deleted' field, though not explicitly shown in the provided SQL.
    • Output Columns:
      • is_contact_deleted: Likely transformed to determine if the contact is deleted
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied to the output
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Cleaning The column is cleaned by coalescing with FALSE if it's null
    • Output Columns:
      • is_contact_deleted: Cleaned and mapped to the output
Column Lineage
%3 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click browser 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks browser 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp browser 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[browser]
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • browser: Directly mapped after casting
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[browser]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • browser: Directly copied to the output
Column Lineage
%3 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click click_url 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks click_url 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp url 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[url]
    • Cleaning The column is cast as TEXT and renamed to 'click_url'
    • Output Columns:
      • click_url: Directly mapped after casting and renaming
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[click_url]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • click_url: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event event_id 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click event_id 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp id 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped and renamed
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[id]
    • Cleaning The column is cast as TEXT and renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped after casting and renaming
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join tables
    • Output Columns:
      • event_id: Directly copied
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[event_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click geo_location 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks geo_location 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp location 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[location]
    • Cleaning The column is cast as TEXT and renamed to 'geo_location'
    • Output Columns:
      • geo_location: Directly mapped after casting and renaming
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[geo_location]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • geo_location: Directly copied to the output
Column Lineage
%3 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click ip_address 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks ip_address 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp ip_address 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[ip_address]
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • ip_address: Directly mapped after casting
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[ip_address]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • ip_address: Directly copied to the output
Column Lineage
%3 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click referer_url 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks referer_url 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp referer 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[referer]
    • Cleaning The column is cast as TEXT and renamed to 'referer_url'
    • Output Columns:
      • referer_url: Directly mapped after casting and renaming
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[referer_url]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • referer_url: Directly copied to the output
Column Lineage
%3 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click user_agent 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks user_agent 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp user_agent 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[user_agent]
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • user_agent: Directly mapped after casting
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[user_agent]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • user_agent: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event created_timestamp 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[created]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • created_timestamp: Cast as TIMESTAMP and renamed
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event email_campaign_id 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp email_campaign_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[email_campaign_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • email_campaign_id: Directly mapped
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event recipient_email_address 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp recipient 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[recipient]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • recipient_email_address: Directly mapped without changes
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_timestamp 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_created]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • sent_timestamp: Directly mapped after casting to TIMESTAMP
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed to 'email_send_timestamp' in the output
    • Output Columns:
      • email_send_timestamp: Renamed and directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed to 'email_send_id' in the output
    • Output Columns:
      • email_send_id: Renamed and directly copied to the output
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->11. model.hubspot.hubspot__email_event_clicks:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_id 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp id 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[id]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_id: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with the contact_merge_audit CTE
    • Filtering Used in the WHERE clause to filter out merged contacts
    • Output Columns:
      • contact_id: Directly copied to the output
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the contacts table
    • Output Columns:
      • contact_id: Directly copied to the output
12. model.hubspot.hubspot__email_event_deferred

This SQL query integrates data from multiple tables related to Hubspot email events. It starts with the email_event_deferred table and joins it with the email_event table to add more event details. Then, it joins the result with the contact_merge_adjust table to include contact information. The query also adds a column to indicate if a contact is deleted. The final result includes all columns from these joined tables, providing a comprehensive view of deferred email events with associated contact information.

IntegrationFeaturization
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_deferred
), events AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event
), contacts AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.int_hubspot__contact_merge_adjust
), events_joined AS (
  SELECT
    base.*,
    events.created_timestamp,
    events.email_campaign_id,
    events.recipient_email_address,
    events.sent_timestamp AS email_send_timestamp,
    events.sent_by_event_id AS email_send_id
  FROM base
  LEFT JOIN events
    USING (event_id)
), contacts_joined AS (
  SELECT
    events_joined.*,
    contacts.contact_id,
    COALESCE(contacts.is_contact_deleted, FALSE) AS is_contact_deleted
  FROM events_joined
  LEFT JOIN contacts
    ON events_joined.recipient_email_address = contacts.email
)
SELECT
  *
FROM contacts_joined
%3 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred _fivetran_synced is_contact_deleted attempt_number event_id returned_response created_timestamp email_campaign_id recipient_email_address email_send_timestamp email_send_id contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id is_contact_deleted email _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->12. model.hubspot.hubspot__email_event_deferred:f10 28. model.hubspot.int_hubspot__contact_merge_adjust:f1->12. model.hubspot.hubspot__email_event_deferred:f1 28. model.hubspot.int_hubspot__contact_merge_adjust:f3->12. model.hubspot.hubspot__email_event_deferred:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced created_timestamp email_campaign_id event_id recipient_email_address sent_by_event_id sent_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 62. model.hubspot_source.stg_hubspot__email_event:f1->12. model.hubspot.hubspot__email_event_deferred:f5 62. model.hubspot_source.stg_hubspot__email_event:f2->12. model.hubspot.hubspot__email_event_deferred:f6 62. model.hubspot_source.stg_hubspot__email_event:f3->12. model.hubspot.hubspot__email_event_deferred:f3 62. model.hubspot_source.stg_hubspot__email_event:f4->12. model.hubspot.hubspot__email_event_deferred:f7 62. model.hubspot_source.stg_hubspot__email_event:f5->12. model.hubspot.hubspot__email_event_deferred:f9 62. model.hubspot_source.stg_hubspot__email_event:f6->12. model.hubspot.hubspot__email_event_deferred:f8 67. model.hubspot_source.stg_hubspot__email_event_deferred 67. model.hubspot_source.stg_hubspot__email_event_deferred _fivetran_synced attempt_number event_id returned_response 67. model.hubspot_source.stg_hubspot__email_event_deferred:f0->12. model.hubspot.hubspot__email_event_deferred:f0 67. model.hubspot_source.stg_hubspot__email_event_deferred:f1->12. model.hubspot.hubspot__email_event_deferred:f2 67. model.hubspot_source.stg_hubspot__email_event_deferred:f2->12. model.hubspot.hubspot__email_event_deferred:f3 67. model.hubspot_source.stg_hubspot__email_event_deferred:f3->12. model.hubspot.hubspot__email_event_deferred:f4
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
is_contact_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
attempt_number integer The delivery attempt number.
event_id text The ID of the event.
returned_response integer The full response from the recipient's email server.
created_timestamp timestamp without time zone The created timestamp of the event.
email_campaign_id integer The ID of the related email campaign.
recipient_email_address text The email address of the contact related to the event.
email_send_timestamp timestamp without time zone The timestamp of the SENT event related to this event.
email_send_id text The event ID which uniquely identifies the email message's SENT event. If not applicable, this property is omitted.
contact_id integer The ID of the related contact.
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust _fivetran_synced 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->12. model.hubspot.hubspot__email_event_deferred:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 67. model.hubspot_source.stg_hubspot__email_event_deferred 67. model.hubspot_source.stg_hubspot__email_event_deferred _fivetran_synced 67. model.hubspot_source.stg_hubspot__email_event_deferred:f0->12. model.hubspot.hubspot__email_event_deferred:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp _fivetran_synced 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp _fivetran_synced 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp:f0->67. model.hubspot_source.stg_hubspot__email_event_deferred:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_synced 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_synced]
    • Direct The column is directly copied with a cast to TIMESTAMP.
    • Output Columns:
      • _fivetran_synced: Directly mapped with a TIMESTAMP cast
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Cast as TIMESTAMP
67. model.hubspot_source.stg_hubspot__email_event_deferred
  • Input Column: 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TIMESTAMP in both the macro CTE and the final select statement
    • Output Columns:
      • _fivetran_synced: It is directly mapped to _fivetran_synced after being cast as TIMESTAMP
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join operation between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
  • Input Column: 67. model.hubspot_source.stg_hubspot__email_event_deferred[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust is_contact_deleted 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->12. model.hubspot.hubspot__email_event_deferred:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact is_contact_deleted 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_deleted 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_deleted]
    • Cleaning This column is likely used to determine the 'is_contact_deleted' field, though not explicitly shown in the provided SQL.
    • Output Columns:
      • is_contact_deleted: Likely transformed to determine if the contact is deleted
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied to the output
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, with a COALESCE function applied
    • Integration The column is used in the final SELECT statement
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE(is_contact_deleted, FALSE)
Column Lineage
%3 67. model.hubspot_source.stg_hubspot__email_event_deferred 67. model.hubspot_source.stg_hubspot__email_event_deferred attempt_number 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred attempt_number 67. model.hubspot_source.stg_hubspot__email_event_deferred:f0->12. model.hubspot.hubspot__email_event_deferred:f0 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp attempt 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp:f0->67. model.hubspot_source.stg_hubspot__email_event_deferred:f0
67. model.hubspot_source.stg_hubspot__email_event_deferred
  • Input Column: 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp[attempt]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT in the macro CTE
    • Output Columns:
      • attempt_number: It is directly mapped to attempt_number after being cast as INT
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 67. model.hubspot_source.stg_hubspot__email_event_deferred[attempt_number]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • attempt_number: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event event_id 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 67. model.hubspot_source.stg_hubspot__email_event_deferred 67. model.hubspot_source.stg_hubspot__email_event_deferred event_id 67. model.hubspot_source.stg_hubspot__email_event_deferred:f0->12. model.hubspot.hubspot__email_event_deferred:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp id 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp:f0->67. model.hubspot_source.stg_hubspot__email_event_deferred:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped and renamed
67. model.hubspot_source.stg_hubspot__email_event_deferred
  • Input Column: 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp[id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • event_id: It is directly mapped to event_id after being cast as TEXT
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration The column is used as the key to join with the base table
    • Output Columns:
      • event_id: Directly copied
  • Input Column: 67. model.hubspot_source.stg_hubspot__email_event_deferred[event_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 67. model.hubspot_source.stg_hubspot__email_event_deferred 67. model.hubspot_source.stg_hubspot__email_event_deferred returned_response 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred returned_response 67. model.hubspot_source.stg_hubspot__email_event_deferred:f0->12. model.hubspot.hubspot__email_event_deferred:f0 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp response 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp:f0->67. model.hubspot_source.stg_hubspot__email_event_deferred:f0
67. model.hubspot_source.stg_hubspot__email_event_deferred
  • Input Column: 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp[response]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • returned_response: It is directly mapped to returned_response after being cast as TEXT
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 67. model.hubspot_source.stg_hubspot__email_event_deferred[returned_response]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • returned_response: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event created_timestamp 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[created]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • created_timestamp: Cast as TIMESTAMP and renamed
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event email_campaign_id 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp email_campaign_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[email_campaign_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • email_campaign_id: Directly mapped
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event recipient_email_address 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp recipient 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[recipient]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • recipient_email_address: Directly mapped without changes
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_timestamp 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_created]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • sent_timestamp: Directly mapped after casting to TIMESTAMP
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->12. model.hubspot.hubspot__email_event_deferred:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_id 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp id 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[id]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_id: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with the contact_merge_audit CTE
    • Filtering Used in the WHERE clause to filter out merged contacts
    • Output Columns:
      • contact_id: Directly copied to the output
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the final SELECT statement
    • Output Columns:
      • contact_id: Directly copied to the output
13. model.hubspot.hubspot__email_event_delivered

This SQL query integrates data from three different sources: email event delivered, general email events, and contacts. It joins these tables to create a comprehensive view of email delivery events, including recipient information and contact details. The query also includes a coalesce function to handle potentially null values for the 'is_contact_deleted' field.

IntegrationCleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_delivered
), events AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event
), contacts AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.int_hubspot__contact_merge_adjust
), events_joined AS (
  SELECT
    base.*,
    events.created_timestamp,
    events.email_campaign_id,
    events.recipient_email_address,
    events.sent_timestamp AS email_send_timestamp,
    events.sent_by_event_id AS email_send_id
  FROM base
  LEFT JOIN events
    USING (event_id)
), contacts_joined AS (
  SELECT
    events_joined.*,
    contacts.contact_id,
    COALESCE(contacts.is_contact_deleted, FALSE) AS is_contact_deleted
  FROM events_joined
  LEFT JOIN contacts
    ON events_joined.recipient_email_address = contacts.email
)
SELECT
  *
FROM contacts_joined
%3 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered _fivetran_synced is_contact_deleted event_id returned_response smtp_id created_timestamp email_campaign_id recipient_email_address email_send_timestamp email_send_id contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id is_contact_deleted email _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->13. model.hubspot.hubspot__email_event_delivered:f10 28. model.hubspot.int_hubspot__contact_merge_adjust:f1->13. model.hubspot.hubspot__email_event_delivered:f1 28. model.hubspot.int_hubspot__contact_merge_adjust:f3->13. model.hubspot.hubspot__email_event_delivered:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced created_timestamp email_campaign_id event_id recipient_email_address sent_by_event_id sent_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 62. model.hubspot_source.stg_hubspot__email_event:f1->13. model.hubspot.hubspot__email_event_delivered:f5 62. model.hubspot_source.stg_hubspot__email_event:f2->13. model.hubspot.hubspot__email_event_delivered:f6 62. model.hubspot_source.stg_hubspot__email_event:f3->13. model.hubspot.hubspot__email_event_delivered:f2 62. model.hubspot_source.stg_hubspot__email_event:f4->13. model.hubspot.hubspot__email_event_delivered:f7 62. model.hubspot_source.stg_hubspot__email_event:f5->13. model.hubspot.hubspot__email_event_delivered:f9 62. model.hubspot_source.stg_hubspot__email_event:f6->13. model.hubspot.hubspot__email_event_delivered:f8 69. model.hubspot_source.stg_hubspot__email_event_delivered 69. model.hubspot_source.stg_hubspot__email_event_delivered _fivetran_synced event_id returned_response smtp_id 69. model.hubspot_source.stg_hubspot__email_event_delivered:f0->13. model.hubspot.hubspot__email_event_delivered:f0 69. model.hubspot_source.stg_hubspot__email_event_delivered:f1->13. model.hubspot.hubspot__email_event_delivered:f2 69. model.hubspot_source.stg_hubspot__email_event_delivered:f2->13. model.hubspot.hubspot__email_event_delivered:f3 69. model.hubspot_source.stg_hubspot__email_event_delivered:f3->13. model.hubspot.hubspot__email_event_delivered:f4
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
is_contact_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
event_id text The ID of the event.
returned_response text The full response from the recipient's email server.
smtp_id text An ID attached to the message by HubSpot.
created_timestamp timestamp without time zone The created timestamp of the event.
email_campaign_id integer The ID of the related email campaign.
recipient_email_address text The email address of the contact related to the event.
email_send_timestamp timestamp without time zone The timestamp of the SENT event related to this event.
email_send_id text The event ID which uniquely identifies the email message's SENT event. If not applicable, this property is omitted.
contact_id integer The ID of the related contact.
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust _fivetran_synced 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->13. model.hubspot.hubspot__email_event_delivered:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 69. model.hubspot_source.stg_hubspot__email_event_delivered 69. model.hubspot_source.stg_hubspot__email_event_delivered _fivetran_synced 69. model.hubspot_source.stg_hubspot__email_event_delivered:f0->13. model.hubspot.hubspot__email_event_delivered:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp _fivetran_synced 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp _fivetran_synced 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp:f0->69. model.hubspot_source.stg_hubspot__email_event_delivered:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_synced 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_synced]
    • Direct The column is directly copied with a cast to TIMESTAMP.
    • Output Columns:
      • _fivetran_synced: Directly mapped with a TIMESTAMP cast
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Cast as TIMESTAMP
69. model.hubspot_source.stg_hubspot__email_event_delivered
  • Input Column: 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TIMESTAMP in the macro CTE and then in the fields CTE
    • Output Columns:
      • _fivetran_synced: It is directly mapped to the '_fivetran_synced' column in the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
  • Input Column: 69. model.hubspot_source.stg_hubspot__email_event_delivered[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust is_contact_deleted 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->13. model.hubspot.hubspot__email_event_delivered:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact is_contact_deleted 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_deleted 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_deleted]
    • Cleaning This column is likely used to determine the 'is_contact_deleted' field, though not explicitly shown in the provided SQL.
    • Output Columns:
      • is_contact_deleted: Likely transformed to determine if the contact is deleted
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied to the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function applied
    • Cleaning The COALESCE function is used to handle potentially null values
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event event_id 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 69. model.hubspot_source.stg_hubspot__email_event_delivered 69. model.hubspot_source.stg_hubspot__email_event_delivered event_id 69. model.hubspot_source.stg_hubspot__email_event_delivered:f0->13. model.hubspot.hubspot__email_event_delivered:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp id 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp:f0->69. model.hubspot_source.stg_hubspot__email_event_delivered:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped and renamed
69. model.hubspot_source.stg_hubspot__email_event_delivered
  • Input Column: 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp[id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • event_id: It is directly mapped to the 'event_id' column in the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join tables
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • event_id: Directly copied to the output
  • Input Column: 69. model.hubspot_source.stg_hubspot__email_event_delivered[event_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as a key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 69. model.hubspot_source.stg_hubspot__email_event_delivered 69. model.hubspot_source.stg_hubspot__email_event_delivered returned_response 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered returned_response 69. model.hubspot_source.stg_hubspot__email_event_delivered:f0->13. model.hubspot.hubspot__email_event_delivered:f0 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp response 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp:f0->69. model.hubspot_source.stg_hubspot__email_event_delivered:f0
69. model.hubspot_source.stg_hubspot__email_event_delivered
  • Input Column: 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp[response]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • returned_response: It is directly mapped to the 'returned_response' column in the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 69. model.hubspot_source.stg_hubspot__email_event_delivered[returned_response]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • returned_response: Directly copied to the output
Column Lineage
%3 69. model.hubspot_source.stg_hubspot__email_event_delivered 69. model.hubspot_source.stg_hubspot__email_event_delivered smtp_id 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered smtp_id 69. model.hubspot_source.stg_hubspot__email_event_delivered:f0->13. model.hubspot.hubspot__email_event_delivered:f0 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp smtp_id 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp:f0->69. model.hubspot_source.stg_hubspot__email_event_delivered:f0
69. model.hubspot_source.stg_hubspot__email_event_delivered
  • Input Column: 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp[smtp_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • smtp_id: It is directly mapped to the 'smtp_id' column in the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 69. model.hubspot_source.stg_hubspot__email_event_delivered[smtp_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • smtp_id: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event created_timestamp 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[created]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • created_timestamp: Cast as TIMESTAMP and renamed
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event email_campaign_id 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp email_campaign_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[email_campaign_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • email_campaign_id: Directly mapped
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event recipient_email_address 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp recipient 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[recipient]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • recipient_email_address: Directly mapped without changes
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_timestamp 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_created]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • sent_timestamp: Directly mapped after casting to TIMESTAMP
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->13. model.hubspot.hubspot__email_event_delivered:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_id 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp id 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[id]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_id: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with the contact_merge_audit CTE
    • Filtering Used in the WHERE clause to filter out merged contacts
    • Output Columns:
      • contact_id: Directly copied to the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the LEFT JOIN operation
    • Output Columns:
      • contact_id: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped

This SQL query integrates data from three different tables: email event dropped, email event, and contact information. It joins these tables to create a comprehensive view of dropped email events, including details about the email campaign, recipient, and associated contact. The query also adds a flag to indicate if the contact has been deleted.

IntegrationCleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_dropped
), events AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event
), contacts AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.int_hubspot__contact_merge_adjust
), events_joined AS (
  SELECT
    base.*,
    events.created_timestamp,
    events.email_campaign_id,
    events.recipient_email_address,
    events.sent_timestamp AS email_send_timestamp,
    events.sent_by_event_id AS email_send_id
  FROM base
  LEFT JOIN events
    USING (event_id)
), contacts_joined AS (
  SELECT
    events_joined.*,
    contacts.contact_id,
    COALESCE(contacts.is_contact_deleted, FALSE) AS is_contact_deleted
  FROM events_joined
  LEFT JOIN contacts
    ON events_joined.recipient_email_address = contacts.email
)
SELECT
  *
FROM contacts_joined
%3 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped _fivetran_synced is_contact_deleted bcc_emails cc_emails drop_message drop_reason email_subject event_id from_email reply_to_email created_timestamp email_campaign_id recipient_email_address email_send_timestamp email_send_id contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id is_contact_deleted email _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->14. model.hubspot.hubspot__email_event_dropped:f15 28. model.hubspot.int_hubspot__contact_merge_adjust:f1->14. model.hubspot.hubspot__email_event_dropped:f1 28. model.hubspot.int_hubspot__contact_merge_adjust:f3->14. model.hubspot.hubspot__email_event_dropped:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced created_timestamp email_campaign_id event_id recipient_email_address sent_by_event_id sent_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 62. model.hubspot_source.stg_hubspot__email_event:f1->14. model.hubspot.hubspot__email_event_dropped:f10 62. model.hubspot_source.stg_hubspot__email_event:f2->14. model.hubspot.hubspot__email_event_dropped:f11 62. model.hubspot_source.stg_hubspot__email_event:f3->14. model.hubspot.hubspot__email_event_dropped:f7 62. model.hubspot_source.stg_hubspot__email_event:f4->14. model.hubspot.hubspot__email_event_dropped:f12 62. model.hubspot_source.stg_hubspot__email_event:f5->14. model.hubspot.hubspot__email_event_dropped:f14 62. model.hubspot_source.stg_hubspot__email_event:f6->14. model.hubspot.hubspot__email_event_dropped:f13 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped _fivetran_synced bcc_emails cc_emails drop_message drop_reason email_subject event_id from_email reply_to_email 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0 71. model.hubspot_source.stg_hubspot__email_event_dropped:f1->14. model.hubspot.hubspot__email_event_dropped:f2 71. model.hubspot_source.stg_hubspot__email_event_dropped:f2->14. model.hubspot.hubspot__email_event_dropped:f3 71. model.hubspot_source.stg_hubspot__email_event_dropped:f3->14. model.hubspot.hubspot__email_event_dropped:f4 71. model.hubspot_source.stg_hubspot__email_event_dropped:f4->14. model.hubspot.hubspot__email_event_dropped:f5 71. model.hubspot_source.stg_hubspot__email_event_dropped:f5->14. model.hubspot.hubspot__email_event_dropped:f6 71. model.hubspot_source.stg_hubspot__email_event_dropped:f6->14. model.hubspot.hubspot__email_event_dropped:f7 71. model.hubspot_source.stg_hubspot__email_event_dropped:f7->14. model.hubspot.hubspot__email_event_dropped:f8 71. model.hubspot_source.stg_hubspot__email_event_dropped:f8->14. model.hubspot.hubspot__email_event_dropped:f9
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
is_contact_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
bcc_emails text The 'bcc' field of the email message.
cc_emails text The 'cc' field of the email message.
drop_message text The raw message describing why the email message was dropped. This will usually provide additional details beyond 'dropReason'.
drop_reason text The reason why the email message was dropped. See below for the possible values.
email_subject text The subject line of the email message.
event_id text The ID of the event.
from_email text The 'from' field of the email message.
reply_to_email text The 'reply-to' field of the email message.
created_timestamp timestamp without time zone The created timestamp of the event.
email_campaign_id integer The ID of the related email campaign.
recipient_email_address text The email address of the contact related to the event.
email_send_timestamp timestamp without time zone The timestamp of the SENT event related to this event.
email_send_id text The event ID which uniquely identifies the email message's SENT event. If not applicable, this property is omitted.
contact_id integer The ID of the related contact.
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust _fivetran_synced 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->14. model.hubspot.hubspot__email_event_dropped:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped _fivetran_synced 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp _fivetran_synced 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp _fivetran_synced 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_synced 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_synced]
    • Direct The column is directly copied with a cast to TIMESTAMP.
    • Output Columns:
      • _fivetran_synced: Directly mapped with a TIMESTAMP cast
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Cast as TIMESTAMP
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP in both the macro and fields CTEs.
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output '_fivetran_synced' column
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust is_contact_deleted 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->14. model.hubspot.hubspot__email_event_dropped:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact is_contact_deleted 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_deleted 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_deleted]
    • Cleaning This column is likely used to determine the 'is_contact_deleted' field, though not explicitly shown in the provided SQL.
    • Output Columns:
      • is_contact_deleted: Likely transformed to determine if the contact is deleted
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function applied
    • Cleaning The column is cleaned by applying a default value of FALSE if it's NULL
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
Column Lineage
%3 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped bcc_emails 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped bcc_emails 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp bcc 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[bcc]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed in the fields CTE.
    • Output Columns:
      • bcc_emails: Directly mapped after renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[bcc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • bcc_emails: Directly copied to the output
Column Lineage
%3 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped cc_emails 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped cc_emails 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp cc 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[cc]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed in the fields CTE.
    • Output Columns:
      • cc_emails: Directly mapped after renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[cc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • cc_emails: Directly copied to the output
Column Lineage
%3 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped drop_message 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped drop_message 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp drop_message 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[drop_message]
    • Cleaning The column is cast as TEXT in the macro CTE.
    • Output Columns:
      • drop_message: Directly mapped without renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[drop_message]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • drop_message: Directly copied to the output
Column Lineage
%3 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped drop_reason 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped drop_reason 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp drop_reason 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[drop_reason]
    • Cleaning The column is cast as TEXT in the macro CTE.
    • Output Columns:
      • drop_reason: Directly mapped without renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[drop_reason]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • drop_reason: Directly copied to the output
Column Lineage
%3 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped email_subject 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped email_subject 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp subject 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[subject]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed in the fields CTE.
    • Output Columns:
      • email_subject: Directly mapped after renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[email_subject]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_subject: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event event_id 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped event_id 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp id 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped and renamed
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[id]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed in the fields CTE.
    • Output Columns:
      • event_id: Directly mapped after renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join tables
    • Output Columns:
      • event_id: Directly copied to the output
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[event_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped from_email 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped from_email 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp from 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[from]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed in the fields CTE.
    • Output Columns:
      • from_email: Directly mapped after renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[from_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • from_email: Directly copied to the output
Column Lineage
%3 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped reply_to_email 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped reply_to_email 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp reply_to 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[reply_to]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed in the fields CTE.
    • Output Columns:
      • reply_to_email: Directly mapped after renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[reply_to_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • reply_to_email: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event created_timestamp 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[created]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • created_timestamp: Cast as TIMESTAMP and renamed
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event email_campaign_id 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp email_campaign_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[email_campaign_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • email_campaign_id: Directly mapped
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event recipient_email_address 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp recipient 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[recipient]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • recipient_email_address: Directly mapped without changes
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly mapped
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_timestamp 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_created]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • sent_timestamp: Directly mapped after casting to TIMESTAMP
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed for clarity
    • Output Columns:
      • email_send_timestamp: Directly mapped and renamed
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed for clarity
    • Output Columns:
      • email_send_id: Directly mapped and renamed
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->14. model.hubspot.hubspot__email_event_dropped:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_id 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp id 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[id]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_id: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with the contact_merge_audit CTE
    • Filtering Used in the WHERE clause to filter out merged contacts
    • Output Columns:
      • contact_id: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the LEFT JOIN operation
    • Output Columns:
      • contact_id: Directly copied to the output
15. model.hubspot.hubspot__email_event_forward

This SQL query integrates data from three different tables: email event forwards, general email events, and contacts. It joins these tables to create a comprehensive view of email forward events, including details about the email campaign, recipient, and associated contact information. The query also handles potential deleted contacts by including a flag for this status.

IntegrationCleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_forward
), events AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event
), contacts AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.int_hubspot__contact_merge_adjust
), events_joined AS (
  SELECT
    base.*,
    events.created_timestamp,
    events.email_campaign_id,
    events.recipient_email_address,
    events.sent_timestamp AS email_send_timestamp,
    events.sent_by_event_id AS email_send_id
  FROM base
  LEFT JOIN events
    USING (event_id)
), contacts_joined AS (
  SELECT
    events_joined.*,
    contacts.contact_id,
    COALESCE(contacts.is_contact_deleted, FALSE) AS is_contact_deleted
  FROM events_joined
  LEFT JOIN contacts
    ON events_joined.recipient_email_address = contacts.email
)
SELECT
  *
FROM contacts_joined
%3 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward _fivetran_synced is_contact_deleted browser event_id geo_location ip_address user_agent created_timestamp email_campaign_id recipient_email_address email_send_timestamp email_send_id contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id is_contact_deleted email _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->15. model.hubspot.hubspot__email_event_forward:f12 28. model.hubspot.int_hubspot__contact_merge_adjust:f1->15. model.hubspot.hubspot__email_event_forward:f1 28. model.hubspot.int_hubspot__contact_merge_adjust:f3->15. model.hubspot.hubspot__email_event_forward:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced created_timestamp email_campaign_id event_id recipient_email_address sent_timestamp sent_by_event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 62. model.hubspot_source.stg_hubspot__email_event:f1->15. model.hubspot.hubspot__email_event_forward:f7 62. model.hubspot_source.stg_hubspot__email_event:f2->15. model.hubspot.hubspot__email_event_forward:f8 62. model.hubspot_source.stg_hubspot__email_event:f3->15. model.hubspot.hubspot__email_event_forward:f3 62. model.hubspot_source.stg_hubspot__email_event:f4->15. model.hubspot.hubspot__email_event_forward:f9 62. model.hubspot_source.stg_hubspot__email_event:f5->15. model.hubspot.hubspot__email_event_forward:f10 62. model.hubspot_source.stg_hubspot__email_event:f6->15. model.hubspot.hubspot__email_event_forward:f11 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward _fivetran_synced browser event_id geo_location ip_address user_agent 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0 73. model.hubspot_source.stg_hubspot__email_event_forward:f1->15. model.hubspot.hubspot__email_event_forward:f2 73. model.hubspot_source.stg_hubspot__email_event_forward:f2->15. model.hubspot.hubspot__email_event_forward:f3 73. model.hubspot_source.stg_hubspot__email_event_forward:f3->15. model.hubspot.hubspot__email_event_forward:f4 73. model.hubspot_source.stg_hubspot__email_event_forward:f4->15. model.hubspot.hubspot__email_event_forward:f5 73. model.hubspot_source.stg_hubspot__email_event_forward:f5->15. model.hubspot.hubspot__email_event_forward:f6
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
is_contact_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
browser text A JSON object representing the browser which serviced the event. Its comprised of the properties: 'name', 'family', 'producer', 'producer_url', 'type', 'url', 'version'.
event_id text The ID of the event.
geo_location text A JSON object representing the location where the event occurred. It's comprised of the properties: 'city', 'state', 'country'.
ip_address integer The contact's IP address when the event occurred.
user_agent text The user agent responsible for the event, e.g. “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36”
created_timestamp timestamp without time zone The created timestamp of the event.
email_campaign_id integer The ID of the related email campaign.
recipient_email_address text The email address of the contact related to the event.
email_send_timestamp timestamp without time zone The timestamp of the SENT event related to this event.
email_send_id text The event ID which uniquely identifies the email message's SENT event. If not applicable, this property is omitted.
contact_id integer The ID of the related contact.
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust _fivetran_synced 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->15. model.hubspot.hubspot__email_event_forward:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward _fivetran_synced 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp _fivetran_synced 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp _fivetran_synced 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_synced 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_synced]
    • Direct The column is directly copied with a cast to TIMESTAMP.
    • Output Columns:
      • _fivetran_synced: Directly mapped with a TIMESTAMP cast
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Cast as TIMESTAMP
73. model.hubspot_source.stg_hubspot__email_event_forward
  • Input Column: 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct This column is directly copied from the input table to the output without any transformation.
    • Integration The column is implicitly used in the LEFT JOIN operation between the events_joined CTE and the contacts table.
    • Output Columns:
      • _fivetran_synced: This column is directly mapped to the '_fivetran_synced' column in the output.
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
  • Input Column: 73. model.hubspot_source.stg_hubspot__email_event_forward[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust is_contact_deleted 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->15. model.hubspot.hubspot__email_event_forward:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact is_contact_deleted 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_deleted 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_deleted]
    • Cleaning This column is likely used to determine the 'is_contact_deleted' field, though not explicitly shown in the provided SQL.
    • Output Columns:
      • is_contact_deleted: Likely transformed to determine if the contact is deleted
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied to the output
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Cleaning The column is cleaned by using COALESCE to handle NULL values
    • Integration The column is used in the final SELECT statement
    • Output Columns:
      • is_contact_deleted: Cleaned and mapped to the output
Column Lineage
%3 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward browser 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward browser 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp browser 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f0
73. model.hubspot_source.stg_hubspot__email_event_forward
  • Input Column: 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp[browser]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • browser: Directly mapped without changes
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 73. model.hubspot_source.stg_hubspot__email_event_forward[browser]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • browser: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event event_id 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward event_id 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp id 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped and renamed
73. model.hubspot_source.stg_hubspot__email_event_forward
  • Input Column: 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp[id]
    • Cleaning The column is cast as TEXT and renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped after casting and renaming
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join with the base table
    • Output Columns:
      • event_id: Directly copied from the base table
  • Input Column: 73. model.hubspot_source.stg_hubspot__email_event_forward[event_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward geo_location 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward geo_location 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp location 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f0
73. model.hubspot_source.stg_hubspot__email_event_forward
  • Input Column: 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp[location]
    • Cleaning The column is renamed to 'geo_location'
    • Output Columns:
      • geo_location: Directly mapped after renaming
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 73. model.hubspot_source.stg_hubspot__email_event_forward[geo_location]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • geo_location: Directly copied to the output
Column Lineage
%3 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward ip_address 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward ip_address 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp ip_address 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f0
73. model.hubspot_source.stg_hubspot__email_event_forward
  • Input Column: 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp[ip_address]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • ip_address: Directly mapped without changes
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 73. model.hubspot_source.stg_hubspot__email_event_forward[ip_address]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • ip_address: Directly copied to the output
Column Lineage
%3 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward user_agent 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward user_agent 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp user_agent 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f0
73. model.hubspot_source.stg_hubspot__email_event_forward
  • Input Column: 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp[user_agent]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • user_agent: Directly mapped without changes
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 73. model.hubspot_source.stg_hubspot__email_event_forward[user_agent]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • user_agent: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event created_timestamp 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[created]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • created_timestamp: Cast as TIMESTAMP and renamed
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event email_campaign_id 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp email_campaign_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[email_campaign_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • email_campaign_id: Directly mapped
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event recipient_email_address 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp recipient 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[recipient]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • recipient_email_address: Directly mapped without changes
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_timestamp 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_created]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • sent_timestamp: Directly mapped after casting to TIMESTAMP
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->15. model.hubspot.hubspot__email_event_forward:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_id 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp id 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[id]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_id: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with the contact_merge_audit CTE
    • Filtering Used in the WHERE clause to filter out merged contacts
    • Output Columns:
      • contact_id: Directly copied to the output
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the final SELECT statement
    • Output Columns:
      • contact_id: Directly copied to the output
16. model.hubspot.hubspot__email_event_opens

This SQL query integrates data from multiple tables related to Hubspot email events. It starts with the email open events and joins them with general email events to get additional information such as campaign ID and send timestamp. Then it joins with contact data to associate the email events with specific contacts. The query also includes a check for deleted contacts.

IntegrationCleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_open
), events AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event
), contacts AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.int_hubspot__contact_merge_adjust
), events_joined AS (
  SELECT
    base.*,
    events.created_timestamp,
    events.email_campaign_id,
    events.recipient_email_address,
    events.sent_timestamp AS email_send_timestamp,
    events.sent_by_event_id AS email_send_id
  FROM base
  LEFT JOIN events
    USING (event_id)
), contacts_joined AS (
  SELECT
    events_joined.*,
    contacts.contact_id,
    COALESCE(contacts.is_contact_deleted, FALSE) AS is_contact_deleted
  FROM events_joined
  LEFT JOIN contacts
    ON events_joined.recipient_email_address = contacts.email
)
SELECT
  *
FROM contacts_joined
%3 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens _fivetran_synced is_contact_deleted browser duration_open event_id geo_location ip_address user_agent created_timestamp email_campaign_id recipient_email_address email_send_timestamp email_send_id contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id is_contact_deleted email _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->16. model.hubspot.hubspot__email_event_opens:f13 28. model.hubspot.int_hubspot__contact_merge_adjust:f1->16. model.hubspot.hubspot__email_event_opens:f1 28. model.hubspot.int_hubspot__contact_merge_adjust:f3->16. model.hubspot.hubspot__email_event_opens:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced created_timestamp email_campaign_id event_id recipient_email_address sent_by_event_id sent_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 62. model.hubspot_source.stg_hubspot__email_event:f1->16. model.hubspot.hubspot__email_event_opens:f8 62. model.hubspot_source.stg_hubspot__email_event:f2->16. model.hubspot.hubspot__email_event_opens:f9 62. model.hubspot_source.stg_hubspot__email_event:f3->16. model.hubspot.hubspot__email_event_opens:f4 62. model.hubspot_source.stg_hubspot__email_event:f4->16. model.hubspot.hubspot__email_event_opens:f10 62. model.hubspot_source.stg_hubspot__email_event:f5->16. model.hubspot.hubspot__email_event_opens:f12 62. model.hubspot_source.stg_hubspot__email_event:f6->16. model.hubspot.hubspot__email_event_opens:f11 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open _fivetran_synced browser duration_open event_id geo_location ip_address user_agent 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0 75. model.hubspot_source.stg_hubspot__email_event_open:f1->16. model.hubspot.hubspot__email_event_opens:f2 75. model.hubspot_source.stg_hubspot__email_event_open:f2->16. model.hubspot.hubspot__email_event_opens:f3 75. model.hubspot_source.stg_hubspot__email_event_open:f3->16. model.hubspot.hubspot__email_event_opens:f4 75. model.hubspot_source.stg_hubspot__email_event_open:f4->16. model.hubspot.hubspot__email_event_opens:f5 75. model.hubspot_source.stg_hubspot__email_event_open:f5->16. model.hubspot.hubspot__email_event_opens:f6 75. model.hubspot_source.stg_hubspot__email_event_open:f6->16. model.hubspot.hubspot__email_event_opens:f7
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
is_contact_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
browser text A JSON object representing the browser which serviced the event. Its comprised of the properties: 'name', 'family', 'producer', 'producer_url', 'type', 'url', 'version'.
duration_open integer If provided and nonzero, the approximate number of milliseconds the user had opened the email.
event_id text The ID of the event.
geo_location text A JSON object representing the location where the event occurred. It's comprised of the properties: 'city', 'state', 'country'.
ip_address integer The contact's IP address when the event occurred.
user_agent text The user agent responsible for the event, e.g. “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36”
created_timestamp timestamp without time zone The created timestamp of the event.
email_campaign_id integer The ID of the related email campaign.
recipient_email_address text The email address of the contact related to the event.
email_send_timestamp timestamp without time zone The timestamp of the SENT event related to this event.
email_send_id text The event ID which uniquely identifies the email message's SENT event. If not applicable, this property is omitted.
contact_id integer The ID of the related contact.
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust _fivetran_synced 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->16. model.hubspot.hubspot__email_event_opens:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open _fivetran_synced 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp _fivetran_synced 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp _fivetran_synced 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_synced 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_synced]
    • Direct The column is directly copied with a cast to TIMESTAMP.
    • Output Columns:
      • _fivetran_synced: Directly mapped with a TIMESTAMP cast
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Cast as TIMESTAMP
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct This column is directly copied from the input table to the output without any transformation.
    • Integration This column is implicitly used in the LEFT JOIN operation between the events_joined CTE and the contacts table.
    • Output Columns:
      • _fivetran_synced: This column is directly mapped to the output '_fivetran_synced' column.
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust is_contact_deleted 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->16. model.hubspot.hubspot__email_event_opens:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact is_contact_deleted 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_deleted 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_deleted]
    • Cleaning This column is likely used to determine the 'is_contact_deleted' field, though not explicitly shown in the provided SQL.
    • Output Columns:
      • is_contact_deleted: Likely transformed to determine if the contact is deleted
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied to the output
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function to default to FALSE if null
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
Column Lineage
%3 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open browser 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens browser 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp browser 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[browser]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • browser: Directly mapped without changes
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[browser]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • browser: Directly copied
Column Lineage
%3 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open duration_open 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens duration_open 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp duration 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[duration]
    • Cleaning The column is renamed to 'duration_open'
    • Output Columns:
      • duration_open: Directly mapped after renaming
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[duration_open]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • duration_open: Directly copied
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event event_id 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open event_id 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp id 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped and renamed
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[id]
    • Cleaning The column is cast as TEXT and renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped after casting and renaming
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join with the base table
    • Output Columns:
      • event_id: Directly copied to the output
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[event_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied
Column Lineage
%3 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open geo_location 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens geo_location 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp location 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[location]
    • Cleaning The column is renamed to 'geo_location'
    • Output Columns:
      • geo_location: Directly mapped after renaming
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[geo_location]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • geo_location: Directly copied
Column Lineage
%3 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open ip_address 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens ip_address 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp ip_address 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[ip_address]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • ip_address: Directly mapped without changes
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[ip_address]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • ip_address: Directly copied
Column Lineage
%3 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open user_agent 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens user_agent 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp user_agent 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[user_agent]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • user_agent: Directly mapped without changes
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[user_agent]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • user_agent: Directly copied
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event created_timestamp 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[created]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • created_timestamp: Cast as TIMESTAMP and renamed
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event email_campaign_id 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp email_campaign_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[email_campaign_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • email_campaign_id: Directly mapped
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event recipient_email_address 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp recipient 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[recipient]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • recipient_email_address: Directly mapped without changes
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_timestamp 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_created]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • sent_timestamp: Directly mapped after casting to TIMESTAMP
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->16. model.hubspot.hubspot__email_event_opens:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_id 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp id 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[id]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_id: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with the contact_merge_audit CTE
    • Filtering Used in the WHERE clause to filter out merged contacts
    • Output Columns:
      • contact_id: Directly copied to the output
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the email events data
    • Output Columns:
      • contact_id: Directly copied to the output
17. model.hubspot.hubspot__email_event_print

This SQL query integrates data from three different sources: email print events, general email events, and contact information. It joins these tables to create a comprehensive view of email print events, including details about the email campaign, recipient, and associated contact. The query also includes a coalesce function to handle potentially null values for the 'is_contact_deleted' field.

IntegrationCleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_print
), events AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event
), contacts AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.int_hubspot__contact_merge_adjust
), events_joined AS (
  SELECT
    base.*,
    events.created_timestamp,
    events.email_campaign_id,
    events.recipient_email_address,
    events.sent_timestamp AS email_send_timestamp,
    events.sent_by_event_id AS email_send_id
  FROM base
  LEFT JOIN events
    USING (event_id)
), contacts_joined AS (
  SELECT
    events_joined.*,
    contacts.contact_id,
    COALESCE(contacts.is_contact_deleted, FALSE) AS is_contact_deleted
  FROM events_joined
  LEFT JOIN contacts
    ON events_joined.recipient_email_address = contacts.email
)
SELECT
  *
FROM contacts_joined
%3 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print _fivetran_synced is_contact_deleted browser event_id geo_location ip_address user_agent created_timestamp email_campaign_id recipient_email_address email_send_timestamp email_send_id contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id is_contact_deleted email _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->17. model.hubspot.hubspot__email_event_print:f12 28. model.hubspot.int_hubspot__contact_merge_adjust:f1->17. model.hubspot.hubspot__email_event_print:f1 28. model.hubspot.int_hubspot__contact_merge_adjust:f3->17. model.hubspot.hubspot__email_event_print:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced created_timestamp email_campaign_id event_id recipient_email_address sent_timestamp sent_by_event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 62. model.hubspot_source.stg_hubspot__email_event:f1->17. model.hubspot.hubspot__email_event_print:f7 62. model.hubspot_source.stg_hubspot__email_event:f2->17. model.hubspot.hubspot__email_event_print:f8 62. model.hubspot_source.stg_hubspot__email_event:f3->17. model.hubspot.hubspot__email_event_print:f3 62. model.hubspot_source.stg_hubspot__email_event:f4->17. model.hubspot.hubspot__email_event_print:f9 62. model.hubspot_source.stg_hubspot__email_event:f5->17. model.hubspot.hubspot__email_event_print:f10 62. model.hubspot_source.stg_hubspot__email_event:f6->17. model.hubspot.hubspot__email_event_print:f11 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print _fivetran_synced browser event_id geo_location ip_address user_agent 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0 77. model.hubspot_source.stg_hubspot__email_event_print:f1->17. model.hubspot.hubspot__email_event_print:f2 77. model.hubspot_source.stg_hubspot__email_event_print:f2->17. model.hubspot.hubspot__email_event_print:f3 77. model.hubspot_source.stg_hubspot__email_event_print:f3->17. model.hubspot.hubspot__email_event_print:f4 77. model.hubspot_source.stg_hubspot__email_event_print:f4->17. model.hubspot.hubspot__email_event_print:f5 77. model.hubspot_source.stg_hubspot__email_event_print:f5->17. model.hubspot.hubspot__email_event_print:f6
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
is_contact_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
browser text A JSON object representing the browser which serviced the event. Its comprised of the properties: 'name', 'family', 'producer', 'producer_url', 'type', 'url', 'version'.
event_id text The ID of the event.
geo_location text A JSON object representing the location where the event occurred. It's comprised of the properties: 'city', 'state', 'country'.
ip_address integer The contact's IP address when the event occurred.
user_agent text The user agent responsible for the event, e.g. “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36”
created_timestamp timestamp without time zone The created timestamp of the event.
email_campaign_id integer The ID of the related email campaign.
recipient_email_address text The email address of the contact related to the event.
email_send_timestamp timestamp without time zone The timestamp of the SENT event related to this event.
email_send_id text The event ID which uniquely identifies the email message's SENT event. If not applicable, this property is omitted.
contact_id integer The ID of the related contact.
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust _fivetran_synced 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->17. model.hubspot.hubspot__email_event_print:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print _fivetran_synced 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp _fivetran_synced 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp _fivetran_synced 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_synced 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_synced]
    • Direct The column is directly copied with a cast to TIMESTAMP.
    • Output Columns:
      • _fivetran_synced: Directly mapped with a TIMESTAMP cast
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Cast as TIMESTAMP
77. model.hubspot_source.stg_hubspot__email_event_print
  • Input Column: 78. model.hubspot_source.stg_hubspot__email_event_print_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP in both the macro and fields CTEs.
    • Output Columns:
      • _fivetran_synced: Directly mapped after being cast.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join operation between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output '_fivetran_synced' column
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
  • Input Column: 77. model.hubspot_source.stg_hubspot__email_event_print[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust is_contact_deleted 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->17. model.hubspot.hubspot__email_event_print:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact is_contact_deleted 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_deleted 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_deleted]
    • Cleaning This column is likely used to determine the 'is_contact_deleted' field, though not explicitly shown in the provided SQL.
    • Output Columns:
      • is_contact_deleted: Likely transformed to determine if the contact is deleted
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied to the output
17. model.hubspot.hubspot__email_event_print
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function applied
    • Cleaning The COALESCE function is used to replace NULL values with FALSE
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
Column Lineage
%3 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print browser 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print browser 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp browser 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f0
77. model.hubspot_source.stg_hubspot__email_event_print
  • Input Column: 78. model.hubspot_source.stg_hubspot__email_event_print_tmp[browser]
    • Direct The column is directly copied without any transformation.
    • Output Columns:
      • browser: Directly copied to the output.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 77. model.hubspot_source.stg_hubspot__email_event_print[browser]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • browser: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event event_id 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print event_id 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp id 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped and renamed
77. model.hubspot_source.stg_hubspot__email_event_print
  • Input Column: 78. model.hubspot_source.stg_hubspot__email_event_print_tmp[id]
    • Cleaning The column is cast as TEXT in the macro CTE and renamed to 'event_id' in the fields CTE.
    • Output Columns:
      • event_id: Directly mapped after being cast and renamed.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join the base table with the events table
    • Output Columns:
      • event_id: Directly copied from the base table
  • Input Column: 77. model.hubspot_source.stg_hubspot__email_event_print[event_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print geo_location 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print geo_location 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp location 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f0
77. model.hubspot_source.stg_hubspot__email_event_print
  • Input Column: 78. model.hubspot_source.stg_hubspot__email_event_print_tmp[location]
    • Cleaning The column is renamed to 'geo_location' in the fields CTE.
    • Output Columns:
      • geo_location: Directly mapped after being renamed.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 77. model.hubspot_source.stg_hubspot__email_event_print[geo_location]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • geo_location: Directly copied to the output
Column Lineage
%3 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print ip_address 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print ip_address 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp ip_address 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f0
77. model.hubspot_source.stg_hubspot__email_event_print
  • Input Column: 78. model.hubspot_source.stg_hubspot__email_event_print_tmp[ip_address]
    • Direct The column is directly copied without any transformation.
    • Output Columns:
      • ip_address: Directly copied to the output.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 77. model.hubspot_source.stg_hubspot__email_event_print[ip_address]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • ip_address: Directly copied to the output
Column Lineage
%3 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print user_agent 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print user_agent 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp user_agent 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f0
77. model.hubspot_source.stg_hubspot__email_event_print
  • Input Column: 78. model.hubspot_source.stg_hubspot__email_event_print_tmp[user_agent]
    • Direct The column is directly copied without any transformation.
    • Output Columns:
      • user_agent: Directly copied to the output.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 77. model.hubspot_source.stg_hubspot__email_event_print[user_agent]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • user_agent: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event created_timestamp 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[created]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • created_timestamp: Cast as TIMESTAMP and renamed
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event email_campaign_id 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp email_campaign_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[email_campaign_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • email_campaign_id: Directly mapped
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event recipient_email_address 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp recipient 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[recipient]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • recipient_email_address: Directly mapped without changes
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_timestamp 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_created]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • sent_timestamp: Directly mapped after casting to TIMESTAMP
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied and renamed
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied and renamed
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->17. model.hubspot.hubspot__email_event_print:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_id 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp id 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[id]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_id: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with the contact_merge_audit CTE
    • Filtering Used in the WHERE clause to filter out merged contacts
    • Output Columns:
      • contact_id: Directly copied to the output
17. model.hubspot.hubspot__email_event_print
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the email events data
    • Output Columns:
      • contact_id: Directly copied to the output
18. model.hubspot.hubspot__email_event_sent

This SQL query integrates data from three sources: email event sent data, general email event data, and contact data. It joins these tables to create a comprehensive view of email events, including recipient information, campaign details, and whether the contact has been deleted. The query doesn't perform any aggregation, filtering, or complex transformations, but focuses on combining related data from different tables.

Integration
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_sent
), events AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event
), contacts AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.int_hubspot__contact_merge_adjust
), events_joined AS (
  SELECT
    base.*,
    events.created_timestamp,
    events.email_campaign_id,
    events.recipient_email_address,
    events.sent_timestamp AS email_send_timestamp,
    events.sent_by_event_id AS email_send_id
  FROM base
  LEFT JOIN events
    USING (event_id)
), contacts_joined AS (
  SELECT
    events_joined.*,
    contacts.contact_id,
    COALESCE(contacts.is_contact_deleted, FALSE) AS is_contact_deleted
  FROM events_joined
  LEFT JOIN contacts
    ON events_joined.recipient_email_address = contacts.email
)
SELECT
  *
FROM contacts_joined
%3 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent _fivetran_synced is_contact_deleted bcc_emails cc_emails email_subject event_id from_email reply_to_email created_timestamp email_campaign_id recipient_email_address email_send_timestamp email_send_id contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id is_contact_deleted email _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:f13 28. model.hubspot.int_hubspot__contact_merge_adjust:f1->18. model.hubspot.hubspot__email_event_sent:f1 28. model.hubspot.int_hubspot__contact_merge_adjust:f3->18. model.hubspot.hubspot__email_event_sent:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced created_timestamp email_campaign_id event_id recipient_email_address sent_by_event_id sent_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 62. model.hubspot_source.stg_hubspot__email_event:f1->18. model.hubspot.hubspot__email_event_sent:f8 62. model.hubspot_source.stg_hubspot__email_event:f2->18. model.hubspot.hubspot__email_event_sent:f9 62. model.hubspot_source.stg_hubspot__email_event:f3->18. model.hubspot.hubspot__email_event_sent:f5 62. model.hubspot_source.stg_hubspot__email_event:f4->18. model.hubspot.hubspot__email_event_sent:f10 62. model.hubspot_source.stg_hubspot__email_event:f5->18. model.hubspot.hubspot__email_event_sent:f12 62. model.hubspot_source.stg_hubspot__email_event:f6->18. model.hubspot.hubspot__email_event_sent:f11 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent _fivetran_synced bcc_emails cc_emails email_subject event_id from_email reply_to_email 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 79. model.hubspot_source.stg_hubspot__email_event_sent:f1->18. model.hubspot.hubspot__email_event_sent:f2 79. model.hubspot_source.stg_hubspot__email_event_sent:f2->18. model.hubspot.hubspot__email_event_sent:f3 79. model.hubspot_source.stg_hubspot__email_event_sent:f3->18. model.hubspot.hubspot__email_event_sent:f4 79. model.hubspot_source.stg_hubspot__email_event_sent:f4->18. model.hubspot.hubspot__email_event_sent:f5 79. model.hubspot_source.stg_hubspot__email_event_sent:f5->18. model.hubspot.hubspot__email_event_sent:f6 79. model.hubspot_source.stg_hubspot__email_event_sent:f6->18. model.hubspot.hubspot__email_event_sent:f7
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
is_contact_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
bcc_emails text The 'cc' field of the email message.
cc_emails text The 'bcc' field of the email message.
email_subject text The subject line of the email message.
event_id text The ID of the event.
from_email text The 'from' field of the email message.
reply_to_email text The 'reply-to' field of the email message.
created_timestamp timestamp without time zone The created timestamp of the event.
email_campaign_id integer The ID of the related email campaign.
recipient_email_address text The email address of the contact related to the event.
email_send_timestamp timestamp without time zone The timestamp of the SENT event related to this event.
email_send_id text The event ID which uniquely identifies the email message's SENT event. If not applicable, this property is omitted.
contact_id integer The ID of the related contact.
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust _fivetran_synced 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends _fivetran_synced 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent _fivetran_synced 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp _fivetran_synced 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp _fivetran_synced 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_synced 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_synced]
    • Direct The column is directly copied with a cast to TIMESTAMP.
    • Output Columns:
      • _fivetran_synced: Directly mapped with a TIMESTAMP cast
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Cast as TIMESTAMP
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP in both the macro and fields CTEs.
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust is_contact_deleted 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends is_contact_deleted 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact is_contact_deleted 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_deleted 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_deleted]
    • Cleaning This column is likely used to determine the 'is_contact_deleted' field, though not explicitly shown in the provided SQL.
    • Output Columns:
      • is_contact_deleted: Likely transformed to determine if the contact is deleted
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied to the output
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied to the output
    • Cleaning COALESCE is used to set a default value of FALSE if the column is NULL
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[is_contact_deleted]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied
Column Lineage
%3 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent bcc_emails 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent bcc_emails 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends bcc_emails 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp bcc 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[bcc]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to bcc_emails in the fields CTE.
    • Output Columns:
      • bcc_emails: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[bcc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • bcc_emails: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[bcc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • bcc_emails: Directly copied
Column Lineage
%3 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent cc_emails 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent cc_emails 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends cc_emails 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp cc 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[cc]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to cc_emails in the fields CTE.
    • Output Columns:
      • cc_emails: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[cc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • cc_emails: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[cc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • cc_emails: Directly copied
Column Lineage
%3 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent email_subject 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent email_subject 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_subject 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp subject 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[subject]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to email_subject in the fields CTE.
    • Output Columns:
      • email_subject: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[email_subject]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_subject: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[email_subject]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_subject: Directly copied
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event event_id 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends event_id 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent event_id 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp id 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped and renamed
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[id]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to event_id in the fields CTE.
    • Output Columns:
      • event_id: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join with the base table
    • Output Columns:
      • event_id: Indirectly mapped, as it's used for joining but also exists in the base table
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[event_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[event_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • event_id: Directly copied
Column Lineage
%3 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent from_email 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent from_email 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends from_email 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp from 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[from]
    • Cleaning The column is cast as TEXT and renamed to from_email in the macro CTE, then directly selected in the fields CTE.
    • Output Columns:
      • from_email: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[from_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • from_email: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[from_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • from_email: Directly copied
Column Lineage
%3 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent reply_to_email 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent reply_to_email 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends reply_to_email 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp reply_to 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[reply_to]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to reply_to_email in the fields CTE.
    • Output Columns:
      • reply_to_email: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[reply_to_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • reply_to_email: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[reply_to_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • reply_to_email: Directly copied
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event created_timestamp 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends created_timestamp 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[created]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • created_timestamp: Cast as TIMESTAMP and renamed
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event email_campaign_id 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_campaign_id 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp email_campaign_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_id 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[email_campaign_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • email_campaign_id: Directly mapped
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used to join with the email_aggregate_status_change CTE
    • Output Columns:
      • email_campaign_id: Directly copied
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[email_campaign_id]
    • Integration This column is used as the key to join the email_sends table with the campaigns table
    • Aggregation This column is used in the GROUP BY clause of the email_metrics CTE
    • Output Columns:
      • email_campaign_id: It is indirectly mapped to the output email_campaign_id through the join operation
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event recipient_email_address 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends recipient_email_address 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp recipient 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:header
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[recipient]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • recipient_email_address: Directly mapped without changes
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • recipient_email_address: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[recipient_email_address]
    • Integration used as the key to join with contacts table
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_timestamp 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_timestamp 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_created]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • sent_timestamp: Directly mapped after casting to TIMESTAMP
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[email_send_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_id 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[email_send_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as the key to join with the metrics and unsubscribes CTEs
    • Output Columns:
      • email_send_id: Directly copied to the output
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends contact_id 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_id 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp id 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:header 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:header
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[id]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_id: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with the contact_merge_audit CTE
    • Filtering Used in the WHERE clause to filter out merged contacts
    • Output Columns:
      • contact_id: Directly copied to the output
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied to the output without transformation
    • Integration Used as part of the LEFT JOIN operation
    • Output Columns:
      • contact_id: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[contact_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_id: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[contact_id]
    • Integration used as the key to join with contacts and engagements tables
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[contact_id]
    • Integration Used to join the email_sends table with the contact_list_member table
19. model.hubspot.hubspot__email_event_spam_report

This SQL query integrates data from three different sources: email spam report events, general email events, and contact information. It joins these tables to create a comprehensive view of spam report events, including details about the email campaign, recipient, and associated contact. The query also includes a check for deleted contacts.

IntegrationCleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_spam_report
), events AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event
), contacts AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.int_hubspot__contact_merge_adjust
), events_joined AS (
  SELECT
    base.*,
    events.created_timestamp,
    events.email_campaign_id,
    events.recipient_email_address,
    events.sent_timestamp AS email_send_timestamp,
    events.sent_by_event_id AS email_send_id
  FROM base
  LEFT JOIN events
    USING (event_id)
), contacts_joined AS (
  SELECT
    events_joined.*,
    contacts.contact_id,
    COALESCE(contacts.is_contact_deleted, FALSE) AS is_contact_deleted
  FROM events_joined
  LEFT JOIN contacts
    ON events_joined.recipient_email_address = contacts.email
)
SELECT
  *
FROM contacts_joined
%3 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report _fivetran_synced is_contact_deleted event_id ip_address user_agent created_timestamp email_campaign_id recipient_email_address email_send_timestamp email_send_id contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id is_contact_deleted email _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->19. model.hubspot.hubspot__email_event_spam_report:f10 28. model.hubspot.int_hubspot__contact_merge_adjust:f1->19. model.hubspot.hubspot__email_event_spam_report:f1 28. model.hubspot.int_hubspot__contact_merge_adjust:f3->19. model.hubspot.hubspot__email_event_spam_report:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced created_timestamp email_campaign_id event_id recipient_email_address sent_by_event_id sent_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 62. model.hubspot_source.stg_hubspot__email_event:f1->19. model.hubspot.hubspot__email_event_spam_report:f5 62. model.hubspot_source.stg_hubspot__email_event:f2->19. model.hubspot.hubspot__email_event_spam_report:f6 62. model.hubspot_source.stg_hubspot__email_event:f3->19. model.hubspot.hubspot__email_event_spam_report:f2 62. model.hubspot_source.stg_hubspot__email_event:f4->19. model.hubspot.hubspot__email_event_spam_report:f7 62. model.hubspot_source.stg_hubspot__email_event:f5->19. model.hubspot.hubspot__email_event_spam_report:f9 62. model.hubspot_source.stg_hubspot__email_event:f6->19. model.hubspot.hubspot__email_event_spam_report:f8 81. model.hubspot_source.stg_hubspot__email_event_spam_report 81. model.hubspot_source.stg_hubspot__email_event_spam_report _fivetran_synced event_id ip_address user_agent 81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 81. model.hubspot_source.stg_hubspot__email_event_spam_report:f1->19. model.hubspot.hubspot__email_event_spam_report:f2 81. model.hubspot_source.stg_hubspot__email_event_spam_report:f2->19. model.hubspot.hubspot__email_event_spam_report:f3 81. model.hubspot_source.stg_hubspot__email_event_spam_report:f3->19. model.hubspot.hubspot__email_event_spam_report:f4
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
is_contact_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
event_id text The ID of the event.
ip_address integer The contact's IP address when the event occurred.
user_agent integer The user agent responsible for the event, e.g. “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36”
created_timestamp timestamp without time zone The created timestamp of the event.
email_campaign_id integer The ID of the related email campaign.
recipient_email_address text The email address of the contact related to the event.
email_send_timestamp timestamp without time zone The timestamp of the SENT event related to this event.
email_send_id text The event ID which uniquely identifies the email message's SENT event. If not applicable, this property is omitted.
contact_id integer The ID of the related contact.
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust _fivetran_synced 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 81. model.hubspot_source.stg_hubspot__email_event_spam_report 81. model.hubspot_source.stg_hubspot__email_event_spam_report _fivetran_synced 81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp _fivetran_synced 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp _fivetran_synced 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp:f0->81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_synced 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_synced]
    • Direct The column is directly copied with a cast to TIMESTAMP.
    • Output Columns:
      • _fivetran_synced: Directly mapped with a TIMESTAMP cast
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Cast as TIMESTAMP
81. model.hubspot_source.stg_hubspot__email_event_spam_report
  • Input Column: 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp[_fivetran_synced]
    • Cleaning The column is cast to TIMESTAMP type in the macro CTE and again in the fields CTE
    • Output Columns:
      • _fivetran_synced: The column is directly mapped to the output after casting
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output '_fivetran_synced' column
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly selected in the final output without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
  • Input Column: 81. model.hubspot_source.stg_hubspot__email_event_spam_report[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust is_contact_deleted 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact is_contact_deleted 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_deleted 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_deleted]
    • Cleaning This column is likely used to determine the 'is_contact_deleted' field, though not explicitly shown in the provided SQL.
    • Output Columns:
      • is_contact_deleted: Likely transformed to determine if the contact is deleted
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, with a COALESCE function to default to FALSE if null
    • Output Columns:
      • is_contact_deleted: Mapped with COALESCE(is_contact_deleted, FALSE)
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event event_id 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 81. model.hubspot_source.stg_hubspot__email_event_spam_report 81. model.hubspot_source.stg_hubspot__email_event_spam_report event_id 81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp id 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp:f0->81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped and renamed
81. model.hubspot_source.stg_hubspot__email_event_spam_report
  • Input Column: 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp[id]
    • Cleaning The column is cast to TEXT type in the macro CTE
    • Direct The column is directly copied in the fields CTE
    • Output Columns:
      • event_id: The 'id' column is renamed to 'event_id' in the final output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Direct This column is directly selected in the final output without any transformation
    • Integration This column is used as the key to join the base table with the events table
    • Output Columns:
      • event_id: Directly copied to the output
  • Input Column: 81. model.hubspot_source.stg_hubspot__email_event_spam_report[event_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 81. model.hubspot_source.stg_hubspot__email_event_spam_report 81. model.hubspot_source.stg_hubspot__email_event_spam_report ip_address 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report ip_address 81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp ip_address 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp:f0->81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0
81. model.hubspot_source.stg_hubspot__email_event_spam_report
  • Input Column: 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp[ip_address]
    • Cleaning The column is cast to TEXT type in the macro CTE
    • Direct The column is directly copied in the fields CTE
    • Output Columns:
      • ip_address: The column is directly mapped to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 81. model.hubspot_source.stg_hubspot__email_event_spam_report[ip_address]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • ip_address: Directly copied to the output
Column Lineage
%3 81. model.hubspot_source.stg_hubspot__email_event_spam_report 81. model.hubspot_source.stg_hubspot__email_event_spam_report user_agent 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report user_agent 81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp user_agent 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp:f0->81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0
81. model.hubspot_source.stg_hubspot__email_event_spam_report
  • Input Column: 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp[user_agent]
    • Cleaning The column is cast to TEXT type in the macro CTE
    • Direct The column is directly copied in the fields CTE
    • Output Columns:
      • user_agent: The column is directly mapped to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 81. model.hubspot_source.stg_hubspot__email_event_spam_report[user_agent]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • user_agent: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event created_timestamp 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[created]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • created_timestamp: Cast as TIMESTAMP and renamed
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly selected in the final output without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event email_campaign_id 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp email_campaign_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[email_campaign_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • email_campaign_id: Directly mapped
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly selected in the final output without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event recipient_email_address 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp recipient 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[recipient]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • recipient_email_address: Directly mapped without changes
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_timestamp 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_created]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • sent_timestamp: Directly mapped after casting to TIMESTAMP
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_id 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp id 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[id]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_id: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with the contact_merge_audit CTE
    • Filtering Used in the WHERE clause to filter out merged contacts
    • Output Columns:
      • contact_id: Directly copied to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the events data
    • Output Columns:
      • contact_id: Directly copied to the output
20. model.hubspot.hubspot__email_event_status_change

This SQL query integrates data from three different tables: email event status changes, email events, and contacts. It joins these tables to create a comprehensive view of email status change events, including associated campaign information, recipient details, and contact status. The query uses LEFT JOINs to ensure all status change events are included, even if matching records are not found in the other tables. It also adds a flag to indicate whether the contact has been deleted.

IntegrationCleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_status_change
), events AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event
), contacts AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.int_hubspot__contact_merge_adjust
), events_joined AS (
  SELECT
    base.*,
    events.created_timestamp,
    events.email_campaign_id,
    events.recipient_email_address,
    events.sent_timestamp AS email_send_timestamp,
    events.sent_by_event_id AS email_send_id
  FROM base
  LEFT JOIN events
    USING (event_id)
), contacts_joined AS (
  SELECT
    events_joined.*,
    contacts.contact_id,
    COALESCE(contacts.is_contact_deleted, FALSE) AS is_contact_deleted
  FROM events_joined
  LEFT JOIN contacts
    ON events_joined.recipient_email_address = contacts.email
)
SELECT
  *
FROM contacts_joined
%3 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change _fivetran_synced is_contact_deleted change_source event_id is_bounced requested_by_email subscription_status subscriptions created_timestamp email_campaign_id recipient_email_address email_send_timestamp email_send_id contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id is_contact_deleted email _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->20. model.hubspot.hubspot__email_event_status_change:f13 28. model.hubspot.int_hubspot__contact_merge_adjust:f1->20. model.hubspot.hubspot__email_event_status_change:f1 28. model.hubspot.int_hubspot__contact_merge_adjust:f3->20. model.hubspot.hubspot__email_event_status_change:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced created_timestamp email_campaign_id event_id recipient_email_address sent_by_event_id sent_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 62. model.hubspot_source.stg_hubspot__email_event:f1->20. model.hubspot.hubspot__email_event_status_change:f8 62. model.hubspot_source.stg_hubspot__email_event:f2->20. model.hubspot.hubspot__email_event_status_change:f9 62. model.hubspot_source.stg_hubspot__email_event:f3->20. model.hubspot.hubspot__email_event_status_change:f3 62. model.hubspot_source.stg_hubspot__email_event:f4->20. model.hubspot.hubspot__email_event_status_change:f10 62. model.hubspot_source.stg_hubspot__email_event:f5->20. model.hubspot.hubspot__email_event_status_change:f12 62. model.hubspot_source.stg_hubspot__email_event:f6->20. model.hubspot.hubspot__email_event_status_change:f11 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change _fivetran_synced change_source event_id is_bounced requested_by_email subscription_status subscriptions 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0 83. model.hubspot_source.stg_hubspot__email_event_status_change:f1->20. model.hubspot.hubspot__email_event_status_change:f2 83. model.hubspot_source.stg_hubspot__email_event_status_change:f2->20. model.hubspot.hubspot__email_event_status_change:f3 83. model.hubspot_source.stg_hubspot__email_event_status_change:f3->20. model.hubspot.hubspot__email_event_status_change:f4 83. model.hubspot_source.stg_hubspot__email_event_status_change:f4->20. model.hubspot.hubspot__email_event_status_change:f5 83. model.hubspot_source.stg_hubspot__email_event_status_change:f5->20. model.hubspot.hubspot__email_event_status_change:f6 83. model.hubspot_source.stg_hubspot__email_event_status_change:f6->20. model.hubspot.hubspot__email_event_status_change:f7
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
is_contact_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
change_source text The source of the subscription change.
event_id text The ID of the event.
is_bounced integer A HubSpot employee explicitly initiated the status change to block messages to the recipient. (Note this usage has been deprecated in favor of dropping messages with a 'dropReason' of BLOCKED_ADDRESS.)
requested_by_email integer The email address of the person requesting the change on behalf of the recipient. If not applicable, this property is omitted.
subscription_status text The recipient's portal subscription status. Note that if this is 'UNSUBSCRIBED', the property 'subscriptions' is not necessarily an empty array, nor are all subscriptions contained in it necessarily going to have their statuses set to 'UNSUBSCRIBED'.)
subscriptions text An array of JSON objects representing the status of subscriptions for the recipient. Each JSON subscription object is comprised of the properties: 'id', 'status'.
created_timestamp timestamp without time zone The created timestamp of the event.
email_campaign_id integer The ID of the related email campaign.
recipient_email_address text The email address of the contact related to the event.
email_send_timestamp timestamp without time zone The timestamp of the SENT event related to this event.
email_send_id text The event ID which uniquely identifies the email message's SENT event. If not applicable, this property is omitted.
contact_id integer The ID of the related contact.
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust _fivetran_synced 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->20. model.hubspot.hubspot__email_event_status_change:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change _fivetran_synced 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp _fivetran_synced 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp _fivetran_synced 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_synced 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_synced]
    • Direct The column is directly copied with a cast to TIMESTAMP.
    • Output Columns:
      • _fivetran_synced: Directly mapped with a TIMESTAMP cast
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Cast as TIMESTAMP
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the LEFT JOIN between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output '_fivetran_synced' column
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust is_contact_deleted 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->20. model.hubspot.hubspot__email_event_status_change:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact is_contact_deleted 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_deleted 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_deleted]
    • Cleaning This column is likely used to determine the 'is_contact_deleted' field, though not explicitly shown in the provided SQL.
    • Output Columns:
      • is_contact_deleted: Likely transformed to determine if the contact is deleted
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied to the output
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function applied
    • Cleaning The COALESCE function is used to set a default value of FALSE if the column is NULL
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
Column Lineage
%3 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change change_source 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change change_source 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp source 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[source]
    • Cleaning The column is cast as TEXT and renamed
    • Output Columns:
      • change_source: Directly mapped after casting and renaming
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[change_source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event event_id 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change event_id 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp id 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped and renamed
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[id]
    • Cleaning The column is cast as TEXT and renamed
    • Output Columns:
      • event_id: Directly mapped after casting and renaming
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join with the base table
    • Output Columns:
      • event_id: Directly copied to the output
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[event_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change is_bounced 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change is_bounced 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp bounced 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[bounced]
    • Cleaning The column is cast as BOOLEAN and renamed
    • Output Columns:
      • is_bounced: Directly mapped after casting and renaming
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[is_bounced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_bounced: Directly copied to the output
Column Lineage
%3 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change requested_by_email 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change requested_by_email 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp requested_by 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[requested_by]
    • Cleaning The column is cast as TEXT and renamed
    • Output Columns:
      • requested_by_email: Directly mapped after casting and renaming
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[requested_by_email]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • requested_by_email: Directly copied to the output
Column Lineage
%3 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change subscription_status 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change subscription_status 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp portal_subscription_status 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[portal_subscription_status]
    • Cleaning The column is cast as TEXT and renamed
    • Output Columns:
      • subscription_status: Directly mapped after casting and renaming
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[subscription_status]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • subscription_status: Directly copied to the output
Column Lineage
%3 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change subscriptions 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change subscriptions 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp subscriptions 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[subscriptions]
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • subscriptions: Directly mapped after casting
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[subscriptions]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • subscriptions: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event created_timestamp 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[created]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • created_timestamp: Cast as TIMESTAMP and renamed
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event email_campaign_id 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp email_campaign_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[email_campaign_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • email_campaign_id: Directly mapped
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event recipient_email_address 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp recipient 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[recipient]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • recipient_email_address: Directly mapped without changes
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_timestamp 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_created]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • sent_timestamp: Directly mapped after casting to TIMESTAMP
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change email_send_id 20. model.hubspot.hubspot__email_event_status_change:f0->30. model.hubspot.int_hubspot__email_aggregate_status_change:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_id unsubscribes was_unsubcribed 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f2->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f2->5. model.hubspot.hubspot__contacts:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f2->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f2->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f2->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f2->9. model.hubspot.hubspot__email_campaigns:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f2->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f2->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
30. model.hubspot.int_hubspot__email_aggregate_status_change
  • Input Column: 20. model.hubspot.hubspot__email_event_status_change[email_send_id]
    • Filtering The column is filtered to exclude null values (WHERE NOT email_send_id IS NULL)
    • Aggregation The column is used in the GROUP BY clause
    • Output Columns:
      • email_send_id: This column is directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unsubscribes]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unsubscribes: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate the total number of unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Summed up for each contact
      • total_unique_unsubscribes: Counted as unique occurrences for each contact
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is used to count the total number of unsubscribe email events and unique unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribe events
      • total_unique_unsubscribes: Aggregated count of unique unsubscribe events
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate the total number of unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Summed up to get the total number of unsubscribe events.
      • total_unique_unsubscribes: Counted to get the number of unique email sends with unsubscribe events.
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is likely used to calculate the total_unsubscribes and total_unique_unsubscribes metrics in the output.
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribes
      • total_unique_unsubscribes: Aggregated count of unique unsubscribes
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate total unsubscribes and unique unsubscribes
    • Output Columns:
      • total_unsubscribes: Sum of all unsubscribes
      • total_unique_unsubscribes: Count of distinct unsubscribes
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is likely used to calculate the total_unsubscribes and total_unique_unsubscribes in the output
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribes
      • total_unique_unsubscribes: Aggregated count of unique unsubscribes
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->20. model.hubspot.hubspot__email_event_status_change:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_id 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp id 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[id]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_id: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with the contact_merge_audit CTE
    • Filtering Used in the WHERE clause to filter out merged contacts
    • Output Columns:
      • contact_id: Directly copied to the output
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the LEFT JOIN operation
    • Output Columns:
      • contact_id: Directly copied to the output
21. model.hubspot.hubspot__email_sends

This SQL query aggregates and integrates various email event metrics from Hubspot data. It starts by creating CTEs for email event aggregates and status changes. Then it joins these aggregates with the main email sent events, adding various metrics like bounces, clicks, opens, etc. Finally, it calculates boolean flags for each metric and adds unsubscribe information. The result is a comprehensive view of email campaign performance with detailed metrics and flags for each email send.

AggregationIntegrationFeaturization
SQL Query
WITH __dbt__cte__int_hubspot__email_event_aggregates AS (
  WITH events AS (
    SELECT
      *
    FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event
  ), aggregates AS (
    SELECT
      sent_by_event_id AS email_send_id,
      COUNT(CASE WHEN event_type = 'OPEN' THEN sent_by_event_id END) AS opens,
      COUNT(CASE WHEN event_type = 'SENT' THEN sent_by_event_id END) AS sends,
      COUNT(CASE WHEN event_type = 'DELIVERED' THEN sent_by_event_id END) AS deliveries,
      COUNT(CASE WHEN event_type = 'DROPPED' THEN sent_by_event_id END) AS drops,
      COUNT(CASE WHEN event_type = 'CLICK' THEN sent_by_event_id END) AS clicks,
      COUNT(CASE WHEN event_type = 'FORWARD' THEN sent_by_event_id END) AS forwards,
      COUNT(CASE WHEN event_type = 'DEFERRED' THEN sent_by_event_id END) AS deferrals,
      COUNT(CASE WHEN event_type = 'BOUNCE' THEN sent_by_event_id END) AS bounces,
      COUNT(CASE WHEN event_type = 'SPAMREPORT' THEN sent_by_event_id END) AS spam_reports,
      COUNT(CASE WHEN event_type = 'PRINT' THEN sent_by_event_id END) AS prints
    FROM events
    WHERE
      NOT sent_by_event_id IS NULL
    GROUP BY
      1
  )
  SELECT
    *
  FROM aggregates
), __dbt__cte__int_hubspot__email_aggregate_status_change AS (
  WITH base AS (
    SELECT
      *
    FROM TEST.PUBLIC_hubspot.hubspot__email_event_status_change
  ), aggregates AS (
    SELECT
      email_campaign_id,
      email_send_id,
      COUNT(CASE WHEN subscription_status = 'UNSUBSCRIBED' THEN 1 END) AS unsubscribes
    FROM base
    WHERE
      NOT email_send_id IS NULL
    GROUP BY
      1,
      2
  )
  SELECT
    *
  FROM aggregates
), sends AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.hubspot__email_event_sent
), metrics AS (
  SELECT
    *
  FROM __dbt__cte__int_hubspot__email_event_aggregates
), joined AS (
  SELECT
    sends.*,
    COALESCE(metrics.bounces, 0) AS bounces,
    COALESCE(metrics.clicks, 0) AS clicks,
    COALESCE(metrics.deferrals, 0) AS deferrals,
    COALESCE(metrics.deliveries, 0) AS deliveries,
    COALESCE(metrics.drops, 0) AS drops,
    COALESCE(metrics.forwards, 0) AS forwards,
    COALESCE(metrics.opens, 0) AS opens,
    COALESCE(metrics.prints, 0) AS prints,
    COALESCE(metrics.spam_reports, 0) AS spam_reports
  FROM sends
  LEFT JOIN metrics
    USING (email_send_id)
), booleans AS (
  SELECT
    *,
    bounces > 0 AS was_bounced,
    clicks > 0 AS was_clicked,
    deferrals > 0 AS was_deferred,
    deliveries > 0 AS was_delivered,
    forwards > 0 AS was_forwarded,
    opens > 0 AS was_opened,
    prints > 0 AS was_printed,
    spam_reports > 0 AS was_spam_reported
  FROM joined
), unsubscribes AS (
  SELECT
    *
  FROM __dbt__cte__int_hubspot__email_aggregate_status_change
), unsubscribes_joined AS (
  SELECT
    booleans.*,
    COALESCE(unsubscribes.unsubscribes, 0) AS unsubscribes,
    COALESCE(unsubscribes.unsubscribes, 0) > 0 AS was_unsubcribed
  FROM booleans
  LEFT JOIN unsubscribes
    USING (email_send_id)
)
SELECT
  *
FROM unsubscribes_joined
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends _fivetran_synced is_contact_deleted bcc_emails cc_emails email_subject event_id from_email reply_to_email created_timestamp email_campaign_id recipient_email_address email_send_timestamp email_send_id contact_id bounces clicks deferrals deliveries drops forwards opens prints spam_reports unsubscribes was_bounced was_clicked was_deferred was_delivered was_forwarded was_opened was_printed was_spam_reported was_unsubcribed 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent _fivetran_synced is_contact_deleted bcc_emails cc_emails email_subject event_id from_email reply_to_email created_timestamp email_campaign_id recipient_email_address email_send_timestamp email_send_id contact_id 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 18. model.hubspot.hubspot__email_event_sent:f1->21. model.hubspot.hubspot__email_sends:f1 18. model.hubspot.hubspot__email_event_sent:f2->21. model.hubspot.hubspot__email_sends:f2 18. model.hubspot.hubspot__email_event_sent:f3->21. model.hubspot.hubspot__email_sends:f3 18. model.hubspot.hubspot__email_event_sent:f4->21. model.hubspot.hubspot__email_sends:f4 18. model.hubspot.hubspot__email_event_sent:f5->21. model.hubspot.hubspot__email_sends:f5 18. model.hubspot.hubspot__email_event_sent:f6->21. model.hubspot.hubspot__email_sends:f6 18. model.hubspot.hubspot__email_event_sent:f7->21. model.hubspot.hubspot__email_sends:f7 18. model.hubspot.hubspot__email_event_sent:f8->21. model.hubspot.hubspot__email_sends:f8 18. model.hubspot.hubspot__email_event_sent:f9->21. model.hubspot.hubspot__email_sends:f9 18. model.hubspot.hubspot__email_event_sent:f10->21. model.hubspot.hubspot__email_sends:f10 18. model.hubspot.hubspot__email_event_sent:f11->21. model.hubspot.hubspot__email_sends:f11 18. model.hubspot.hubspot__email_event_sent:f12->21. model.hubspot.hubspot__email_sends:f12 18. model.hubspot.hubspot__email_event_sent:f13->21. model.hubspot.hubspot__email_sends:f13 30. model.hubspot.int_hubspot__email_aggregate_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change email_send_id 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f12 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f23 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f32 31. model.hubspot.int_hubspot__email_event_aggregates 31. model.hubspot.int_hubspot__email_event_aggregates email_send_id 31. model.hubspot.int_hubspot__email_event_aggregates:f0->21. model.hubspot.hubspot__email_sends:f12
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
is_contact_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
bcc_emails text The 'cc' field of the email message.
cc_emails text The 'bcc' field of the email message.
email_subject text The subject line of the email message.
event_id text The ID of the event.
from_email text The 'from' field of the email message.
reply_to_email text The 'reply-to' field of the email message.
created_timestamp timestamp without time zone The created timestamp of the event.
email_campaign_id integer The ID of the related email campaign.
recipient_email_address text The email address of the contact related to the event.
email_send_timestamp timestamp without time zone The timestamp of the SENT event related to this event.
email_send_id text The event ID which uniquely identifies the email message's SENT event. If not applicable, this property is omitted.
contact_id integer The ID of the related contact.
bounces bigint The total number of bounce email events.
clicks bigint The total number of click email events.
deferrals bigint The total number of deferral email events.
deliveries bigint The total number of delivery email events.
drops bigint The total number of drop email events.
forwards bigint The total number of forward email events.
opens bigint The total number of open email events.
prints bigint The total number of print email events.
spam_reports bigint The total number of spam report email events.
unsubscribes bigint The total number of unsubscribe email events.
was_bounced boolean Whether the email was bounced.
was_clicked boolean Whether the email was clicked.
was_deferred boolean Whether the email was deferred.
was_delivered boolean Whether the email was delivered.
was_forwarded boolean Whether the email was forwarded.
was_opened boolean Whether the email was opened.
was_printed boolean Whether the email was printed.
was_spam_reported boolean Whether the email was spam reported.
was_unsubcribed boolean Whether the email was unsubcribed.
Column Lineage
%3 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent _fivetran_synced 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends _fivetran_synced 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent _fivetran_synced 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp _fivetran_synced 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp _fivetran_synced 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_synced 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_synced]
    • Direct The column is directly copied with a cast to TIMESTAMP.
    • Output Columns:
      • _fivetran_synced: Directly mapped with a TIMESTAMP cast
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Cast as TIMESTAMP
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP in both the macro and fields CTEs.
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent is_contact_deleted 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends is_contact_deleted 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact is_contact_deleted 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_deleted 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_deleted]
    • Cleaning This column is likely used to determine the 'is_contact_deleted' field, though not explicitly shown in the provided SQL.
    • Output Columns:
      • is_contact_deleted: Likely transformed to determine if the contact is deleted
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied to the output
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied to the output
    • Cleaning COALESCE is used to set a default value of FALSE if the column is NULL
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[is_contact_deleted]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied
Column Lineage
%3 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent bcc_emails 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends bcc_emails 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent bcc_emails 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp bcc 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[bcc]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to bcc_emails in the fields CTE.
    • Output Columns:
      • bcc_emails: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[bcc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • bcc_emails: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[bcc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • bcc_emails: Directly copied
Column Lineage
%3 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent cc_emails 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends cc_emails 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent cc_emails 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp cc 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[cc]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to cc_emails in the fields CTE.
    • Output Columns:
      • cc_emails: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[cc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • cc_emails: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[cc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • cc_emails: Directly copied
Column Lineage
%3 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent email_subject 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_subject 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent email_subject 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp subject 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[subject]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to email_subject in the fields CTE.
    • Output Columns:
      • email_subject: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[email_subject]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_subject: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[email_subject]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_subject: Directly copied
Column Lineage
%3 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent event_id 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends event_id 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent event_id 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp id 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped and renamed
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[id]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to event_id in the fields CTE.
    • Output Columns:
      • event_id: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join with the base table
    • Output Columns:
      • event_id: Indirectly mapped, as it's used for joining but also exists in the base table
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[event_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[event_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • event_id: Directly copied
Column Lineage
%3 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent from_email 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends from_email 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent from_email 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp from 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[from]
    • Cleaning The column is cast as TEXT and renamed to from_email in the macro CTE, then directly selected in the fields CTE.
    • Output Columns:
      • from_email: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[from_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • from_email: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[from_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • from_email: Directly copied
Column Lineage
%3 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent reply_to_email 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends reply_to_email 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent reply_to_email 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp reply_to 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[reply_to]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to reply_to_email in the fields CTE.
    • Output Columns:
      • reply_to_email: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[reply_to_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • reply_to_email: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[reply_to_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • reply_to_email: Directly copied
Column Lineage
%3 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent created_timestamp 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends created_timestamp 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[created]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • created_timestamp: Cast as TIMESTAMP and renamed
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied
Column Lineage
%3 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent email_campaign_id 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_campaign_id 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_id 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp email_campaign_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[email_campaign_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • email_campaign_id: Directly mapped
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used to join with the email_aggregate_status_change CTE
    • Output Columns:
      • email_campaign_id: Directly copied
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[email_campaign_id]
    • Integration This column is used as the key to join the email_sends table with the campaigns table
    • Aggregation This column is used in the GROUP BY clause of the email_metrics CTE
    • Output Columns:
      • email_campaign_id: It is indirectly mapped to the output email_campaign_id through the join operation
Column Lineage
%3 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent recipient_email_address 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends recipient_email_address 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:header 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp recipient 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[recipient]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • recipient_email_address: Directly mapped without changes
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • recipient_email_address: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[recipient_email_address]
    • Integration used as the key to join with contacts table
Column Lineage
%3 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent email_send_timestamp 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_timestamp 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_created 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_created]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • sent_timestamp: Directly mapped after casting to TIMESTAMP
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[email_send_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output
Column Lineage
%3 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent email_send_id 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_id unsubscribes was_unsubcribed 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change email_send_id 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 31. model.hubspot.int_hubspot__email_event_aggregates 31. model.hubspot.int_hubspot__email_event_aggregates email_send_id 31. model.hubspot.int_hubspot__email_event_aggregates:f0->21. model.hubspot.hubspot__email_sends:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 62. model.hubspot_source.stg_hubspot__email_event:f0->31. model.hubspot.int_hubspot__email_event_aggregates:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 20. model.hubspot.hubspot__email_event_status_change:f0->30. model.hubspot.int_hubspot__email_aggregate_status_change:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
30. model.hubspot.int_hubspot__email_aggregate_status_change
  • Input Column: 20. model.hubspot.hubspot__email_event_status_change[email_send_id]
    • Filtering The column is filtered to exclude null values (WHERE NOT email_send_id IS NULL)
    • Aggregation The column is used in the GROUP BY clause
    • Output Columns:
      • email_send_id: This column is directly copied to the output
31. model.hubspot.int_hubspot__email_event_aggregates
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Filtering This column is used to filter out null values
    • Integration It's used as the key to group events
    • Aggregation It's used as the grouping key for all aggregations
    • Output Columns:
      • email_send_id: This column is directly mapped to email_send_id in the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[email_send_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as the key to join with the metrics and unsubscribes CTEs
    • Output Columns:
      • email_send_id: Directly copied to the output
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
  • Input Column: 31. model.hubspot.int_hubspot__email_event_aggregates[email_send_id]
    • Integration This column is used as the key to join the aggregated metrics with the main email sent events.
    • Direct The column is directly copied to the output without transformation.
    • Output Columns:
      • email_send_id: It is directly copied to the output column with the same name.
Column Lineage
%3 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent contact_id 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends contact_id 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:header 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:header 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:f0 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_id 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp id 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[id]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_id: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with the contact_merge_audit CTE
    • Filtering Used in the WHERE clause to filter out merged contacts
    • Output Columns:
      • contact_id: Directly copied to the output
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied to the output without transformation
    • Integration Used as part of the LEFT JOIN operation
    • Output Columns:
      • contact_id: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[contact_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_id: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[contact_id]
    • Integration used as the key to join with contacts and engagements tables
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[contact_id]
    • Integration Used to join the email_sends table with the contact_list_member table
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends bounces 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_bounces total_unique_bounces 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_bounces total_unique_bounces 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_bounces total_unique_bounces 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_bounces total_unique_bounces 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_bounces]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_bounces: Directly copied
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_bounces]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_unique_bounces: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[bounces]
    • Aggregation aggregated to calculate total and unique bounces
    • Output Columns:
      • total_bounces: summed up
      • total_unique_bounces: counted uniquely
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[bounces]
    • Aggregation This column is aggregated to calculate the total bounces for each email campaign
    • Output Columns:
      • total_bounces: Summed up for each email campaign
      • total_unique_bounces: Counted distinctly for each email campaign
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[bounces]
    • Aggregation Likely aggregated to calculate total_bounces and total_unique_bounces
    • Output Columns:
      • total_bounces: Summed for each contact_list_id
      • total_unique_bounces: Counted distinct for each contact_list_id
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends clicks 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_clicks total_unique_clicks 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_clicks total_unique_clicks 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_clicks total_unique_clicks 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_clicks total_unique_clicks 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_clicks]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_clicks: Directly copied
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_clicks]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_unique_clicks: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[clicks]
    • Aggregation aggregated to calculate total and unique clicks
    • Output Columns:
      • total_clicks: summed up
      • total_unique_clicks: counted uniquely
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[clicks]
    • Aggregation This column is aggregated to calculate the total clicks for each email campaign
    • Output Columns:
      • total_clicks: Summed up for each email campaign
      • total_unique_clicks: Counted distinctly for each email campaign
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[clicks]
    • Aggregation Likely aggregated to calculate total_clicks and total_unique_clicks
    • Output Columns:
      • total_clicks: Summed for each contact_list_id
      • total_unique_clicks: Counted distinct for each contact_list_id
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends deferrals 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_deferrals total_unique_deferrals 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_deferrals total_unique_deferrals 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_deferrals total_unique_deferrals 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_deferrals total_unique_deferrals 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_deferrals]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_deferrals: Directly copied
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_deferrals]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_unique_deferrals: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[deferrals]
    • Aggregation aggregated to calculate total and unique deferrals
    • Output Columns:
      • total_deferrals: summed up
      • total_unique_deferrals: counted uniquely
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[deferrals]
    • Aggregation This column is aggregated to calculate the total deferrals for each email campaign
    • Output Columns:
      • total_deferrals: Summed up for each email campaign
      • total_unique_deferrals: Counted distinctly for each email campaign
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[deferrals]
    • Aggregation Likely aggregated to calculate total_deferrals and total_unique_deferrals
    • Output Columns:
      • total_deferrals: Summed for each contact_list_id
      • total_unique_deferrals: Counted distinct for each contact_list_id
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends deliveries 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_deliveries total_unique_deliveries 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_deliveries total_unique_deliveries 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_deliveries total_unique_deliveries 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_deliveries total_unique_deliveries 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_deliveries]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_deliveries: Directly copied
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_deliveries]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_unique_deliveries: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[deliveries]
    • Aggregation aggregated to calculate total and unique deliveries
    • Output Columns:
      • total_deliveries: summed up
      • total_unique_deliveries: counted uniquely
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[deliveries]
    • Aggregation This column is aggregated to calculate the total deliveries for each email campaign
    • Output Columns:
      • total_deliveries: Summed up for each email campaign
      • total_unique_deliveries: Counted distinctly for each email campaign
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[deliveries]
    • Aggregation Likely aggregated to calculate total_deliveries and total_unique_deliveries
    • Output Columns:
      • total_deliveries: Summed for each contact_list_id
      • total_unique_deliveries: Counted distinct for each contact_list_id
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends drops 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_drops total_unique_drops 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_drops total_unique_drops 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_drops total_unique_drops 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_drops total_unique_drops 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_drops]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_drops: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[drops]
    • Aggregation aggregated to calculate total and unique drops
    • Output Columns:
      • total_drops: summed up
      • total_unique_drops: counted uniquely
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[drops]
    • Aggregation This column is aggregated to calculate the total drops for each email campaign
    • Output Columns:
      • total_drops: Summed up for each email campaign
      • total_unique_drops: Counted distinctly for each email campaign
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[drops]
    • Aggregation Likely aggregated to calculate total_drops and total_unique_drops
    • Output Columns:
      • total_drops: Summed for each contact_list_id
      • total_unique_drops: Counted distinct for each contact_list_id
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends forwards 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_forwards total_unique_forwards 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_forwards total_unique_forwards 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_forwards total_unique_forwards 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_forwards total_unique_forwards 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_forwards]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_forwards: Directly copied
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_forwards]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unique_forwards: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[forwards]
    • Aggregation aggregated to calculate total and unique forwards
    • Output Columns:
      • total_forwards: summed up
      • total_unique_forwards: counted uniquely
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[forwards]
    • Aggregation This column is aggregated to calculate the total forwards for each email campaign
    • Output Columns:
      • total_forwards: Summed up for each email campaign
      • total_unique_forwards: Counted distinctly for each email campaign
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[forwards]
    • Aggregation Likely aggregated to calculate total_forwards and total_unique_forwards
    • Output Columns:
      • total_forwards: Summed for each contact_list_id
      • total_unique_forwards: Counted distinct for each contact_list_id
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends opens 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_opens total_unique_opens 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_opens total_unique_opens 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_opens total_unique_opens 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_opens total_unique_opens 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_opens]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_opens: Directly copied
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_opens]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unique_opens: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[opens]
    • Aggregation This column is aggregated to calculate the total number of open email events.
    • Output Columns:
      • total_opens: Summed up for each contact
      • total_unique_opens: Counted as unique occurrences for each contact
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[opens]
    • Aggregation This column is aggregated to calculate the total number of open email events.
    • Output Columns:
      • total_opens: Summed up to get the total number of open events.
      • total_unique_opens: Counted to get the number of unique email sends with open events.
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[opens]
    • Aggregation This column is aggregated to calculate total opens and unique opens
    • Output Columns:
      • total_opens: Sum of all opens
      • total_unique_opens: Count of distinct opens
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends prints 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_prints total_unique_prints 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_prints total_unique_prints 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_prints total_unique_prints 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_prints total_unique_prints 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_prints]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_prints: Directly copied
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_prints]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unique_prints: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[prints]
    • Aggregation This column is aggregated to calculate the total number of print email events.
    • Output Columns:
      • total_prints: Summed up for each contact
      • total_unique_prints: Counted as unique occurrences for each contact
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[prints]
    • Aggregation This column is aggregated to calculate the total number of print email events.
    • Output Columns:
      • total_prints: Summed up to get the total number of print events.
      • total_unique_prints: Counted to get the number of unique email sends with print events.
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[prints]
    • Aggregation This column is aggregated to calculate total prints and unique prints
    • Output Columns:
      • total_prints: Sum of all prints
      • total_unique_prints: Count of distinct prints
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends spam_reports 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_spam_reports total_unique_spam_reports 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_spam_reports total_unique_spam_reports 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_spam_reports total_unique_spam_reports 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_spam_reports total_unique_spam_reports 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_spam_reports]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_spam_reports: Directly copied
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_spam_reports]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unique_spam_reports: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[spam_reports]
    • Aggregation This column is aggregated to calculate the total number of spam report email events.
    • Output Columns:
      • total_spam_reports: Summed up for each contact
      • total_unique_spam_reports: Counted as unique occurrences for each contact
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[spam_reports]
    • Aggregation This column is aggregated to calculate the total number of spam report email events.
    • Output Columns:
      • total_spam_reports: Summed up to get the total number of spam report events.
      • total_unique_spam_reports: Counted to get the number of unique email sends with spam report events.
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[spam_reports]
    • Aggregation This column is aggregated to calculate total spam reports and unique spam reports
    • Output Columns:
      • total_spam_reports: Sum of all spam reports
      • total_unique_spam_reports: Count of distinct spam reports
Column Lineage
%3 30. model.hubspot.int_hubspot__email_aggregate_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change email_send_id 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_id unsubscribes was_unsubcribed 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_id 20. model.hubspot.hubspot__email_event_status_change:f0->30. model.hubspot.int_hubspot__email_aggregate_status_change:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
30. model.hubspot.int_hubspot__email_aggregate_status_change
  • Input Column: 20. model.hubspot.hubspot__email_event_status_change[email_send_id]
    • Filtering The column is filtered to exclude null values (WHERE NOT email_send_id IS NULL)
    • Aggregation The column is used in the GROUP BY clause
    • Output Columns:
      • email_send_id: This column is directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unsubscribes]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unsubscribes: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate the total number of unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Summed up for each contact
      • total_unique_unsubscribes: Counted as unique occurrences for each contact
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate the total number of unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Summed up to get the total number of unsubscribe events.
      • total_unique_unsubscribes: Counted to get the number of unique email sends with unsubscribe events.
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate total unsubscribes and unique unsubscribes
    • Output Columns:
      • total_unsubscribes: Sum of all unsubscribes
      • total_unique_unsubscribes: Count of distinct unsubscribes
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends was_bounced 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_bounces total_unique_bounces 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_bounces total_unique_bounces 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_bounces total_unique_bounces 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_bounces total_unique_bounces 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_bounces]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_bounces: Directly copied
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_bounces]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_unique_bounces: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_bounced]
    • Aggregation This column is aggregated to calculate the total number of bounced emails.
    • Output Columns:
      • total_bounces: Summed up for each contact
      • total_unique_bounces: Counted as unique occurrences for each contact
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_bounced]
    • Aggregation This column is aggregated to calculate the total number of bounced emails.
    • Output Columns:
      • total_bounces: Summed up to get the total number of bounce events.
      • total_unique_bounces: Counted to get the number of unique email sends with bounce events.
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_bounced]
    • Aggregation This column is aggregated to calculate total bounces and unique bounces
    • Output Columns:
      • total_bounces: Sum of all bounces
      • total_unique_bounces: Count of distinct bounces
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends was_clicked 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_clicks total_unique_clicks 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_clicks total_unique_clicks 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_clicks total_unique_clicks 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_clicks total_unique_clicks 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_clicks]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_clicks: Directly copied
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_clicks]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_unique_clicks: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_clicked]
    • Aggregation This column is aggregated to calculate the total number of clicked emails.
    • Output Columns:
      • total_clicks: Summed up for each contact
      • total_unique_clicks: Counted as unique occurrences for each contact
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_clicked]
    • Aggregation This column is aggregated to calculate the total number of clicked emails.
    • Output Columns:
      • total_clicks: Summed up to get the total number of click events.
      • total_unique_clicks: Counted to get the number of unique email sends with click events.
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_clicked]
    • Aggregation This column is aggregated to calculate total clicks and unique clicks
    • Output Columns:
      • total_clicks: Sum of all clicks
      • total_unique_clicks: Count of distinct clicks
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends was_deferred 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_deferrals total_unique_deferrals 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_deferrals total_unique_deferrals 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_deferrals total_unique_deferrals 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_deferrals total_unique_deferrals 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_deferrals]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_deferrals: Directly copied
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_deferrals]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_unique_deferrals: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_deferred]
    • Aggregation This column is aggregated to calculate the total number of deferred emails.
    • Output Columns:
      • total_deferrals: Summed up for each contact
      • total_unique_deferrals: Counted as unique occurrences for each contact
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_deferred]
    • Aggregation This column is aggregated to calculate the total number of deferred emails.
    • Output Columns:
      • total_deferrals: Summed up to get the total number of deferral events.
      • total_unique_deferrals: Counted to get the number of unique email sends with deferral events.
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_deferred]
    • Aggregation This column is aggregated to calculate total deferrals and unique deferrals
    • Output Columns:
      • total_deferrals: Sum of all deferrals
      • total_unique_deferrals: Count of distinct deferrals
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends was_delivered 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_deliveries total_unique_deliveries 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_deliveries total_unique_deliveries 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_deliveries total_unique_deliveries 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_deliveries total_unique_deliveries 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_deliveries]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_deliveries: Directly copied
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_deliveries]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_unique_deliveries: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_delivered]
    • Aggregation This column is aggregated to calculate the total number of delivered emails.
    • Output Columns:
      • total_deliveries: Summed up for each contact
      • total_unique_deliveries: Counted as unique occurrences for each contact
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_delivered]
    • Aggregation This column is aggregated to calculate the total number of delivered emails.
    • Output Columns:
      • total_deliveries: Summed up to get the total number of delivery events.
      • total_unique_deliveries: Counted to get the number of unique email sends with delivery events.
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_delivered]
    • Aggregation This column is aggregated to calculate total deliveries and unique deliveries
    • Output Columns:
      • total_deliveries: Sum of all deliveries
      • total_unique_deliveries: Count of distinct deliveries
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends was_forwarded 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_forwards total_unique_forwards 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_forwards total_unique_forwards 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_forwards total_unique_forwards 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_forwards total_unique_forwards 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_forwards]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_forwards: Directly copied
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_forwards]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unique_forwards: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_forwarded]
    • Aggregation This column is aggregated to calculate the total number of forwarded emails.
    • Output Columns:
      • total_forwards: Summed up for each contact
      • total_unique_forwards: Counted as unique occurrences for each contact
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_forwarded]
    • Aggregation This column is aggregated to calculate the total number of forwarded emails.
    • Output Columns:
      • total_forwards: Summed up to get the total number of forward events.
      • total_unique_forwards: Counted to get the number of unique email sends with forward events.
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_forwarded]
    • Aggregation This column is aggregated to calculate total forwards and unique forwards
    • Output Columns:
      • total_forwards: Sum of all forwards
      • total_unique_forwards: Count of distinct forwards
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends was_opened 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_opens total_unique_opens 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_opens total_unique_opens 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_opens total_unique_opens 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_opens]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_opens: Directly copied
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_opens]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unique_opens: Directly copied
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_opened]
    • Aggregation This column is aggregated to calculate the total number of opened emails.
    • Output Columns:
      • total_opens: Summed up to get the total number of open events.
      • total_unique_opens: Counted to get the number of unique email sends with open events.
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_opened]
    • Aggregation This column is aggregated to calculate total opens and unique opens
    • Output Columns:
      • total_opens: Sum of all opens
      • total_unique_opens: Count of distinct opens
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends was_printed 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_prints total_unique_prints 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_prints total_unique_prints 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_prints total_unique_prints 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_prints total_unique_prints 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_prints]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_prints: Directly copied
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_prints]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unique_prints: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_printed]
    • Aggregation This column is used to count the total number of print email events and unique print email events.
    • Output Columns:
      • total_prints: Aggregated count of all print events
      • total_unique_prints: Aggregated count of unique print events
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_printed]
    • Aggregation This column is likely used to calculate the total_prints and total_unique_prints metrics in the output.
    • Output Columns:
      • total_prints: Aggregated count of all prints
      • total_unique_prints: Aggregated count of unique prints
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_printed]
    • Aggregation This column is likely used to calculate the total_prints and total_unique_prints in the output
    • Output Columns:
      • total_prints: Aggregated count of all prints
      • total_unique_prints: Aggregated count of unique prints
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends was_spam_reported 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_spam_reports total_unique_spam_reports 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_spam_reports total_unique_spam_reports 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_spam_reports total_unique_spam_reports 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_spam_reports total_unique_spam_reports 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f0->4. model.hubspot.hubspot__contact_lists:f1 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_spam_reports]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_spam_reports: Directly copied
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_spam_reports]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unique_spam_reports: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_spam_reported]
    • Aggregation This column is used to count the total number of spam report email events and unique spam report email events.
    • Output Columns:
      • total_spam_reports: Aggregated count of all spam report events
      • total_unique_spam_reports: Aggregated count of unique spam report events
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_spam_reported]
    • Aggregation This column is likely used to calculate the total_spam_reports and total_unique_spam_reports metrics in the output.
    • Output Columns:
      • total_spam_reports: Aggregated count of all spam reports
      • total_unique_spam_reports: Aggregated count of unique spam reports
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_spam_reported]
    • Aggregation This column is likely used to calculate the total_spam_reports and total_unique_spam_reports in the output
    • Output Columns:
      • total_spam_reports: Aggregated count of all spam reports
      • total_unique_spam_reports: Aggregated count of unique spam reports
Column Lineage
%3 30. model.hubspot.int_hubspot__email_aggregate_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change email_send_id 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_id unsubscribes was_unsubcribed 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f2->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f2->5. model.hubspot.hubspot__contacts:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f2->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f2->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f2->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f2->9. model.hubspot.hubspot__email_campaigns:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f2->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f2->4. model.hubspot.hubspot__contact_lists:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_id 20. model.hubspot.hubspot__email_event_status_change:f0->30. model.hubspot.int_hubspot__email_aggregate_status_change:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
30. model.hubspot.int_hubspot__email_aggregate_status_change
  • Input Column: 20. model.hubspot.hubspot__email_event_status_change[email_send_id]
    • Filtering The column is filtered to exclude null values (WHERE NOT email_send_id IS NULL)
    • Aggregation The column is used in the GROUP BY clause
    • Output Columns:
      • email_send_id: This column is directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unsubscribes]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unsubscribes: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is used to count the total number of unsubscribe email events and unique unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribe events
      • total_unique_unsubscribes: Aggregated count of unique unsubscribe events
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is likely used to calculate the total_unsubscribes and total_unique_unsubscribes metrics in the output.
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribes
      • total_unique_unsubscribes: Aggregated count of unique unsubscribes
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is likely used to calculate the total_unsubscribes and total_unique_unsubscribes in the output
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribes
      • total_unique_unsubscribes: Aggregated count of unique unsubscribes
22. model.hubspot.hubspot__engagement_calls

This SQL query integrates data from two tables: 'stg_hubspot__engagement_call' and 'hubspot__engagements'. It joins these tables based on the engagement_id, and combines information from both sources. The query also performs some data cleaning by using COALESCE to handle potential null values and ensure data consistency. The final result includes all columns from both tables, with some specific fields being merged or coalesced for completeness.

IntegrationCleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_call
), engagements AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.hubspot__engagements
), joined AS (
  SELECT
    *, /* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
    engagements.contact_ids,
    engagements.deal_ids,
    engagements.company_ids,
    COALESCE(engagements.is_active, NOT base._fivetran_deleted) AS is_active,
    COALESCE(engagements.created_timestamp, base.created_timestamp) AS created_timestamp,
    COALESCE(engagements.occurred_timestamp, base.occurred_timestamp) AS occurred_timestamp,
    COALESCE(engagements.owner_id, base.owner_id) AS owner_id
  FROM base
  LEFT JOIN engagements
    ON base.engagement_id = engagements.engagement_id
)
SELECT
  *
FROM joined
%3 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls _fivetran_synced engagement_id is_active created_timestamp occurred_timestamp owner_id contact_ids deal_ids company_ids engagement_type team_id 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements _fivetran_synced created_timestamp engagement_id engagement_type is_active occurred_timestamp owner_id contact_ids deal_ids company_ids 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 27. model.hubspot.hubspot__engagements:f1->22. model.hubspot.hubspot__engagement_calls:f3 27. model.hubspot.hubspot__engagements:f2->22. model.hubspot.hubspot__engagement_calls:f1 27. model.hubspot.hubspot__engagements:f3->22. model.hubspot.hubspot__engagement_calls:f9 27. model.hubspot.hubspot__engagements:f4->22. model.hubspot.hubspot__engagement_calls:f2 27. model.hubspot.hubspot__engagements:f5->22. model.hubspot.hubspot__engagement_calls:f4 27. model.hubspot.hubspot__engagements:f6->22. model.hubspot.hubspot__engagement_calls:f5 27. model.hubspot.hubspot__engagements:f7->22. model.hubspot.hubspot__engagement_calls:f6 27. model.hubspot.hubspot__engagements:f8->22. model.hubspot.hubspot__engagement_calls:f7 27. model.hubspot.hubspot__engagements:f9->22. model.hubspot.hubspot__engagement_calls:f8 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call _fivetran_synced engagement_id _fivetran_deleted engagement_type created_timestamp occurred_timestamp owner_id team_id 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0 87. model.hubspot_source.stg_hubspot__engagement_call:f1->22. model.hubspot.hubspot__engagement_calls:f1 87. model.hubspot_source.stg_hubspot__engagement_call:f2->22. model.hubspot.hubspot__engagement_calls:f2 87. model.hubspot_source.stg_hubspot__engagement_call:f3->22. model.hubspot.hubspot__engagement_calls:f9 87. model.hubspot_source.stg_hubspot__engagement_call:f4->22. model.hubspot.hubspot__engagement_calls:f3 87. model.hubspot_source.stg_hubspot__engagement_call:f5->22. model.hubspot.hubspot__engagement_calls:f4 87. model.hubspot_source.stg_hubspot__engagement_call:f6->22. model.hubspot.hubspot__engagement_calls:f5 87. model.hubspot_source.stg_hubspot__engagement_call:f7->22. model.hubspot.hubspot__engagement_calls:f10
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
engagement_id bigint The ID of the engagement.
is_active boolean Whether the engagement is currently being shown in the UI.
created_timestamp timestamp without time zone A timestamp representing when the engagement was created.
occurred_timestamp timestamp without time zone A timestamp in representing the time that the engagement should appear in the timeline.
owner_id integer The ID of the engagement's owner.
contact_ids bigint[] List of contacts related to the engagement.
deal_ids bigint[] List of deals related to the engagement.
company_ids bigint[] List of companies related to the engagement.
engagement_type text None
team_id integer None
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements _fivetran_synced 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls _fivetran_synced 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call _fivetran_synced 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement _fivetran_synced 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp _fivetran_synced 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f0 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp _fivetran_synced 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[_fivetran_synced]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Directly mapped without renaming
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
87. model.hubspot_source.stg_hubspot__engagement_call
  • Input Column: 88. model.hubspot_source.stg_hubspot__engagement_call_tmp[_fivetran_synced]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • _fivetran_synced: Directly mapped to the output _fivetran_synced column
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[_fivetran_synced]
    • Direct This column is directly included in the final output without transformation.
    • Output Columns:
      • _fivetran_synced: Directly copied to the output.
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_id 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls engagement_id 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call engagement_id 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_id 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company engagement_id 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact engagement_id 91. model.hubspot_source.stg_hubspot__engagement_contact:f0->27. model.hubspot.hubspot__engagements:f0 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal engagement_id 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp engagement_id 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f0 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp id 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp engagement_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp engagement_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp engagement_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • engagement_id: Directly mapped and renamed
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • engagement_id: Directly copied to the output column
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[engagement_id]
    • Cleaning The column is cast to INT data type in the macro CTE
    • Output Columns:
      • engagement_id: It is directly mapped after casting
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • engagement_id: Directly mapped after casting to INT
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as the key to join with other tables (contacts_agg, deals_agg, companies_agg)
    • Output Columns:
      • engagement_id: Directly copied to the output
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[engagement_id]
    • Integration This column is used as the key to join with other tables
    • Aggregation This column is used as the grouping key for aggregating company_ids
    • Output Columns:
      • engagement_id: This column is indirectly mapped to the engagement_id in the final output through joins
  • Input Column: 91. model.hubspot_source.stg_hubspot__engagement_contact[engagement_id]
    • Integration This column is used as the key to join the aggregated contacts with the main engagements table
    • Aggregation It's used in the GROUP BY clause to create the aggregated array of contact_ids
    • Output Columns:
      • engagement_id: It's indirectly mapped to the engagement_id in the final output through the JOIN operation
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[engagement_id]
    • Integration This column is used as the key to join with other tables
    • Aggregation This column is used as the grouping key for aggregating deal_ids
    • Output Columns:
      • engagement_id: The engagement_id is directly copied to the output engagement_id column
87. model.hubspot_source.stg_hubspot__engagement_call
  • Input Column: 88. model.hubspot_source.stg_hubspot__engagement_call_tmp[engagement_id]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • engagement_id: Directly mapped to the output engagement_id column
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables.
    • Direct Included in the final output.
    • Output Columns:
      • engagement_id: Directly copied to the output.
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[engagement_id]
    • Integration This column is used as the key to join with the engagements table
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_id: Directly copied to the output
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements is_active 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls is_active 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call _fivetran_deleted 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement is_active 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp _fivetran_deleted 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[is_active]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_active: Directly copied to the output
87. model.hubspot_source.stg_hubspot__engagement_call
  • Input Column: 88. model.hubspot_source.stg_hubspot__engagement_call_tmp[_fivetran_deleted]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • _fivetran_deleted: Directly mapped to the output _fivetran_deleted column
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[is_active]
    • Cleaning Used in a COALESCE function with NOT base._fivetran_deleted to determine the final is_active status.
    • Output Columns:
      • is_active: Coalesced with NOT base._fivetran_deleted.
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[_fivetran_deleted]
    • Cleaning This column is used in a COALESCE function to determine the is_active status
    • Output Columns:
      • is_active: Used in COALESCE(engagements.is_active, NOT base._fivetran_deleted)
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements created_timestamp 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls created_timestamp 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call created_timestamp 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement created_timestamp 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp property_hs_createdate 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
87. model.hubspot_source.stg_hubspot__engagement_call
  • Input Column: 88. model.hubspot_source.stg_hubspot__engagement_call_tmp[property_hs_createdate]
    • Cleaning This column is likely cleaned and cast as a TIMESTAMP
    • Output Columns:
      • created_timestamp: Mapped to the output created_timestamp column after casting
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[created_timestamp]
    • Cleaning Used in a COALESCE function to handle potential null values.
    • Output Columns:
      • created_timestamp: Coalesced with base.created_timestamp.
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[created_timestamp]
    • Cleaning This column is used in a COALESCE function to determine the final created_timestamp
    • Output Columns:
      • created_timestamp: Used in COALESCE(engagements.created_timestamp, base.created_timestamp)
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements occurred_timestamp 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls occurred_timestamp 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call occurred_timestamp 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement occurred_timestamp 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp property_hs_timestamp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[occurred_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • occurred_timestamp: Directly copied to the output
87. model.hubspot_source.stg_hubspot__engagement_call
  • Input Column: 88. model.hubspot_source.stg_hubspot__engagement_call_tmp[property_hs_timestamp]
    • Cleaning This column is likely cleaned and cast as a TIMESTAMP
    • Output Columns:
      • occurred_timestamp: Mapped to the output occurred_timestamp column after casting
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[occurred_timestamp]
    • Cleaning Used in a COALESCE function to handle potential null values.
    • Output Columns:
      • occurred_timestamp: Coalesced with base.occurred_timestamp.
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[occurred_timestamp]
    • Cleaning This column is used in a COALESCE function to determine the final occurred_timestamp
    • Output Columns:
      • occurred_timestamp: Used in COALESCE(engagements.occurred_timestamp, base.occurred_timestamp)
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements owner_id 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls owner_id 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call owner_id 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement owner_id 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[owner_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • owner_id: Directly copied to the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[owner_id]
    • Cleaning Used in a COALESCE function to handle potential null values.
    • Output Columns:
      • owner_id: Coalesced with base.owner_id.
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[owner_id]
    • Cleaning This column is used in a COALESCE function to determine the final owner_id
    • Output Columns:
      • owner_id: Used in COALESCE(engagements.owner_id, base.owner_id)
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements contact_ids 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls contact_ids 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact contact_id 91. model.hubspot_source.stg_hubspot__engagement_contact:f0->27. model.hubspot.hubspot__engagements:f0 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp contact_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[contact_id]
    • Cleaning The column is cast to INT data type in the macro CTE
    • Output Columns:
      • contact_id: It is directly mapped after casting
27. model.hubspot.hubspot__engagements
  • Input Column: 91. model.hubspot_source.stg_hubspot__engagement_contact[contact_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Integration It's used in the GROUP BY clause to create the aggregated array
    • Output Columns:
      • contact_ids: The contact_id values are aggregated into the contact_ids array in the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation
    • Output Columns:
      • contact_ids: Directly copied from engagements.contact_ids to the output
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements deal_ids 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls deal_ids 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal deal_id 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp deal_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly mapped after casting to INT
27. model.hubspot.hubspot__engagements
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[deal_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • deal_ids: The deal_id is aggregated into the deal_ids array in the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation
    • Output Columns:
      • deal_ids: Directly copied from engagements.deal_ids to the output
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements company_ids 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls company_ids 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company company_id 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp company_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly copied to the output column
27. model.hubspot.hubspot__engagements
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[company_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • company_ids: The company_id is aggregated into the company_ids array in the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation
    • Output Columns:
      • company_ids: Directly copied from engagements.company_ids to the output
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_type 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls engagement_type 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call engagement_type 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp type 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f0 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
87. model.hubspot_source.stg_hubspot__engagement_call
  • Input Column: 88. model.hubspot_source.stg_hubspot__engagement_call_tmp[type]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • engagement_type: Mapped to the output engagement_type column
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Direct This column is directly included in the final output without transformation.
    • Output Columns:
      • engagement_type: Directly copied to the output.
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
Column Lineage
%3 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call team_id 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls team_id 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[team_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • team_id: Directly copied to the output
23. model.hubspot.hubspot__engagement_emails

This SQL query joins engagement email data from a staging table with general engagements data. It combines information from both sources, using COALESCE to handle potential NULL values and ensure data completeness. The query also adds additional fields from the engagements table such as contact_ids, deal_ids, and company_ids to the email engagement data.

IntegrationCleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_email
), engagements AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.hubspot__engagements
), joined AS (
  SELECT
    *, /* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
    engagements.contact_ids,
    engagements.deal_ids,
    engagements.company_ids,
    COALESCE(engagements.is_active, NOT base._fivetran_deleted) AS is_active,
    COALESCE(engagements.created_timestamp, base.created_timestamp) AS created_timestamp,
    COALESCE(engagements.occurred_timestamp, base.occurred_timestamp) AS occurred_timestamp,
    COALESCE(engagements.owner_id, base.owner_id) AS owner_id
  FROM base
  LEFT JOIN engagements
    ON base.engagement_id = engagements.engagement_id
)
SELECT
  *
FROM joined
%3 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails _fivetran_synced engagement_id is_active created_timestamp occurred_timestamp owner_id contact_ids deal_ids company_ids engagement_type team_id all_owner_ids all_team_ids email_subject email_text lastmodifieddate modified_by 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements _fivetran_synced created_timestamp engagement_id engagement_type is_active occurred_timestamp owner_id contact_ids deal_ids company_ids 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 27. model.hubspot.hubspot__engagements:f1->23. model.hubspot.hubspot__engagement_emails:f3 27. model.hubspot.hubspot__engagements:f3->23. model.hubspot.hubspot__engagement_emails:f9 27. model.hubspot.hubspot__engagements:f4->23. model.hubspot.hubspot__engagement_emails:f2 27. model.hubspot.hubspot__engagements:f5->23. model.hubspot.hubspot__engagement_emails:f4 27. model.hubspot.hubspot__engagements:f6->23. model.hubspot.hubspot__engagement_emails:f5 27. model.hubspot.hubspot__engagements:f7->23. model.hubspot.hubspot__engagement_emails:f6 27. model.hubspot.hubspot__engagements:f8->23. model.hubspot.hubspot__engagement_emails:f7 27. model.hubspot.hubspot__engagements:f9->23. model.hubspot.hubspot__engagement_emails:f8 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email _fivetran_synced _fivetran_deleted engagement_id engagement_type created_timestamp occurred_timestamp owner_id team_id all_owner_ids all_team_ids email_subject email_text lastmodifieddate modified_by 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0 95. model.hubspot_source.stg_hubspot__engagement_email:f1->23. model.hubspot.hubspot__engagement_emails:f2 95. model.hubspot_source.stg_hubspot__engagement_email:f2->23. model.hubspot.hubspot__engagement_emails:f1 95. model.hubspot_source.stg_hubspot__engagement_email:f3->23. model.hubspot.hubspot__engagement_emails:f9 95. model.hubspot_source.stg_hubspot__engagement_email:f4->23. model.hubspot.hubspot__engagement_emails:f3 95. model.hubspot_source.stg_hubspot__engagement_email:f5->23. model.hubspot.hubspot__engagement_emails:f4 95. model.hubspot_source.stg_hubspot__engagement_email:f6->23. model.hubspot.hubspot__engagement_emails:f5 95. model.hubspot_source.stg_hubspot__engagement_email:f7->23. model.hubspot.hubspot__engagement_emails:f10 95. model.hubspot_source.stg_hubspot__engagement_email:f8->23. model.hubspot.hubspot__engagement_emails:f11 95. model.hubspot_source.stg_hubspot__engagement_email:f9->23. model.hubspot.hubspot__engagement_emails:f12 95. model.hubspot_source.stg_hubspot__engagement_email:f10->23. model.hubspot.hubspot__engagement_emails:f13 95. model.hubspot_source.stg_hubspot__engagement_email:f11->23. model.hubspot.hubspot__engagement_emails:f14 95. model.hubspot_source.stg_hubspot__engagement_email:f12->23. model.hubspot.hubspot__engagement_emails:f15 95. model.hubspot_source.stg_hubspot__engagement_email:f13->23. model.hubspot.hubspot__engagement_emails:f16
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
engagement_id bigint The ID of the engagement.
is_active boolean Whether the engagement is currently being shown in the UI.
created_timestamp timestamp without time zone A timestamp representing when the engagement was created.
occurred_timestamp timestamp without time zone A timestamp in representing the time that the engagement should appear in the timeline.
owner_id integer The ID of the engagement's owner.
contact_ids bigint[] List of contacts related to the engagement.
deal_ids bigint[] List of deals related to the engagement.
company_ids bigint[] List of companies related to the engagement.
engagement_type text None
team_id integer None
all_owner_ids integer None
all_team_ids integer None
email_subject text None
email_text text None
lastmodifieddate text None
modified_by integer None
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements _fivetran_synced 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails _fivetran_synced 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email _fivetran_synced 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement _fivetran_synced 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 96. model.hubspot_source.stg_hubspot__engagement_email_tmp 96. model.hubspot_source.stg_hubspot__engagement_email_tmp _fivetran_synced 96. model.hubspot_source.stg_hubspot__engagement_email_tmp:f0->95. model.hubspot_source.stg_hubspot__engagement_email:f0 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp _fivetran_synced 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[_fivetran_synced]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Directly mapped without renaming
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
95. model.hubspot_source.stg_hubspot__engagement_email
  • Input Column: 96. model.hubspot_source.stg_hubspot__engagement_email_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly mapped
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email engagement_id 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails engagement_id 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0 96. model.hubspot_source.stg_hubspot__engagement_email_tmp 96. model.hubspot_source.stg_hubspot__engagement_email_tmp engagement_id 96. model.hubspot_source.stg_hubspot__engagement_email_tmp:f0->95. model.hubspot_source.stg_hubspot__engagement_email:f0
95. model.hubspot_source.stg_hubspot__engagement_email
  • Input Column: 96. model.hubspot_source.stg_hubspot__engagement_email_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • engagement_id: Directly mapped
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[engagement_id]
    • Integration This column is used as the key to join the base table with the engagements table
    • Output Columns:
      • engagement_id: Directly copied
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements is_active 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails is_active 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email _fivetran_deleted 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement is_active 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 96. model.hubspot_source.stg_hubspot__engagement_email_tmp 96. model.hubspot_source.stg_hubspot__engagement_email_tmp _fivetran_deleted 96. model.hubspot_source.stg_hubspot__engagement_email_tmp:f0->95. model.hubspot_source.stg_hubspot__engagement_email:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[is_active]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_active: Directly copied to the output
95. model.hubspot_source.stg_hubspot__engagement_email
  • Input Column: 96. model.hubspot_source.stg_hubspot__engagement_email_tmp[_fivetran_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_deleted: Directly mapped
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[is_active]
    • Integration This column is used in a COALESCE function to determine the final is_active status
    • Output Columns:
      • is_active: Used in COALESCE with NOT base._fivetran_deleted
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[_fivetran_deleted]
    • Cleaning This column is used in a COALESCE function to determine the 'is_active' status
    • Output Columns:
      • is_active: Used in COALESCE(engagements.is_active, NOT base._fivetran_deleted)
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements created_timestamp 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails created_timestamp 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email created_timestamp 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement created_timestamp 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[created_timestamp]
    • Integration This column is used in a COALESCE function to determine the final created_timestamp
    • Output Columns:
      • created_timestamp: Used in COALESCE with base.created_timestamp
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[created_timestamp]
    • Cleaning This column is used in a COALESCE function to determine the final created_timestamp
    • Output Columns:
      • created_timestamp: Used in COALESCE(engagements.created_timestamp, base.created_timestamp)
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements occurred_timestamp 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails occurred_timestamp 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email occurred_timestamp 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement occurred_timestamp 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[occurred_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • occurred_timestamp: Directly copied to the output
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[occurred_timestamp]
    • Integration This column is used in a COALESCE function to determine the final occurred_timestamp
    • Output Columns:
      • occurred_timestamp: Used in COALESCE with base.occurred_timestamp
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[occurred_timestamp]
    • Cleaning This column is used in a COALESCE function to determine the final occurred_timestamp
    • Output Columns:
      • occurred_timestamp: Used in COALESCE(engagements.occurred_timestamp, base.occurred_timestamp)
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements owner_id 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails owner_id 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email owner_id 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement owner_id 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[owner_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • owner_id: Directly copied to the output
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[owner_id]
    • Integration This column is used in a COALESCE function to determine the final owner_id
    • Output Columns:
      • owner_id: Used in COALESCE with base.owner_id
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[owner_id]
    • Cleaning This column is used in a COALESCE function to determine the final owner_id
    • Output Columns:
      • owner_id: Used in COALESCE(engagements.owner_id, base.owner_id)
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements contact_ids 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails contact_ids 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact contact_id 91. model.hubspot_source.stg_hubspot__engagement_contact:f0->27. model.hubspot.hubspot__engagements:f0 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp contact_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[contact_id]
    • Cleaning The column is cast to INT data type in the macro CTE
    • Output Columns:
      • contact_id: It is directly mapped after casting
27. model.hubspot.hubspot__engagements
  • Input Column: 91. model.hubspot_source.stg_hubspot__engagement_contact[contact_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Integration It's used in the GROUP BY clause to create the aggregated array
    • Output Columns:
      • contact_ids: The contact_id values are aggregated into the contact_ids array in the output
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_ids: Directly copied to the output
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements deal_ids 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails deal_ids 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal deal_id 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp deal_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly mapped after casting to INT
27. model.hubspot.hubspot__engagements
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[deal_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • deal_ids: The deal_id is aggregated into the deal_ids array in the output
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • deal_ids: Directly copied to the output
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements company_ids 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails company_ids 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company company_id 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp company_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly copied to the output column
27. model.hubspot.hubspot__engagements
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[company_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • company_ids: The company_id is aggregated into the company_ids array in the output
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_ids: Directly copied to the output
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_type 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails engagement_type 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email engagement_type 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email team_id 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails team_id 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[team_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • team_id: Directly copied
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email all_owner_ids 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails all_owner_ids 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[all_owner_ids]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • all_owner_ids: Directly copied
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email all_team_ids 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails all_team_ids 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[all_team_ids]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • all_team_ids: Directly copied
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email email_subject 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails email_subject 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[email_subject]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_subject: Directly copied to the output
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email email_text 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails email_text 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[email_text]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_text: Directly copied to the output
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email lastmodifieddate 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails lastmodifieddate 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[lastmodifieddate]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • lastmodifieddate: Directly copied to the output
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email modified_by 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails modified_by 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[modified_by]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • modified_by: Directly copied to the output
24. model.hubspot.hubspot__engagement_meetings

This SQL query joins engagement meeting data from a staging table with general engagement data, combining and coalescing information from both sources. It enriches the meeting data with additional fields such as contact IDs, deal IDs, and company IDs from the engagements table. The query also determines the active status of the engagement and ensures consistent timestamps and owner information.

IntegrationCleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_meeting
), engagements AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.hubspot__engagements
), joined AS (
  SELECT
    *, /* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
    engagements.contact_ids,
    engagements.deal_ids,
    engagements.company_ids,
    COALESCE(engagements.is_active, NOT base._fivetran_deleted) AS is_active,
    COALESCE(engagements.created_timestamp, base.created_timestamp) AS created_timestamp,
    COALESCE(engagements.occurred_timestamp, base.occurred_timestamp) AS occurred_timestamp,
    COALESCE(engagements.owner_id, base.owner_id) AS owner_id
  FROM base
  LEFT JOIN engagements
    ON base.engagement_id = engagements.engagement_id
)
SELECT
  *
FROM joined
%3 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings _fivetran_synced engagement_id is_active created_timestamp occurred_timestamp owner_id contact_ids deal_ids company_ids engagement_type team_id created_from_link_id end_time pre_meeting_prospect_reminders source source_id start_time web_conference_meeting_id meeting_outcome body external_url title 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements created_timestamp engagement_id is_active occurred_timestamp owner_id contact_ids deal_ids company_ids 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f3 27. model.hubspot.hubspot__engagements:f2->24. model.hubspot.hubspot__engagement_meetings:f2 27. model.hubspot.hubspot__engagements:f3->24. model.hubspot.hubspot__engagement_meetings:f4 27. model.hubspot.hubspot__engagements:f4->24. model.hubspot.hubspot__engagement_meetings:f5 27. model.hubspot.hubspot__engagements:f5->24. model.hubspot.hubspot__engagement_meetings:f6 27. model.hubspot.hubspot__engagements:f6->24. model.hubspot.hubspot__engagement_meetings:f7 27. model.hubspot.hubspot__engagements:f7->24. model.hubspot.hubspot__engagement_meetings:f8 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting _fivetran_synced _fivetran_deleted engagement_id engagement_type created_timestamp occurred_timestamp owner_id team_id created_from_link_id end_time pre_meeting_prospect_reminders source source_id start_time web_conference_meeting_id meeting_outcome body external_url title 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0 97. model.hubspot_source.stg_hubspot__engagement_meeting:f1->24. model.hubspot.hubspot__engagement_meetings:f2 97. model.hubspot_source.stg_hubspot__engagement_meeting:f2->24. model.hubspot.hubspot__engagement_meetings:f1 97. model.hubspot_source.stg_hubspot__engagement_meeting:f3->24. model.hubspot.hubspot__engagement_meetings:f9 97. model.hubspot_source.stg_hubspot__engagement_meeting:f4->24. model.hubspot.hubspot__engagement_meetings:f3 97. model.hubspot_source.stg_hubspot__engagement_meeting:f5->24. model.hubspot.hubspot__engagement_meetings:f4 97. model.hubspot_source.stg_hubspot__engagement_meeting:f6->24. model.hubspot.hubspot__engagement_meetings:f5 97. model.hubspot_source.stg_hubspot__engagement_meeting:f7->24. model.hubspot.hubspot__engagement_meetings:f10 97. model.hubspot_source.stg_hubspot__engagement_meeting:f8->24. model.hubspot.hubspot__engagement_meetings:f11 97. model.hubspot_source.stg_hubspot__engagement_meeting:f9->24. model.hubspot.hubspot__engagement_meetings:f12 97. model.hubspot_source.stg_hubspot__engagement_meeting:f10->24. model.hubspot.hubspot__engagement_meetings:f13 97. model.hubspot_source.stg_hubspot__engagement_meeting:f11->24. model.hubspot.hubspot__engagement_meetings:f14 97. model.hubspot_source.stg_hubspot__engagement_meeting:f12->24. model.hubspot.hubspot__engagement_meetings:f15 97. model.hubspot_source.stg_hubspot__engagement_meeting:f13->24. model.hubspot.hubspot__engagement_meetings:f16 97. model.hubspot_source.stg_hubspot__engagement_meeting:f14->24. model.hubspot.hubspot__engagement_meetings:f17 97. model.hubspot_source.stg_hubspot__engagement_meeting:f15->24. model.hubspot.hubspot__engagement_meetings:f18 97. model.hubspot_source.stg_hubspot__engagement_meeting:f16->24. model.hubspot.hubspot__engagement_meetings:f19 97. model.hubspot_source.stg_hubspot__engagement_meeting:f17->24. model.hubspot.hubspot__engagement_meetings:f20 97. model.hubspot_source.stg_hubspot__engagement_meeting:f18->24. model.hubspot.hubspot__engagement_meetings:f21
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
engagement_id bigint The ID of the engagement.
is_active boolean Whether the engagement is currently being shown in the UI.
created_timestamp timestamp without time zone A timestamp representing when the engagement was created.
occurred_timestamp timestamp without time zone A timestamp in representing the time that the engagement should appear in the timeline.
owner_id integer The ID of the engagement's owner.
contact_ids bigint[] List of contacts related to the engagement.
deal_ids bigint[] List of deals related to the engagement.
company_ids bigint[] List of companies related to the engagement.
engagement_type text None
team_id integer None
created_from_link_id integer None
end_time text None
pre_meeting_prospect_reminders text None
source text None
source_id text None
start_time text None
web_conference_meeting_id integer None
meeting_outcome integer None
body text None
external_url text None
title text None
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting _fivetran_synced 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings _fivetran_synced 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp _fivetran_synced 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f0->97. model.hubspot_source.stg_hubspot__engagement_meeting:f0
97. model.hubspot_source.stg_hubspot__engagement_meeting
  • Input Column: 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TIMESTAMP in the macro CTE
    • Output Columns:
      • _fivetran_synced: Directly mapped and cast as TIMESTAMP
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[_fivetran_synced]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting engagement_id 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings engagement_id 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp engagement_id 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f0->97. model.hubspot_source.stg_hubspot__engagement_meeting:f0
97. model.hubspot_source.stg_hubspot__engagement_meeting
  • Input Column: 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT in the macro CTE
    • Output Columns:
      • engagement_id: Directly mapped and cast as INT
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[engagement_id]
    • Integration This column is used as the key to join with the engagements table
    • Output Columns:
      • engagement_id: Directly copied
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements is_active 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings is_active 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting _fivetran_deleted 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement is_active 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[is_active]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_active: Directly copied to the output
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[is_active]
    • Cleaning Used in a COALESCE function with the negation of base._fivetran_deleted
    • Output Columns:
      • is_active: Coalesced with NOT base._fivetran_deleted
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[_fivetran_deleted]
    • Cleaning This column is used to determine the is_active status
    • Output Columns:
      • is_active: Used in COALESCE function to determine active status
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements created_timestamp 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings created_timestamp 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting created_timestamp 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement created_timestamp 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[created_timestamp]
    • Cleaning The column is used in a COALESCE function to ensure a value is present
    • Output Columns:
      • created_timestamp: Coalesced with base.created_timestamp
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[created_timestamp]
    • Cleaning This column is used in a COALESCE function to determine the final created_timestamp
    • Output Columns:
      • created_timestamp: Used in COALESCE function
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements occurred_timestamp 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings occurred_timestamp 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting occurred_timestamp 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement occurred_timestamp 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[occurred_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • occurred_timestamp: Directly copied to the output
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[occurred_timestamp]
    • Cleaning The column is used in a COALESCE function to ensure a value is present
    • Output Columns:
      • occurred_timestamp: Coalesced with base.occurred_timestamp
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[occurred_timestamp]
    • Cleaning This column is used in a COALESCE function to determine the final occurred_timestamp
    • Output Columns:
      • occurred_timestamp: Used in COALESCE function
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements owner_id 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings owner_id 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting owner_id 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement owner_id 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[owner_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • owner_id: Directly copied to the output
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[owner_id]
    • Cleaning The column is used in a COALESCE function to ensure a value is present
    • Output Columns:
      • owner_id: Coalesced with base.owner_id
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[owner_id]
    • Cleaning This column is used in a COALESCE function to determine the final owner_id
    • Output Columns:
      • owner_id: Used in COALESCE function
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements contact_ids 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings contact_ids 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact contact_id 91. model.hubspot_source.stg_hubspot__engagement_contact:f0->27. model.hubspot.hubspot__engagements:f0 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp contact_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[contact_id]
    • Cleaning The column is cast to INT data type in the macro CTE
    • Output Columns:
      • contact_id: It is directly mapped after casting
27. model.hubspot.hubspot__engagements
  • Input Column: 91. model.hubspot_source.stg_hubspot__engagement_contact[contact_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Integration It's used in the GROUP BY clause to create the aggregated array
    • Output Columns:
      • contact_ids: The contact_id values are aggregated into the contact_ids array in the output
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied from the engagements table to the output
    • Output Columns:
      • contact_ids: Directly copied from the engagements table
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements deal_ids 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings deal_ids 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal deal_id 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp deal_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly mapped after casting to INT
27. model.hubspot.hubspot__engagements
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[deal_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • deal_ids: The deal_id is aggregated into the deal_ids array in the output
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied from the engagements table to the output
    • Output Columns:
      • deal_ids: Directly copied from the engagements table
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements company_ids 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings company_ids 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company company_id 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp company_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly copied to the output column
27. model.hubspot.hubspot__engagements
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[company_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • company_ids: The company_id is aggregated into the company_ids array in the output
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied from the engagements table to the output
    • Output Columns:
      • company_ids: Directly copied from the engagements table
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting engagement_type 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings engagement_type 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[engagement_type]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • engagement_type: Directly copied
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting team_id 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings team_id 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[team_id]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • team_id: Directly copied
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting end_time 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings end_time 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[end_time]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • end_time: Directly copied
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting pre_meeting_prospect_reminders 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings pre_meeting_prospect_reminders 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[pre_meeting_prospect_reminders]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • pre_meeting_prospect_reminders: Directly copied to output
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting source 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings source 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[source]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • source: Directly copied to output
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting source_id 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings source_id 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[source_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • source_id: Directly copied to output
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting start_time 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings start_time 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[start_time]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • start_time: Directly copied to output
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting web_conference_meeting_id 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings web_conference_meeting_id 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[web_conference_meeting_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • web_conference_meeting_id: Directly copied to output
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting meeting_outcome 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings meeting_outcome 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[meeting_outcome]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • meeting_outcome: Directly copied to output
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting body 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings body 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp body 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f0->97. model.hubspot_source.stg_hubspot__engagement_meeting:f0
97. model.hubspot_source.stg_hubspot__engagement_meeting
  • Input Column: 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp[body]
    • Direct The column is directly selected from the base CTE without any transformation
    • Output Columns:
      • body: It is directly mapped to the 'body' output column
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[body]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • body: Directly copied to output
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting external_url 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings external_url 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp external_url 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f0->97. model.hubspot_source.stg_hubspot__engagement_meeting:f0
97. model.hubspot_source.stg_hubspot__engagement_meeting
  • Input Column: 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp[external_url]
    • Direct The column is directly selected from the base CTE without any transformation
    • Output Columns:
      • external_url: It is directly mapped to the 'external_url' output column
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[external_url]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • external_url: Directly copied to output
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting title 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings title 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp title 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f0->97. model.hubspot_source.stg_hubspot__engagement_meeting:f0
97. model.hubspot_source.stg_hubspot__engagement_meeting
  • Input Column: 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp[title]
    • Direct The column is directly selected from the base CTE without any transformation
    • Output Columns:
      • title: It is directly mapped to the 'title' output column
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[title]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • title: Directly copied to output
25. model.hubspot.hubspot__engagement_notes

This SQL query combines engagement note data from a staging table with engagement data from another table. It joins these tables on the engagement_id field and coalesces several fields to use values from the engagements table when available, falling back to the base table values when not. The query also adds fields for contact_ids, deal_ids, and company_ids from the engagements table, and calculates an is_active field based on data from both tables.

IntegrationCleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_note
), engagements AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.hubspot__engagements
), joined AS (
  SELECT
    *, /* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
    engagements.contact_ids,
    engagements.deal_ids,
    engagements.company_ids,
    COALESCE(engagements.is_active, NOT base._fivetran_deleted) AS is_active,
    COALESCE(engagements.created_timestamp, base.created_timestamp) AS created_timestamp,
    COALESCE(engagements.occurred_timestamp, base.occurred_timestamp) AS occurred_timestamp,
    COALESCE(engagements.owner_id, base.owner_id) AS owner_id
  FROM base
  LEFT JOIN engagements
    ON base.engagement_id = engagements.engagement_id
)
SELECT
  *
FROM joined
%3 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes _fivetran_synced engagement_id note is_active created_timestamp occurred_timestamp owner_id contact_ids deal_ids company_ids engagement_type team_id body_preview lastmodifieddate note_body 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements _fivetran_synced created_timestamp engagement_id engagement_type is_active occurred_timestamp owner_id contact_ids deal_ids company_ids 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 27. model.hubspot.hubspot__engagements:f1->25. model.hubspot.hubspot__engagement_notes:f4 27. model.hubspot.hubspot__engagements:f2->25. model.hubspot.hubspot__engagement_notes:f1 27. model.hubspot.hubspot__engagements:f3->25. model.hubspot.hubspot__engagement_notes:f10 27. model.hubspot.hubspot__engagements:f4->25. model.hubspot.hubspot__engagement_notes:f3 27. model.hubspot.hubspot__engagements:f5->25. model.hubspot.hubspot__engagement_notes:f5 27. model.hubspot.hubspot__engagements:f6->25. model.hubspot.hubspot__engagement_notes:f6 27. model.hubspot.hubspot__engagements:f7->25. model.hubspot.hubspot__engagement_notes:f7 27. model.hubspot.hubspot__engagements:f8->25. model.hubspot.hubspot__engagement_notes:f8 27. model.hubspot.hubspot__engagements:f9->25. model.hubspot.hubspot__engagement_notes:f9 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note _fivetran_synced _fivetran_deleted engagement_id engagement_type note created_timestamp occurred_timestamp owner_id team_id body_preview note_body 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0 99. model.hubspot_source.stg_hubspot__engagement_note:f1->25. model.hubspot.hubspot__engagement_notes:f3 99. model.hubspot_source.stg_hubspot__engagement_note:f2->25. model.hubspot.hubspot__engagement_notes:f1 99. model.hubspot_source.stg_hubspot__engagement_note:f3->25. model.hubspot.hubspot__engagement_notes:f10 99. model.hubspot_source.stg_hubspot__engagement_note:f4->25. model.hubspot.hubspot__engagement_notes:f2 99. model.hubspot_source.stg_hubspot__engagement_note:f5->25. model.hubspot.hubspot__engagement_notes:f4 99. model.hubspot_source.stg_hubspot__engagement_note:f6->25. model.hubspot.hubspot__engagement_notes:f5 99. model.hubspot_source.stg_hubspot__engagement_note:f7->25. model.hubspot.hubspot__engagement_notes:f6 99. model.hubspot_source.stg_hubspot__engagement_note:f8->25. model.hubspot.hubspot__engagement_notes:f11 99. model.hubspot_source.stg_hubspot__engagement_note:f9->25. model.hubspot.hubspot__engagement_notes:f12 99. model.hubspot_source.stg_hubspot__engagement_note:f10->25. model.hubspot.hubspot__engagement_notes:f2
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
engagement_id bigint The ID of the engagement.
note text The body of the note. The body has a limit of 65536 characters.
is_active boolean Whether the engagement is currently being shown in the UI.
created_timestamp timestamp without time zone A timestamp representing when the engagement was created.
occurred_timestamp timestamp without time zone A timestamp in representing the time that the engagement should appear in the timeline.
owner_id integer The ID of the engagement's owner.
contact_ids bigint[] List of contacts related to the engagement.
deal_ids bigint[] List of deals related to the engagement.
company_ids bigint[] List of companies related to the engagement.
engagement_type text None
team_id integer None
body_preview text None
lastmodifieddate text None
note_body text None
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements _fivetran_synced 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes _fivetran_synced 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note _fivetran_synced 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement _fivetran_synced 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp _fivetran_synced 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp _fivetran_synced 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[_fivetran_synced]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Directly mapped without renaming
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly mapped
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[_fivetran_synced]
    • Direct This column is directly copied from the input to the output
    • Output Columns:
      • _fivetran_synced: Directly copied
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_id 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes engagement_id 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note engagement_id 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_id 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company engagement_id 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact engagement_id 91. model.hubspot_source.stg_hubspot__engagement_contact:f0->27. model.hubspot.hubspot__engagements:f0 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal engagement_id 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp engagement_id 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp id 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp engagement_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp engagement_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp engagement_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • engagement_id: Directly mapped and renamed
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • engagement_id: Directly copied to the output column
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[engagement_id]
    • Cleaning The column is cast to INT data type in the macro CTE
    • Output Columns:
      • engagement_id: It is directly mapped after casting
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • engagement_id: Directly mapped after casting to INT
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as the key to join with other tables (contacts_agg, deals_agg, companies_agg)
    • Output Columns:
      • engagement_id: Directly copied to the output
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[engagement_id]
    • Integration This column is used as the key to join with other tables
    • Aggregation This column is used as the grouping key for aggregating company_ids
    • Output Columns:
      • engagement_id: This column is indirectly mapped to the engagement_id in the final output through joins
  • Input Column: 91. model.hubspot_source.stg_hubspot__engagement_contact[engagement_id]
    • Integration This column is used as the key to join the aggregated contacts with the main engagements table
    • Aggregation It's used in the GROUP BY clause to create the aggregated array of contact_ids
    • Output Columns:
      • engagement_id: It's indirectly mapped to the engagement_id in the final output through the JOIN operation
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[engagement_id]
    • Integration This column is used as the key to join with other tables
    • Aggregation This column is used as the grouping key for aggregating deal_ids
    • Output Columns:
      • engagement_id: The engagement_id is directly copied to the output engagement_id column
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • engagement_id: Directly mapped
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied after join
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[engagement_id]
    • Integration Used as the key to join the base table with the engagements table
    • Output Columns:
      • engagement_id: Directly copied
Column Lineage
%3 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note note note_body 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes note 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0 99. model.hubspot_source.stg_hubspot__engagement_note:f1->25. model.hubspot.hubspot__engagement_notes:f0 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp property_hs_note_body 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[property_hs_note_body]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • note: Directly mapped
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[note]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • note: Directly copied
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[note_body]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • note: The note_body is directly mapped to the 'note' column in the output
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements is_active 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes is_active 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note _fivetran_deleted 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement is_active 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp _fivetran_deleted 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[is_active]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_active: Directly copied to the output
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[_fivetran_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_deleted: Directly mapped
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[is_active]
    • Cleaning This column is used in a COALESCE function with a derived value from the base table
    • Output Columns:
      • is_active: Coalesced with NOT base._fivetran_deleted
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[_fivetran_deleted]
    • Other Used in COALESCE function to determine is_active status
    • Output Columns:
      • is_active: Used in COALESCE(engagements.is_active, NOT base._fivetran_deleted)
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements created_timestamp 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes created_timestamp 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note created_timestamp 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement created_timestamp 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp property_hs_createdate 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[property_hs_createdate]
    • Cleaning The column is likely cleaned by casting to TIMESTAMP
    • Output Columns:
      • created_timestamp: Mapped after casting to TIMESTAMP
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[created_timestamp]
    • Cleaning This column is used in a COALESCE function to prioritize its value over the base table's value
    • Output Columns:
      • created_timestamp: Coalesced with base.created_timestamp
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[created_timestamp]
    • Other Used in COALESCE function to determine final created_timestamp
    • Output Columns:
      • created_timestamp: COALESCE(engagements.created_timestamp, base.created_timestamp)
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements occurred_timestamp 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes occurred_timestamp 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note occurred_timestamp 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement occurred_timestamp 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp property_hs_timestamp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[occurred_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • occurred_timestamp: Directly copied to the output
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[property_hs_timestamp]
    • Cleaning The column is likely cleaned by casting to TIMESTAMP
    • Output Columns:
      • occurred_timestamp: Mapped after casting to TIMESTAMP
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[occurred_timestamp]
    • Cleaning This column is used in a COALESCE function to prioritize its value over the base table's value
    • Output Columns:
      • occurred_timestamp: Coalesced with base.occurred_timestamp
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[occurred_timestamp]
    • Other Used in COALESCE function to determine final occurred_timestamp
    • Output Columns:
      • occurred_timestamp: COALESCE(engagements.occurred_timestamp, base.occurred_timestamp)
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements owner_id 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes owner_id 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note owner_id 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement owner_id 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp property_hubspot_owner_id 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[owner_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • owner_id: Directly copied to the output
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[property_hubspot_owner_id]
    • Cleaning The column is likely cleaned by casting to INT
    • Output Columns:
      • owner_id: Mapped after casting to INT
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[owner_id]
    • Cleaning This column is used in a COALESCE function to prioritize its value over the base table's value
    • Output Columns:
      • owner_id: Coalesced with base.owner_id
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[owner_id]
    • Other Used in COALESCE function to determine final owner_id
    • Output Columns:
      • owner_id: COALESCE(engagements.owner_id, base.owner_id)
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements contact_ids 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes contact_ids 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact contact_id 91. model.hubspot_source.stg_hubspot__engagement_contact:f0->27. model.hubspot.hubspot__engagements:f0 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp contact_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[contact_id]
    • Cleaning The column is cast to INT data type in the macro CTE
    • Output Columns:
      • contact_id: It is directly mapped after casting
27. model.hubspot.hubspot__engagements
  • Input Column: 91. model.hubspot_source.stg_hubspot__engagement_contact[contact_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Integration It's used in the GROUP BY clause to create the aggregated array
    • Output Columns:
      • contact_ids: The contact_id values are aggregated into the contact_ids array in the output
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the LEFT JOIN operation to combine data from the base and engagements tables
    • Output Columns:
      • contact_ids: Directly copied to the output
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements deal_ids 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes deal_ids 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal deal_id 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp deal_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly mapped after casting to INT
27. model.hubspot.hubspot__engagements
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[deal_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • deal_ids: The deal_id is aggregated into the deal_ids array in the output
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the LEFT JOIN operation to combine data from the base and engagements tables
    • Output Columns:
      • deal_ids: Directly copied to the output
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements company_ids 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes company_ids 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company company_id 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp company_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly copied to the output column
27. model.hubspot.hubspot__engagements
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[company_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • company_ids: The company_id is aggregated into the company_ids array in the output
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the LEFT JOIN operation to combine data from the base and engagements tables
    • Output Columns:
      • company_ids: Directly copied to the output
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_type 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes engagement_type 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note engagement_type 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Direct This column is directly copied from the input to the output
    • Output Columns:
      • engagement_type: Directly copied
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied
Column Lineage
%3 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note team_id 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes team_id 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp property_hubspot_team_id 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[property_hubspot_team_id]
    • Cleaning The column is likely cleaned by casting to INT
    • Output Columns:
      • team_id: Mapped after casting to INT
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[team_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • team_id: Directly copied
Column Lineage
%3 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note body_preview 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes body_preview 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[body_preview]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • body_preview: Directly copied
26. model.hubspot.hubspot__engagement_tasks

This SQL query combines data from two tables: 'stg_hubspot__engagement_task' and 'hubspot__engagements'. It joins these tables based on the engagement_id, and selects all columns from both tables. The query also applies some data cleaning by using COALESCE to handle potential null values and to determine the is_active status. It integrates additional information such as contact_ids, deal_ids, and company_ids from the engagements table into the result set.

IntegrationCleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_task
), engagements AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.hubspot__engagements
), joined AS (
  SELECT
    *, /* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
    engagements.contact_ids,
    engagements.deal_ids,
    engagements.company_ids,
    COALESCE(engagements.is_active, NOT base._fivetran_deleted) AS is_active,
    COALESCE(engagements.created_timestamp, base.created_timestamp) AS created_timestamp,
    COALESCE(engagements.occurred_timestamp, base.occurred_timestamp) AS occurred_timestamp,
    COALESCE(engagements.owner_id, base.owner_id) AS owner_id
  FROM base
  LEFT JOIN engagements
    ON base.engagement_id = engagements.engagement_id
)
SELECT
  *
FROM joined
%3 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks _fivetran_synced engagement_id is_active created_timestamp occurred_timestamp owner_id contact_ids deal_ids company_ids engagement_type team_id task_type object_id engagement_source 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements _fivetran_synced created_timestamp engagement_id engagement_type is_active occurred_timestamp owner_id contact_ids deal_ids company_ids 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 27. model.hubspot.hubspot__engagements:f1->26. model.hubspot.hubspot__engagement_tasks:f3 27. model.hubspot.hubspot__engagements:f2->26. model.hubspot.hubspot__engagement_tasks:f1 27. model.hubspot.hubspot__engagements:f3->26. model.hubspot.hubspot__engagement_tasks:f9 27. model.hubspot.hubspot__engagements:f4->26. model.hubspot.hubspot__engagement_tasks:f2 27. model.hubspot.hubspot__engagements:f5->26. model.hubspot.hubspot__engagement_tasks:f4 27. model.hubspot.hubspot__engagements:f6->26. model.hubspot.hubspot__engagement_tasks:f5 27. model.hubspot.hubspot__engagements:f7->26. model.hubspot.hubspot__engagement_tasks:f6 27. model.hubspot.hubspot__engagements:f8->26. model.hubspot.hubspot__engagement_tasks:f7 27. model.hubspot.hubspot__engagements:f9->26. model.hubspot.hubspot__engagement_tasks:f8 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task _fivetran_synced _fivetran_deleted engagement_id engagement_type created_timestamp occurred_timestamp owner_id team_id task_type object_id engagement_source 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0 101. model.hubspot_source.stg_hubspot__engagement_task:f1->26. model.hubspot.hubspot__engagement_tasks:f2 101. model.hubspot_source.stg_hubspot__engagement_task:f2->26. model.hubspot.hubspot__engagement_tasks:f1 101. model.hubspot_source.stg_hubspot__engagement_task:f3->26. model.hubspot.hubspot__engagement_tasks:f9 101. model.hubspot_source.stg_hubspot__engagement_task:f4->26. model.hubspot.hubspot__engagement_tasks:f3 101. model.hubspot_source.stg_hubspot__engagement_task:f5->26. model.hubspot.hubspot__engagement_tasks:f4 101. model.hubspot_source.stg_hubspot__engagement_task:f6->26. model.hubspot.hubspot__engagement_tasks:f5 101. model.hubspot_source.stg_hubspot__engagement_task:f7->26. model.hubspot.hubspot__engagement_tasks:f10 101. model.hubspot_source.stg_hubspot__engagement_task:f8->26. model.hubspot.hubspot__engagement_tasks:f11 101. model.hubspot_source.stg_hubspot__engagement_task:f9->26. model.hubspot.hubspot__engagement_tasks:f12 101. model.hubspot_source.stg_hubspot__engagement_task:f10->26. model.hubspot.hubspot__engagement_tasks:f13
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
engagement_id bigint The ID of the engagement.
is_active boolean Whether the engagement is currently being shown in the UI.
created_timestamp timestamp without time zone A timestamp representing when the engagement was created.
occurred_timestamp timestamp without time zone A timestamp in representing the time that the engagement should appear in the timeline.
owner_id integer The ID of the engagement's owner.
contact_ids bigint[] List of contacts related to the engagement.
deal_ids bigint[] List of deals related to the engagement.
company_ids bigint[] List of companies related to the engagement.
engagement_type text None
team_id integer None
task_type text None
object_id bigint None
engagement_source text None
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements _fivetran_synced 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks _fivetran_synced 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task _fivetran_synced 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement _fivetran_synced 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp _fivetran_synced 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp _fivetran_synced 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[_fivetran_synced]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Directly mapped without renaming
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[_fivetran_synced]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting to TIMESTAMP
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[_fivetran_synced]
    • Direct This column is directly selected in the final output without transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_id 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_id 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task engagement_id 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_id 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company engagement_id 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact engagement_id 91. model.hubspot_source.stg_hubspot__engagement_contact:f0->27. model.hubspot.hubspot__engagements:f0 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal engagement_id 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp engagement_id 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp id 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp engagement_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp engagement_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp engagement_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • engagement_id: Directly mapped and renamed
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • engagement_id: Directly copied to the output column
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[engagement_id]
    • Cleaning The column is cast to INT data type in the macro CTE
    • Output Columns:
      • engagement_id: It is directly mapped after casting
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • engagement_id: Directly mapped after casting to INT
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as the key to join with other tables (contacts_agg, deals_agg, companies_agg)
    • Output Columns:
      • engagement_id: Directly copied to the output
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[engagement_id]
    • Integration This column is used as the key to join with other tables
    • Aggregation This column is used as the grouping key for aggregating company_ids
    • Output Columns:
      • engagement_id: This column is indirectly mapped to the engagement_id in the final output through joins
  • Input Column: 91. model.hubspot_source.stg_hubspot__engagement_contact[engagement_id]
    • Integration This column is used as the key to join the aggregated contacts with the main engagements table
    • Aggregation It's used in the GROUP BY clause to create the aggregated array of contact_ids
    • Output Columns:
      • engagement_id: It's indirectly mapped to the engagement_id in the final output through the JOIN operation
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[engagement_id]
    • Integration This column is used as the key to join with other tables
    • Aggregation This column is used as the grouping key for aggregating deal_ids
    • Output Columns:
      • engagement_id: The engagement_id is directly copied to the output engagement_id column
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[engagement_id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • engagement_id: Directly mapped after casting to INT
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied to the output
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[engagement_id]
    • Direct This column is directly copied
    • Integration Used as the key to join with the engagements table
    • Output Columns:
      • engagement_id: Directly copied
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements is_active 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks is_active 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task _fivetran_deleted 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement is_active 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp _fivetran_deleted 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[is_active]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_active: Directly copied to the output
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[_fivetran_deleted]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to BOOLEAN data type
    • Output Columns:
      • _fivetran_deleted: Directly mapped after casting to BOOLEAN
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[is_active]
    • Cleaning Used in a COALESCE function with NOT base._fivetran_deleted to determine the final is_active status
    • Output Columns:
      • is_active: Mapped after COALESCE with NOT base._fivetran_deleted
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[_fivetran_deleted]
    • Cleaning This column is used to determine the is_active status
    • Output Columns:
      • is_active: Used in COALESCE function to determine is_active status
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements created_timestamp 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks created_timestamp 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task created_timestamp 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement created_timestamp 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp property_hs_createdate 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[property_hs_createdate]
    • Cleaning The column is likely cast to TIMESTAMP data type
    • Output Columns:
      • created_timestamp: Mapped after casting to TIMESTAMP
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[created_timestamp]
    • Cleaning Used in a COALESCE function to handle potential null values
    • Output Columns:
      • created_timestamp: Mapped after COALESCE with base.created_timestamp
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[created_timestamp]
    • Cleaning Used in COALESCE function to determine the final created_timestamp
    • Output Columns:
      • created_timestamp: Used in COALESCE with engagements.created_timestamp
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements occurred_timestamp 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks occurred_timestamp 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task occurred_timestamp 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement occurred_timestamp 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp property_hs_timestamp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[occurred_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • occurred_timestamp: Directly copied to the output
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[property_hs_timestamp]
    • Cleaning The column is likely cast to TIMESTAMP data type
    • Output Columns:
      • occurred_timestamp: Mapped after casting to TIMESTAMP
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[occurred_timestamp]
    • Cleaning Used in a COALESCE function to handle potential null values
    • Output Columns:
      • occurred_timestamp: Mapped after COALESCE with base.occurred_timestamp
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[occurred_timestamp]
    • Cleaning Used in COALESCE function to determine the final occurred_timestamp
    • Output Columns:
      • occurred_timestamp: Used in COALESCE with engagements.occurred_timestamp
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements owner_id 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks owner_id 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task owner_id 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement owner_id 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp property_hubspot_owner_id 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[owner_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • owner_id: Directly copied to the output
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[property_hubspot_owner_id]
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • owner_id: Mapped after casting to INT
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[owner_id]
    • Cleaning Used in a COALESCE function to handle potential null values
    • Output Columns:
      • owner_id: Mapped after COALESCE with base.owner_id
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[owner_id]
    • Cleaning Used in COALESCE function to determine the final owner_id
    • Output Columns:
      • owner_id: Used in COALESCE with engagements.owner_id
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements contact_ids 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks contact_ids 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact contact_id 91. model.hubspot_source.stg_hubspot__engagement_contact:f0->27. model.hubspot.hubspot__engagements:f0 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp contact_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[contact_id]
    • Cleaning The column is cast to INT data type in the macro CTE
    • Output Columns:
      • contact_id: It is directly mapped after casting
27. model.hubspot.hubspot__engagements
  • Input Column: 91. model.hubspot_source.stg_hubspot__engagement_contact[contact_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Integration It's used in the GROUP BY clause to create the aggregated array
    • Output Columns:
      • contact_ids: The contact_id values are aggregated into the contact_ids array in the output
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation.
    • Output Columns:
      • contact_ids: Directly copied from the engagements table.
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements deal_ids 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks deal_ids 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal deal_id 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp deal_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly mapped after casting to INT
27. model.hubspot.hubspot__engagements
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[deal_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • deal_ids: The deal_id is aggregated into the deal_ids array in the output
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation.
    • Output Columns:
      • deal_ids: Directly copied from the engagements table.
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements company_ids 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks company_ids 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company company_id 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp company_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly copied to the output column
27. model.hubspot.hubspot__engagements
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[company_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • company_ids: The company_id is aggregated into the company_ids array in the output
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation.
    • Output Columns:
      • company_ids: Directly copied from the engagements table.
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_type 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_type 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task engagement_type 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp type 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[type]
    • Cleaning The column is cast to TEXT data type
    • Output Columns:
      • engagement_type: Mapped after casting to TEXT
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Direct This column is directly selected in the final output without transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[engagement_type]
    • Direct This column is directly copied
    • Output Columns:
      • engagement_type: Directly copied
Column Lineage
%3 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task team_id 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks team_id 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp property_hubspot_team_id 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[property_hubspot_team_id]
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • team_id: Mapped after casting to INT
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[team_id]
    • Direct This column is directly copied
    • Output Columns:
      • team_id: Directly copied
Column Lineage
%3 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task task_type 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks task_type 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp task_type 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[task_type]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • task_type: Directly copied to the output 'task_type' column
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[task_type]
    • Direct This column is directly copied
    • Output Columns:
      • task_type: Directly copied
Column Lineage
%3 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task object_id 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks object_id 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[object_id]
    • Direct This column is directly copied
    • Output Columns:
      • object_id: Directly copied
Column Lineage
%3 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task engagement_source 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_source 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp property_hs_engagement_source 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[property_hs_engagement_source]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is likely renamed for standardization
    • Output Columns:
      • engagement_source: Directly copied and renamed to 'engagement_source' in the output
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[engagement_source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • engagement_source: It is directly mapped to the output column of the same name
27. model.hubspot.hubspot__engagements

This SQL query integrates data from multiple Hubspot engagement-related tables. It aggregates contact IDs, deal IDs, and company IDs associated with each engagement, and then joins this aggregated information with the main engagements table. The result is a comprehensive view of each engagement, including its associated contacts, deals, and companies.

IntegrationAggregation
SQL Query
WITH engagements AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement
), contacts AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_contact
), contacts_agg AS (
  SELECT
    engagement_id,
    ARRAY_AGG(contact_id) AS contact_ids
  FROM contacts
  GROUP BY
    1
), deals AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_deal
), deals_agg AS (
  SELECT
    engagement_id,
    ARRAY_AGG(deal_id) AS deal_ids
  FROM deals
  GROUP BY
    1
), companies AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_company
), companies_agg AS (
  SELECT
    engagement_id,
    ARRAY_AGG(company_id) AS company_ids
  FROM companies
  GROUP BY
    1
), joined AS (
  SELECT
    contacts_agg.contact_ids,
    deals_agg.deal_ids,
    companies_agg.company_ids,
    engagements.*
  FROM engagements
  LEFT JOIN contacts_agg
    USING (engagement_id)
  LEFT JOIN deals_agg
    USING (engagement_id)
  LEFT JOIN companies_agg
    USING (engagement_id)
)
SELECT
  *
FROM joined
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements _fivetran_synced activity_type created_timestamp engagement_id engagement_type is_active last_updated_timestamp occurred_timestamp owner_id portal_id contact_ids deal_ids company_ids 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement _fivetran_synced engagement_id engagement_type is_active occurred_timestamp created_timestamp owner_id portal_id 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 86. model.hubspot_source.stg_hubspot__engagement:f1->27. model.hubspot.hubspot__engagements:f3 86. model.hubspot_source.stg_hubspot__engagement:f2->27. model.hubspot.hubspot__engagements:f4 86. model.hubspot_source.stg_hubspot__engagement:f3->27. model.hubspot.hubspot__engagements:f5 86. model.hubspot_source.stg_hubspot__engagement:f4->27. model.hubspot.hubspot__engagements:f7 86. model.hubspot_source.stg_hubspot__engagement:f5->27. model.hubspot.hubspot__engagements:f2 86. model.hubspot_source.stg_hubspot__engagement:f6->27. model.hubspot.hubspot__engagements:f8 86. model.hubspot_source.stg_hubspot__engagement:f7->27. model.hubspot.hubspot__engagements:f9 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company company_id engagement_id 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f12 89. model.hubspot_source.stg_hubspot__engagement_company:f1->27. model.hubspot.hubspot__engagements:f3 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact contact_id engagement_id 91. model.hubspot_source.stg_hubspot__engagement_contact:f0->27. model.hubspot.hubspot__engagements:f10 91. model.hubspot_source.stg_hubspot__engagement_contact:f1->27. model.hubspot.hubspot__engagements:f3 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal deal_id engagement_id 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f11 93. model.hubspot_source.stg_hubspot__engagement_deal:f1->27. model.hubspot.hubspot__engagements:f3
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
activity_type None The engagement's activity type.
created_timestamp timestamp without time zone A timestamp representing when the engagement was created.
engagement_id bigint The ID of the engagement.
engagement_type text One of NOTE, EMAIL, TASK, MEETING, or CALL, the type of the engagement.
is_active boolean Whether the engagement is currently being shown in the UI.
last_updated_timestamp None A timestamp in representing when the engagement was last updated.
occurred_timestamp timestamp without time zone A timestamp in representing the time that the engagement should appear in the timeline.
owner_id integer The ID of the engagement's owner.
portal_id integer The hub ID.
contact_ids bigint[] List of contacts related to the engagement.
deal_ids bigint[] List of deals related to the engagement.
company_ids bigint[] List of companies related to the engagement.
Column Lineage
%3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement _fivetran_synced 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements _fivetran_synced 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails _fivetran_synced 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks _fivetran_synced 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls _fivetran_synced 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes _fivetran_synced 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp _fivetran_synced 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[_fivetran_synced]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Directly mapped without renaming
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[_fivetran_synced]
    • Direct This column is directly included in the final output without transformation.
    • Output Columns:
      • _fivetran_synced: Directly copied to the output.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[_fivetran_synced]
    • Direct This column is directly copied from the input to the output
    • Output Columns:
      • _fivetran_synced: Directly copied
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[_fivetran_synced]
    • Direct This column is directly selected in the final output without transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement created_timestamp 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements created_timestamp 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails created_timestamp 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks created_timestamp 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings created_timestamp 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls created_timestamp 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes created_timestamp 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[created_timestamp]
    • Cleaning Used in a COALESCE function to handle potential null values.
    • Output Columns:
      • created_timestamp: Coalesced with base.created_timestamp.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[created_timestamp]
    • Integration This column is used in a COALESCE function to determine the final created_timestamp
    • Output Columns:
      • created_timestamp: Used in COALESCE with base.created_timestamp
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[created_timestamp]
    • Cleaning The column is used in a COALESCE function to ensure a value is present
    • Output Columns:
      • created_timestamp: Coalesced with base.created_timestamp
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[created_timestamp]
    • Cleaning This column is used in a COALESCE function to prioritize its value over the base table's value
    • Output Columns:
      • created_timestamp: Coalesced with base.created_timestamp
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[created_timestamp]
    • Cleaning Used in a COALESCE function to handle potential null values
    • Output Columns:
      • created_timestamp: Mapped after COALESCE with base.created_timestamp
Column Lineage
%3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_id 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_id 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:header 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:header 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:header 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_id 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:header 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls engagement_id 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes engagement_id 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company engagement_id 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact engagement_id 91. model.hubspot_source.stg_hubspot__engagement_contact:f0->27. model.hubspot.hubspot__engagements:f0 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal engagement_id 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp id 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp engagement_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp engagement_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp engagement_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • engagement_id: Directly mapped and renamed
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • engagement_id: Directly copied to the output column
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[engagement_id]
    • Cleaning The column is cast to INT data type in the macro CTE
    • Output Columns:
      • engagement_id: It is directly mapped after casting
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • engagement_id: Directly mapped after casting to INT
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as the key to join with other tables (contacts_agg, deals_agg, companies_agg)
    • Output Columns:
      • engagement_id: Directly copied to the output
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[engagement_id]
    • Integration This column is used as the key to join with other tables
    • Aggregation This column is used as the grouping key for aggregating company_ids
    • Output Columns:
      • engagement_id: This column is indirectly mapped to the engagement_id in the final output through joins
  • Input Column: 91. model.hubspot_source.stg_hubspot__engagement_contact[engagement_id]
    • Integration This column is used as the key to join the aggregated contacts with the main engagements table
    • Aggregation It's used in the GROUP BY clause to create the aggregated array of contact_ids
    • Output Columns:
      • engagement_id: It's indirectly mapped to the engagement_id in the final output through the JOIN operation
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[engagement_id]
    • Integration This column is used as the key to join with other tables
    • Aggregation This column is used as the grouping key for aggregating deal_ids
    • Output Columns:
      • engagement_id: The engagement_id is directly copied to the output engagement_id column
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used to join the engagements table with the engagement_companies table
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used to join engagements with engagement_deals table
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables.
    • Direct Included in the final output.
    • Output Columns:
      • engagement_id: Directly copied to the output.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the engagements table with the base table
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join with the base table
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied after join
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied to the output
Column Lineage
%3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f0 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f3 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f2 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f2 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails engagement_type 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_type 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls engagement_type 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes engagement_type 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Featurization Used to create separate counts for each engagement type
    • Output Columns:
      • count_engagement_notes: Counted when engagement_type = 'NOTE'
      • count_engagement_tasks: Counted when engagement_type = 'TASK'
      • count_engagement_calls: Counted when engagement_type = 'CALL'
      • count_engagement_meetings: Counted when engagement_type = 'MEETING'
      • count_engagement_emails: Counted when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Counted when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Counted when engagement_type = 'FORWARDED_EMAIL'
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Output Columns:
      • count_engagement_notes: Aggregated into this output column
      • count_engagement_tasks: Aggregated into this output column
      • count_engagement_calls: Aggregated into this output column
      • count_engagement_meetings: Aggregated into this output column
      • count_engagement_emails: Aggregated into this output column
      • count_engagement_incoming_emails: Aggregated into this output column
      • count_engagement_forwarded_emails: Aggregated into this output column
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Direct This column is directly included in the final output without transformation.
    • Output Columns:
      • engagement_type: Directly copied to the output.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Direct This column is directly copied from the input to the output
    • Output Columns:
      • engagement_type: Directly copied
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Direct This column is directly selected in the final output without transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
Column Lineage
%3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement is_active 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements is_active 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails is_active 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks is_active 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings is_active 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls is_active 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes is_active 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[is_active]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_active: Directly copied to the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[is_active]
    • Cleaning Used in a COALESCE function with NOT base._fivetran_deleted to determine the final is_active status.
    • Output Columns:
      • is_active: Coalesced with NOT base._fivetran_deleted.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[is_active]
    • Integration This column is used in a COALESCE function to determine the final is_active status
    • Output Columns:
      • is_active: Used in COALESCE with NOT base._fivetran_deleted
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[is_active]
    • Cleaning Used in a COALESCE function with the negation of base._fivetran_deleted
    • Output Columns:
      • is_active: Coalesced with NOT base._fivetran_deleted
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[is_active]
    • Cleaning This column is used in a COALESCE function with a derived value from the base table
    • Output Columns:
      • is_active: Coalesced with NOT base._fivetran_deleted
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[is_active]
    • Cleaning Used in a COALESCE function with NOT base._fivetran_deleted to determine the final is_active status
    • Output Columns:
      • is_active: Mapped after COALESCE with NOT base._fivetran_deleted
Column Lineage
%3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement occurred_timestamp 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements occurred_timestamp 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails occurred_timestamp 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks occurred_timestamp 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings occurred_timestamp 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls occurred_timestamp 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes occurred_timestamp 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[occurred_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • occurred_timestamp: Directly copied to the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[occurred_timestamp]
    • Cleaning Used in a COALESCE function to handle potential null values.
    • Output Columns:
      • occurred_timestamp: Coalesced with base.occurred_timestamp.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[occurred_timestamp]
    • Integration This column is used in a COALESCE function to determine the final occurred_timestamp
    • Output Columns:
      • occurred_timestamp: Used in COALESCE with base.occurred_timestamp
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[occurred_timestamp]
    • Cleaning The column is used in a COALESCE function to ensure a value is present
    • Output Columns:
      • occurred_timestamp: Coalesced with base.occurred_timestamp
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[occurred_timestamp]
    • Cleaning This column is used in a COALESCE function to prioritize its value over the base table's value
    • Output Columns:
      • occurred_timestamp: Coalesced with base.occurred_timestamp
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[occurred_timestamp]
    • Cleaning Used in a COALESCE function to handle potential null values
    • Output Columns:
      • occurred_timestamp: Mapped after COALESCE with base.occurred_timestamp
Column Lineage
%3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement owner_id 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements owner_id 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails owner_id 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks owner_id 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings owner_id 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls owner_id 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes owner_id 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[owner_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • owner_id: Directly copied to the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[owner_id]
    • Cleaning Used in a COALESCE function to handle potential null values.
    • Output Columns:
      • owner_id: Coalesced with base.owner_id.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[owner_id]
    • Integration This column is used in a COALESCE function to determine the final owner_id
    • Output Columns:
      • owner_id: Used in COALESCE with base.owner_id
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[owner_id]
    • Cleaning The column is used in a COALESCE function to ensure a value is present
    • Output Columns:
      • owner_id: Coalesced with base.owner_id
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[owner_id]
    • Cleaning This column is used in a COALESCE function to prioritize its value over the base table's value
    • Output Columns:
      • owner_id: Coalesced with base.owner_id
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[owner_id]
    • Cleaning Used in a COALESCE function to handle potential null values
    • Output Columns:
      • owner_id: Mapped after COALESCE with base.owner_id
Column Lineage
%3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement portal_id 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements portal_id 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp portal_id 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[portal_id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • portal_id: Directly mapped without renaming
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[portal_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • portal_id: Directly copied to the output
Column Lineage
%3 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact contact_id 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements contact_ids 91. model.hubspot_source.stg_hubspot__engagement_contact:f0->27. model.hubspot.hubspot__engagements:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails contact_ids 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 33. model.hubspot.int_hubspot__engagement_metrics__by_contact 33. model.hubspot.int_hubspot__engagement_metrics__by_contact contact_id 27. model.hubspot.hubspot__engagements:f0->33. model.hubspot.int_hubspot__engagement_metrics__by_contact:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks contact_ids 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings contact_ids 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls contact_ids 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes contact_ids 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp contact_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts contact_id 33. model.hubspot.int_hubspot__engagement_metrics__by_contact:f0->5. model.hubspot.hubspot__contacts:f0
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[contact_id]
    • Cleaning The column is cast to INT data type in the macro CTE
    • Output Columns:
      • contact_id: It is directly mapped after casting
27. model.hubspot.hubspot__engagements
  • Input Column: 91. model.hubspot_source.stg_hubspot__engagement_contact[contact_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Integration It's used in the GROUP BY clause to create the aggregated array
    • Output Columns:
      • contact_ids: The contact_id values are aggregated into the contact_ids array in the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation
    • Output Columns:
      • contact_ids: Directly copied from engagements.contact_ids to the output
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_ids: Directly copied to the output
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied from the engagements table to the output
    • Output Columns:
      • contact_ids: Directly copied from the engagements table
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the LEFT JOIN operation to combine data from the base and engagements tables
    • Output Columns:
      • contact_ids: Directly copied to the output
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation.
    • Output Columns:
      • contact_ids: Directly copied from the engagements table.
33. model.hubspot.int_hubspot__engagement_metrics__by_contact
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Integration This column is indirectly used through the join with the engagement_contacts table, which likely contains the individual contact IDs derived from this list.
    • Aggregation The contact IDs are used in the GROUP BY clause to aggregate engagement counts per contact.
    • Output Columns:
      • contact_id: The individual contact IDs from this list are mapped to the output 'contact_id' column.
5. model.hubspot.hubspot__contacts
  • Input Column: 33. model.hubspot.int_hubspot__engagement_metrics__by_contact[contact_id]
    • Integration This column is used as the key to join the engagement metrics with the main contact data in the LEFT JOIN operation.
    • Direct The column is directly copied to the output without transformation.
    • Output Columns:
      • contact_id: Directly copied to the output column with the same name.
Column Lineage
%3 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal deal_id 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements deal_ids 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f2 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails deal_ids 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks deal_ids 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings deal_ids 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls deal_ids 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes deal_ids 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp deal_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly mapped after casting to INT
27. model.hubspot.hubspot__engagements
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[deal_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • deal_ids: The deal_id is aggregated into the deal_ids array in the output
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Integration This column is used to join the engagements table with the engagement_deals table
    • Aggregation It's indirectly used for aggregation after joining with engagement_deals
    • Output Columns:
      • count_engagement_notes: Aggregated count of engagements where type is 'NOTE'
      • count_engagement_tasks: Aggregated count of engagements where type is 'TASK'
      • count_engagement_calls: Aggregated count of engagements where type is 'CALL'
      • count_engagement_meetings: Aggregated count of engagements where type is 'MEETING'
      • count_engagement_emails: Aggregated count of engagements where type is 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count of engagements where type is 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count of engagements where type is 'FORWARDED_EMAIL'
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation
    • Output Columns:
      • deal_ids: Directly copied from engagements.deal_ids to the output
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • deal_ids: Directly copied to the output
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied from the engagements table to the output
    • Output Columns:
      • deal_ids: Directly copied from the engagements table
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the LEFT JOIN operation to combine data from the base and engagements tables
    • Output Columns:
      • deal_ids: Directly copied to the output
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation.
    • Output Columns:
      • deal_ids: Directly copied from the engagements table.
Column Lineage
%3 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company company_id 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements company_ids 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies company_id count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f0 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f2 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f3 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails company_ids 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks company_ids 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings company_ids 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls company_ids 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes company_ids 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp company_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly copied to the output column
27. model.hubspot.hubspot__engagements
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[company_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • company_ids: The company_id is aggregated into the company_ids array in the output
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Integration This column is indirectly used through the join between engagements and engagement_companies tables using the engagement_id.
    • Aggregation The company_id (derived from this list) is used to group engagements by company.
    • Output Columns:
      • company_id: The company_id is used to link engagements to companies and is ultimately mapped to the company_id in the final output.
      • count_engagement_notes: Aggregated count based on this column and engagement_type.
      • count_engagement_tasks: Aggregated count based on this column and engagement_type.
      • count_engagement_calls: Aggregated count based on this column and engagement_type.
      • count_engagement_meetings: Aggregated count based on this column and engagement_type.
      • count_engagement_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_incoming_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_forwarded_emails: Aggregated count based on this column and engagement_type.
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation
    • Output Columns:
      • company_ids: Directly copied from engagements.company_ids to the output
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_ids: Directly copied to the output
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied from the engagements table to the output
    • Output Columns:
      • company_ids: Directly copied from the engagements table
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the LEFT JOIN operation to combine data from the base and engagements tables
    • Output Columns:
      • company_ids: Directly copied to the output
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation.
    • Output Columns:
      • company_ids: Directly copied from the engagements table.
28. model.hubspot.int_hubspot__contact_merge_adjust

This query adjusts contact data by removing merged contacts. It first extracts merged contact IDs from a string field, then removes any contacts that appear in this merged list. The result is a dataset of unique, non-merged contacts.

FilteringCleaningDeduplication
SQL Query
WITH contacts AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__contact
), contact_merge_audit AS (
  SELECT
    contacts.contact_id,
    SPLIT_PART(merges.value, ':', 0) AS vid_to_merge
  FROM contacts
  CROSS JOIN TABLE(FLATTEN(STRTOK_TO_ARRAY(calculated_merged_vids, ';'))) AS merges
), contact_merge_removal AS (
  SELECT
    contacts.*
  FROM contacts
  LEFT JOIN contact_merge_audit
    ON CAST(contacts.contact_id AS TEXT) = CAST(contact_merge_audit.vid_to_merge AS TEXT)
  WHERE
    contact_merge_audit.vid_to_merge IS NULL
)
SELECT
  *
FROM contact_merge_removal
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id is_contact_deleted calculated_merged_vids email contact_company first_name last_name created_date job_title company_annual_revenue _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact is_contact_deleted _fivetran_synced contact_id email contact_company first_name last_name created_date job_title company_annual_revenue calculated_merged_vids 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f1 38. model.hubspot_source.stg_hubspot__contact:f1->28. model.hubspot.int_hubspot__contact_merge_adjust:f10 38. model.hubspot_source.stg_hubspot__contact:f2->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 38. model.hubspot_source.stg_hubspot__contact:f3->28. model.hubspot.int_hubspot__contact_merge_adjust:f3 38. model.hubspot_source.stg_hubspot__contact:f4->28. model.hubspot.int_hubspot__contact_merge_adjust:f4 38. model.hubspot_source.stg_hubspot__contact:f5->28. model.hubspot.int_hubspot__contact_merge_adjust:f5 38. model.hubspot_source.stg_hubspot__contact:f6->28. model.hubspot.int_hubspot__contact_merge_adjust:f6 38. model.hubspot_source.stg_hubspot__contact:f7->28. model.hubspot.int_hubspot__contact_merge_adjust:f7 38. model.hubspot_source.stg_hubspot__contact:f8->28. model.hubspot.int_hubspot__contact_merge_adjust:f8 38. model.hubspot_source.stg_hubspot__contact:f9->28. model.hubspot.int_hubspot__contact_merge_adjust:f9
Name Type Comment
contact_id integer None
is_contact_deleted boolean None
calculated_merged_vids text None
email text None
contact_company text None
first_name text None
last_name text None
created_date timestamp without time zone None
job_title integer None
company_annual_revenue integer None
_fivetran_synced timestamp without time zone None
Column Lineage
%3 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp id 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends contact_id 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:header 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:header
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[id]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_id: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with the contact_merge_audit CTE
    • Filtering Used in the WHERE clause to filter out merged contacts
    • Output Columns:
      • contact_id: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[contact_id]
    • Integration used as the key to join with contacts and engagements tables
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as the key to join with the events data
    • Output Columns:
      • contact_id: Directly copied to the output
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the contacts table
    • Output Columns:
      • contact_id: Directly copied to the output
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the final SELECT statement
    • Output Columns:
      • contact_id: Directly copied to the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the LEFT JOIN operation
    • Output Columns:
      • contact_id: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the LEFT JOIN operation
    • Output Columns:
      • contact_id: Directly copied to the output
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the final SELECT statement
    • Output Columns:
      • contact_id: Directly copied to the output
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the email events data
    • Output Columns:
      • contact_id: Directly copied to the output
17. model.hubspot.hubspot__email_event_print
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the email events data
    • Output Columns:
      • contact_id: Directly copied to the output
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied to the output without transformation
    • Integration Used as part of the LEFT JOIN operation
    • Output Columns:
      • contact_id: Directly copied to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the events data
    • Output Columns:
      • contact_id: Directly copied to the output
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the LEFT JOIN operation
    • Output Columns:
      • contact_id: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[contact_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_id: Directly copied to the output
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[contact_id]
    • Integration Used to join the email_sends table with the contact_list_member table
Column Lineage
%3 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust is_contact_deleted 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_deleted 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends is_contact_deleted 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_deleted]
    • Cleaning This column is likely used to determine the 'is_contact_deleted' field, though not explicitly shown in the provided SQL.
    • Output Columns:
      • is_contact_deleted: Likely transformed to determine if the contact is deleted
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, with a COALESCE function applied
    • Cleaning The column is cleaned by applying a COALESCE function to handle NULL values
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Cleaning The column is cleaned by coalescing with FALSE if it's null
    • Output Columns:
      • is_contact_deleted: Cleaned and mapped to the output
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, with a COALESCE function applied
    • Integration The column is used in the final SELECT statement
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE(is_contact_deleted, FALSE)
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function applied
    • Cleaning The COALESCE function is used to handle potentially null values
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function applied
    • Cleaning The column is cleaned by applying a default value of FALSE if it's NULL
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Cleaning The column is cleaned by using COALESCE to handle NULL values
    • Integration The column is used in the final SELECT statement
    • Output Columns:
      • is_contact_deleted: Cleaned and mapped to the output
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function to default to FALSE if null
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
17. model.hubspot.hubspot__email_event_print
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function applied
    • Cleaning The COALESCE function is used to replace NULL values with FALSE
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied to the output
    • Cleaning COALESCE is used to set a default value of FALSE if the column is NULL
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, with a COALESCE function to default to FALSE if null
    • Output Columns:
      • is_contact_deleted: Mapped with COALESCE(is_contact_deleted, FALSE)
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function applied
    • Cleaning The COALESCE function is used to set a default value of FALSE if the column is NULL
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[is_contact_deleted]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied
Column Lineage
%3 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust calculated_merged_vids 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts calculated_merged_vids 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[calculated_merged_vids]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • calculated_merged_vids: Directly copied
Column Lineage
%3 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact email 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust email 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts email 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->20. model.hubspot.hubspot__email_event_status_change:header 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->13. model.hubspot.hubspot__email_event_delivered:header 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->15. model.hubspot.hubspot__email_event_forward:header 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:header 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->12. model.hubspot.hubspot__email_event_deferred:header 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->14. model.hubspot.hubspot__email_event_dropped:header 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->16. model.hubspot.hubspot__email_event_opens:header 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->11. model.hubspot.hubspot__email_event_clicks:header 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->10. model.hubspot.hubspot__email_event_bounce:header 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->17. model.hubspot.hubspot__email_event_print:header 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->19. model.hubspot.hubspot__email_event_spam_report:header 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_email 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_email]
    • Direct The column is directly copied.
    • Output Columns:
      • email: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[email]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Direct The column is directly copied without any transformation
    • Integration Used to join with email metrics
    • Output Columns:
      • email: Directly copied
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with the events data
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with the recipient_email_address from the events table
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with recipient_email_address
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with recipient_email_address
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with recipient_email_address from the events table
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with events_joined.recipient_email_address
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as a key to join with the email events data
17. model.hubspot.hubspot__email_event_print
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with the recipient_email_address from the email events data
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration Used as the key to join with the recipient_email_address from the events table
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as a key to join with the events data
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with recipient_email_address from the events table
Column Lineage
%3 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_company 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_company 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts contact_company 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_company 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_company]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_company: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_company]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_company: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_company]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_company: Directly copied
Column Lineage
%3 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact first_name 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust first_name 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts first_name 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_firstname 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_firstname]
    • Direct The column is directly copied.
    • Output Columns:
      • first_name: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[first_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • first_name: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[first_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • first_name: Directly copied
Column Lineage
%3 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact last_name 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust last_name 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts last_name 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_lastname 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_lastname]
    • Direct The column is directly copied.
    • Output Columns:
      • last_name: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[last_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • last_name: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[last_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • last_name: Directly copied
Column Lineage
%3 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact created_date 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust created_date 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts created_date 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_created_at property_createdate 45. model.hubspot_source.stg_hubspot__contact_tmp:f1->38. model.hubspot_source.stg_hubspot__contact:f0 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_createdate]
    • Cleaning The column is cast to TIMESTAMP.
    • Output Columns:
      • created_date: Mapped with a TIMESTAMP cast
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_created_at]
    • Cleaning The column is cast to TIMESTAMP type
    • Output Columns:
      • created_date: This column is mapped to created_date after casting to TIMESTAMP
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[created_date]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • created_date: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[created_date]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • created_date: Directly copied
Column Lineage
%3 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact job_title 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust job_title 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts job_title 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_jobtitle 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_jobtitle]
    • Direct The column is directly copied.
    • Output Columns:
      • job_title: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[job_title]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • job_title: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[job_title]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • job_title: Directly copied
Column Lineage
%3 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact company_annual_revenue 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust company_annual_revenue 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts company_annual_revenue 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_annualrevenue 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_annualrevenue]
    • Cleaning The column is cast to INT type
    • Output Columns:
      • company_annual_revenue: This column is directly mapped to company_annual_revenue after casting
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[company_annual_revenue]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_annual_revenue: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[company_annual_revenue]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_annual_revenue: Directly copied
Column Lineage
%3 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_synced 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends _fivetran_synced 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_synced]
    • Direct The column is directly copied with a cast to TIMESTAMP.
    • Output Columns:
      • _fivetran_synced: Directly mapped with a TIMESTAMP cast
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output column with the same name
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: The column is directly copied to the output '_fivetran_synced' column
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: It is directly mapped to the output column of the same name
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join operation between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output '_fivetran_synced' column
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct This column is directly copied from the input table to the output without any transformation.
    • Integration The column is implicitly used in the LEFT JOIN operation between the events_joined CTE and the contacts table.
    • Output Columns:
      • _fivetran_synced: This column is directly mapped to the '_fivetran_synced' column in the output.
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct This column is directly copied from the input table to the output without any transformation.
    • Integration This column is implicitly used in the LEFT JOIN operation between the events_joined CTE and the contacts table.
    • Output Columns:
      • _fivetran_synced: This column is directly mapped to the output '_fivetran_synced' column.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join operation between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output '_fivetran_synced' column
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output '_fivetran_synced' column
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the LEFT JOIN between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output '_fivetran_synced' column
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
29. model.hubspot.int_hubspot__deals_enhanced

This SQL query integrates data from multiple tables related to HubSpot deals. It joins the main deals table with related tables for pipelines, pipeline stages, and owners. The query enriches the deal data with additional information such as pipeline and stage details, owner information, and various status flags. The result is a comprehensive view of deals with enhanced contextual data.

IntegrationCleaning
SQL Query
WITH deals AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal
), pipelines AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal_pipeline
), pipeline_stages AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal_pipeline_stage
), owners AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__owner
), deal_fields_joined AS (
  SELECT
    deals.*,
    COALESCE(pipelines.is_deal_pipeline_deleted, FALSE) AS is_deal_pipeline_deleted,
    pipelines.pipeline_label,
    pipelines.is_active AS is_pipeline_active,
    COALESCE(pipeline_stages.is_deal_pipeline_stage_deleted, FALSE) AS is_deal_pipeline_stage_deleted,
    pipelines.deal_pipeline_created_at,
    pipelines.deal_pipeline_updated_at,
    pipeline_stages.pipeline_stage_label,
    owners.email_address AS owner_email_address,
    owners.full_name AS owner_full_name
  FROM deals
  LEFT JOIN pipelines
    ON deals.deal_pipeline_id = pipelines.deal_pipeline_id
  LEFT JOIN pipeline_stages
    ON deals.deal_pipeline_stage_id = pipeline_stages.deal_pipeline_stage_id
  LEFT JOIN owners
    ON deals.owner_id = owners.owner_id
)
SELECT
  *
FROM deal_fields_joined
%3 29. model.hubspot.int_hubspot__deals_enhanced 29. model.hubspot.int_hubspot__deals_enhanced 46. model.hubspot_source.stg_hubspot__deal 46. model.hubspot_source.stg_hubspot__deal 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner
Name Type Comment
30. model.hubspot.int_hubspot__email_aggregate_status_change

This SQL query aggregates data from the hubspot__email_event_status_change table. It counts the number of unsubscribes for each combination of email_campaign_id and email_send_id. The query filters out rows where email_send_id is null and only considers 'UNSUBSCRIBED' status for counting.

FilteringAggregation
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.hubspot__email_event_status_change
), aggregates AS (
  SELECT
    email_campaign_id,
    email_send_id,
    COUNT(CASE WHEN subscription_status = 'UNSUBSCRIBED' THEN 1 END) AS unsubscribes
  FROM base
  WHERE
    NOT email_send_id IS NULL
  GROUP BY
    1,
    2
)
SELECT
  *
FROM aggregates
%3 30. model.hubspot.int_hubspot__email_aggregate_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change email_send_id 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_id 20. model.hubspot.hubspot__email_event_status_change:f0->30. model.hubspot.int_hubspot__email_aggregate_status_change:f0
Name Type Comment
email_send_id None None
Column Lineage
%3 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_id 30. model.hubspot.int_hubspot__email_aggregate_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change email_send_id 20. model.hubspot.hubspot__email_event_status_change:f0->30. model.hubspot.int_hubspot__email_aggregate_status_change:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_id unsubscribes was_unsubcribed 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f2->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f2->5. model.hubspot.hubspot__contacts:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f2->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f2->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f2->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f2->9. model.hubspot.hubspot__email_campaigns:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f2->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f2->4. model.hubspot.hubspot__contact_lists:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
30. model.hubspot.int_hubspot__email_aggregate_status_change
  • Input Column: 20. model.hubspot.hubspot__email_event_status_change[email_send_id]
    • Filtering The column is filtered to exclude null values (WHERE NOT email_send_id IS NULL)
    • Aggregation The column is used in the GROUP BY clause
    • Output Columns:
      • email_send_id: This column is directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unsubscribes]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unsubscribes: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate the total number of unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Summed up for each contact
      • total_unique_unsubscribes: Counted as unique occurrences for each contact
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is used to count the total number of unsubscribe email events and unique unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribe events
      • total_unique_unsubscribes: Aggregated count of unique unsubscribe events
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate the total number of unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Summed up to get the total number of unsubscribe events.
      • total_unique_unsubscribes: Counted to get the number of unique email sends with unsubscribe events.
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is likely used to calculate the total_unsubscribes and total_unique_unsubscribes metrics in the output.
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribes
      • total_unique_unsubscribes: Aggregated count of unique unsubscribes
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate total unsubscribes and unique unsubscribes
    • Output Columns:
      • total_unsubscribes: Sum of all unsubscribes
      • total_unique_unsubscribes: Count of distinct unsubscribes
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is likely used to calculate the total_unsubscribes and total_unique_unsubscribes in the output
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribes
      • total_unique_unsubscribes: Aggregated count of unique unsubscribes
31. model.hubspot.int_hubspot__email_event_aggregates

This SQL query aggregates email event data from the stg_hubspot__email_event table. It counts various types of email events (opens, sends, deliveries, drops, clicks, forwards, deferrals, bounces, spam reports, and prints) for each unique email_send_id. The query filters out rows where sent_by_event_id is null and groups the results by this ID.

FilteringAggregation
SQL Query
WITH events AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event
), aggregates AS (
  SELECT
    sent_by_event_id AS email_send_id,
    COUNT(CASE WHEN event_type = 'OPEN' THEN sent_by_event_id END) AS opens,
    COUNT(CASE WHEN event_type = 'SENT' THEN sent_by_event_id END) AS sends,
    COUNT(CASE WHEN event_type = 'DELIVERED' THEN sent_by_event_id END) AS deliveries,
    COUNT(CASE WHEN event_type = 'DROPPED' THEN sent_by_event_id END) AS drops,
    COUNT(CASE WHEN event_type = 'CLICK' THEN sent_by_event_id END) AS clicks,
    COUNT(CASE WHEN event_type = 'FORWARD' THEN sent_by_event_id END) AS forwards,
    COUNT(CASE WHEN event_type = 'DEFERRED' THEN sent_by_event_id END) AS deferrals,
    COUNT(CASE WHEN event_type = 'BOUNCE' THEN sent_by_event_id END) AS bounces,
    COUNT(CASE WHEN event_type = 'SPAMREPORT' THEN sent_by_event_id END) AS spam_reports,
    COUNT(CASE WHEN event_type = 'PRINT' THEN sent_by_event_id END) AS prints
  FROM events
  WHERE
    NOT sent_by_event_id IS NULL
  GROUP BY
    1
)
SELECT
  *
FROM aggregates
%3 31. model.hubspot.int_hubspot__email_event_aggregates 31. model.hubspot.int_hubspot__email_event_aggregates email_send_id 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->31. model.hubspot.int_hubspot__email_event_aggregates:f0
Name Type Comment
email_send_id None None
Column Lineage
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 31. model.hubspot.int_hubspot__email_event_aggregates 31. model.hubspot.int_hubspot__email_event_aggregates email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->31. model.hubspot.int_hubspot__email_event_aggregates:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_id 31. model.hubspot.int_hubspot__email_event_aggregates:f0->21. model.hubspot.hubspot__email_sends:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
31. model.hubspot.int_hubspot__email_event_aggregates
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Filtering This column is used to filter out null values
    • Integration It's used as the key to group events
    • Aggregation It's used as the grouping key for all aggregations
    • Output Columns:
      • email_send_id: This column is directly mapped to email_send_id in the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 31. model.hubspot.int_hubspot__email_event_aggregates[email_send_id]
    • Integration This column is used as the key to join the aggregated metrics with the main email sent events.
    • Direct The column is directly copied to the output without transformation.
    • Output Columns:
      • email_send_id: It is directly copied to the output column with the same name.
32. model.hubspot.int_hubspot__email_metrics__by_contact_list

This SQL query joins email send data with contact list member data to generate email metrics grouped by contact list. It filters out records where the contact_list_id is null, effectively focusing on email sends associated with specific contact lists.

IntegrationFilteringAggregation
SQL Query
WITH email_sends AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.hubspot__email_sends
), contact_list_member AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__contact_list_member
), joined AS (
  SELECT
    email_sends.*,
    contact_list_member.contact_list_id
  FROM email_sends
  LEFT JOIN contact_list_member
    USING (contact_id)
  WHERE
    NOT contact_list_member.contact_list_id IS NULL
), email_metrics AS (
  SELECT
    contact_list_id
  FROM joined
  GROUP BY
    1
)
SELECT
  *
FROM email_metrics
%3 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list contact_list_id total_bounces total_unique_bounces total_clicks total_unique_clicks total_deferrals total_unique_deferrals total_deliveries total_unique_deliveries total_drops total_unique_drops total_forwards total_unique_forwards total_opens total_unique_opens total_prints total_unique_prints total_spam_reports total_unique_spam_reports total_unsubscribes total_unique_unsubscribes 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends contact_id bounces clicks deferrals deliveries drops forwards opens prints spam_reports unsubscribes was_bounced was_clicked was_deferred was_delivered was_forwarded was_opened was_printed was_spam_reported was_unsubcribed 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f2 21. model.hubspot.hubspot__email_sends:f2->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f3 21. model.hubspot.hubspot__email_sends:f2->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f4 21. model.hubspot.hubspot__email_sends:f3->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f5 21. model.hubspot.hubspot__email_sends:f3->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f6 21. model.hubspot.hubspot__email_sends:f4->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f7 21. model.hubspot.hubspot__email_sends:f4->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f8 21. model.hubspot.hubspot__email_sends:f5->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f9 21. model.hubspot.hubspot__email_sends:f5->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f10 21. model.hubspot.hubspot__email_sends:f6->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f11 21. model.hubspot.hubspot__email_sends:f6->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f12 21. model.hubspot.hubspot__email_sends:f7->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f13 21. model.hubspot.hubspot__email_sends:f7->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f14 21. model.hubspot.hubspot__email_sends:f8->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f15 21. model.hubspot.hubspot__email_sends:f8->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f16 21. model.hubspot.hubspot__email_sends:f9->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f17 21. model.hubspot.hubspot__email_sends:f9->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f18 21. model.hubspot.hubspot__email_sends:f10->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f19 21. model.hubspot.hubspot__email_sends:f10->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f20 21. model.hubspot.hubspot__email_sends:f11->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f11->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f2 21. model.hubspot.hubspot__email_sends:f12->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f3 21. model.hubspot.hubspot__email_sends:f12->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f4 21. model.hubspot.hubspot__email_sends:f13->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f5 21. model.hubspot.hubspot__email_sends:f13->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f6 21. model.hubspot.hubspot__email_sends:f14->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f7 21. model.hubspot.hubspot__email_sends:f14->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f8 21. model.hubspot.hubspot__email_sends:f15->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f11 21. model.hubspot.hubspot__email_sends:f15->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f12 21. model.hubspot.hubspot__email_sends:f16->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f13 21. model.hubspot.hubspot__email_sends:f16->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f14 21. model.hubspot.hubspot__email_sends:f17->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f15 21. model.hubspot.hubspot__email_sends:f17->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f16 21. model.hubspot.hubspot__email_sends:f18->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f17 21. model.hubspot.hubspot__email_sends:f18->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f18 21. model.hubspot.hubspot__email_sends:f19->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f19 21. model.hubspot.hubspot__email_sends:f19->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f20 40. model.hubspot_source.stg_hubspot__contact_list_member 40. model.hubspot_source.stg_hubspot__contact_list_member contact_id contact_list_id 40. model.hubspot_source.stg_hubspot__contact_list_member:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0
Name Type Comment
contact_list_id integer None
total_bounces numeric None
total_unique_bounces bigint None
total_clicks numeric None
total_unique_clicks bigint None
total_deferrals numeric None
total_unique_deferrals bigint None
total_deliveries numeric None
total_unique_deliveries bigint None
total_drops numeric None
total_unique_drops bigint None
total_forwards numeric None
total_unique_forwards bigint None
total_opens numeric None
total_unique_opens bigint None
total_prints numeric None
total_unique_prints bigint None
total_spam_reports numeric None
total_unique_spam_reports bigint None
total_unsubscribes numeric None
total_unique_unsubscribes bigint None
Column Lineage
%3 40. model.hubspot_source.stg_hubspot__contact_list_member 40. model.hubspot_source.stg_hubspot__contact_list_member contact_list_id 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list contact_list_id 40. model.hubspot_source.stg_hubspot__contact_list_member:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists contact_list_id 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp contact_list_id 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp:f0->40. model.hubspot_source.stg_hubspot__contact_list_member:f0
40. model.hubspot_source.stg_hubspot__contact_list_member
  • Input Column: 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp[contact_list_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT in the macro CTE
    • Output Columns:
      • contact_list_id: Directly mapped after casting
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 40. model.hubspot_source.stg_hubspot__contact_list_member[contact_list_id]
    • Integration This column is used in the LEFT JOIN operation to connect email sends with contact lists.
    • Filtering It's used in the WHERE clause to filter out null values.
    • Aggregation It's used in the GROUP BY clause to aggregate email metrics per contact list.
    • Output Columns:
      • contact_list_id: This column is directly copied to the output.
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[contact_list_id]
    • Integration Used as the key to join the contact_lists and email_metrics tables
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • contact_list_id: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends bounces was_bounced 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_bounces total_unique_bounces 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_bounces 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[bounces]
    • Aggregation Likely aggregated to calculate total_bounces and total_unique_bounces
    • Output Columns:
      • total_bounces: Summed for each contact_list_id
      • total_unique_bounces: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_bounced]
    • Aggregation This column is aggregated to calculate total bounces and unique bounces
    • Output Columns:
      • total_bounces: Sum of all bounces
      • total_unique_bounces: Count of distinct bounces
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_bounces]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_bounces: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends bounces was_bounced 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_bounces total_unique_bounces 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_unique_bounces 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[bounces]
    • Aggregation Likely aggregated to calculate total_bounces and total_unique_bounces
    • Output Columns:
      • total_bounces: Summed for each contact_list_id
      • total_unique_bounces: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_bounced]
    • Aggregation This column is aggregated to calculate total bounces and unique bounces
    • Output Columns:
      • total_bounces: Sum of all bounces
      • total_unique_bounces: Count of distinct bounces
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_bounces]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_unique_bounces: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends clicks was_clicked 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_clicks total_unique_clicks 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_clicks 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[clicks]
    • Aggregation Likely aggregated to calculate total_clicks and total_unique_clicks
    • Output Columns:
      • total_clicks: Summed for each contact_list_id
      • total_unique_clicks: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_clicked]
    • Aggregation This column is aggregated to calculate total clicks and unique clicks
    • Output Columns:
      • total_clicks: Sum of all clicks
      • total_unique_clicks: Count of distinct clicks
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_clicks]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_clicks: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends clicks was_clicked 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_clicks total_unique_clicks 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_unique_clicks 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[clicks]
    • Aggregation Likely aggregated to calculate total_clicks and total_unique_clicks
    • Output Columns:
      • total_clicks: Summed for each contact_list_id
      • total_unique_clicks: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_clicked]
    • Aggregation This column is aggregated to calculate total clicks and unique clicks
    • Output Columns:
      • total_clicks: Sum of all clicks
      • total_unique_clicks: Count of distinct clicks
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_clicks]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_unique_clicks: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends deferrals was_deferred 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_deferrals total_unique_deferrals 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_deferrals 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[deferrals]
    • Aggregation Likely aggregated to calculate total_deferrals and total_unique_deferrals
    • Output Columns:
      • total_deferrals: Summed for each contact_list_id
      • total_unique_deferrals: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_deferred]
    • Aggregation This column is aggregated to calculate total deferrals and unique deferrals
    • Output Columns:
      • total_deferrals: Sum of all deferrals
      • total_unique_deferrals: Count of distinct deferrals
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_deferrals]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_deferrals: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends deferrals was_deferred 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_deferrals total_unique_deferrals 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_unique_deferrals 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[deferrals]
    • Aggregation Likely aggregated to calculate total_deferrals and total_unique_deferrals
    • Output Columns:
      • total_deferrals: Summed for each contact_list_id
      • total_unique_deferrals: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_deferred]
    • Aggregation This column is aggregated to calculate total deferrals and unique deferrals
    • Output Columns:
      • total_deferrals: Sum of all deferrals
      • total_unique_deferrals: Count of distinct deferrals
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_deferrals]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_unique_deferrals: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends deliveries was_delivered 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_deliveries total_unique_deliveries 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_deliveries 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[deliveries]
    • Aggregation Likely aggregated to calculate total_deliveries and total_unique_deliveries
    • Output Columns:
      • total_deliveries: Summed for each contact_list_id
      • total_unique_deliveries: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_delivered]
    • Aggregation This column is aggregated to calculate total deliveries and unique deliveries
    • Output Columns:
      • total_deliveries: Sum of all deliveries
      • total_unique_deliveries: Count of distinct deliveries
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_deliveries]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_deliveries: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends deliveries was_delivered 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_deliveries total_unique_deliveries 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_unique_deliveries 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[deliveries]
    • Aggregation Likely aggregated to calculate total_deliveries and total_unique_deliveries
    • Output Columns:
      • total_deliveries: Summed for each contact_list_id
      • total_unique_deliveries: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_delivered]
    • Aggregation This column is aggregated to calculate total deliveries and unique deliveries
    • Output Columns:
      • total_deliveries: Sum of all deliveries
      • total_unique_deliveries: Count of distinct deliveries
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_deliveries]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_unique_deliveries: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends drops 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_drops total_unique_drops 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_drops 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[drops]
    • Aggregation Likely aggregated to calculate total_drops and total_unique_drops
    • Output Columns:
      • total_drops: Summed for each contact_list_id
      • total_unique_drops: Counted distinct for each contact_list_id
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_drops]
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • total_drops: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends drops 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_drops total_unique_drops 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[drops]
    • Aggregation Likely aggregated to calculate total_drops and total_unique_drops
    • Output Columns:
      • total_drops: Summed for each contact_list_id
      • total_unique_drops: Counted distinct for each contact_list_id
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends forwards was_forwarded 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_forwards total_unique_forwards 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_forwards 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[forwards]
    • Aggregation Likely aggregated to calculate total_forwards and total_unique_forwards
    • Output Columns:
      • total_forwards: Summed for each contact_list_id
      • total_unique_forwards: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_forwarded]
    • Aggregation This column is aggregated to calculate total forwards and unique forwards
    • Output Columns:
      • total_forwards: Sum of all forwards
      • total_unique_forwards: Count of distinct forwards
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_forwards]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_forwards: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends forwards was_forwarded 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_forwards total_unique_forwards 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_unique_forwards 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[forwards]
    • Aggregation Likely aggregated to calculate total_forwards and total_unique_forwards
    • Output Columns:
      • total_forwards: Summed for each contact_list_id
      • total_unique_forwards: Counted distinct for each contact_list_id
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_forwarded]
    • Aggregation This column is aggregated to calculate total forwards and unique forwards
    • Output Columns:
      • total_forwards: Sum of all forwards
      • total_unique_forwards: Count of distinct forwards
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_forwards]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unique_forwards: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends opens was_opened 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_opens total_unique_opens 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_opens 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[opens]
    • Aggregation This column is aggregated to calculate total opens and unique opens
    • Output Columns:
      • total_opens: Sum of all opens
      • total_unique_opens: Count of distinct opens
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_opened]
    • Aggregation This column is aggregated to calculate total opens and unique opens
    • Output Columns:
      • total_opens: Sum of all opens
      • total_unique_opens: Count of distinct opens
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_opens]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_opens: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends opens was_opened 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_opens total_unique_opens 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_unique_opens 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[opens]
    • Aggregation This column is aggregated to calculate total opens and unique opens
    • Output Columns:
      • total_opens: Sum of all opens
      • total_unique_opens: Count of distinct opens
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_opened]
    • Aggregation This column is aggregated to calculate total opens and unique opens
    • Output Columns:
      • total_opens: Sum of all opens
      • total_unique_opens: Count of distinct opens
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_opens]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unique_opens: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends prints was_printed 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_prints total_unique_prints 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_prints 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[prints]
    • Aggregation This column is aggregated to calculate total prints and unique prints
    • Output Columns:
      • total_prints: Sum of all prints
      • total_unique_prints: Count of distinct prints
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_printed]
    • Aggregation This column is likely used to calculate the total_prints and total_unique_prints in the output
    • Output Columns:
      • total_prints: Aggregated count of all prints
      • total_unique_prints: Aggregated count of unique prints
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_prints]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_prints: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends prints was_printed 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_prints total_unique_prints 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_unique_prints 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[prints]
    • Aggregation This column is aggregated to calculate total prints and unique prints
    • Output Columns:
      • total_prints: Sum of all prints
      • total_unique_prints: Count of distinct prints
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_printed]
    • Aggregation This column is likely used to calculate the total_prints and total_unique_prints in the output
    • Output Columns:
      • total_prints: Aggregated count of all prints
      • total_unique_prints: Aggregated count of unique prints
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_prints]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unique_prints: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends spam_reports was_spam_reported 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_spam_reports total_unique_spam_reports 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_spam_reports 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[spam_reports]
    • Aggregation This column is aggregated to calculate total spam reports and unique spam reports
    • Output Columns:
      • total_spam_reports: Sum of all spam reports
      • total_unique_spam_reports: Count of distinct spam reports
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_spam_reported]
    • Aggregation This column is likely used to calculate the total_spam_reports and total_unique_spam_reports in the output
    • Output Columns:
      • total_spam_reports: Aggregated count of all spam reports
      • total_unique_spam_reports: Aggregated count of unique spam reports
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_spam_reports]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_spam_reports: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends spam_reports was_spam_reported 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_spam_reports total_unique_spam_reports 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_unique_spam_reports 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f0
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[spam_reports]
    • Aggregation This column is aggregated to calculate total spam reports and unique spam reports
    • Output Columns:
      • total_spam_reports: Sum of all spam reports
      • total_unique_spam_reports: Count of distinct spam reports
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_spam_reported]
    • Aggregation This column is likely used to calculate the total_spam_reports and total_unique_spam_reports in the output
    • Output Columns:
      • total_spam_reports: Aggregated count of all spam reports
      • total_unique_spam_reports: Aggregated count of unique spam reports
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unique_spam_reports]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unique_spam_reports: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_id unsubscribes was_unsubcribed 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f2->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f2->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_unsubscribes 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change email_send_id 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_id 20. model.hubspot.hubspot__email_event_status_change:f0->30. model.hubspot.int_hubspot__email_aggregate_status_change:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
30. model.hubspot.int_hubspot__email_aggregate_status_change
  • Input Column: 20. model.hubspot.hubspot__email_event_status_change[email_send_id]
    • Filtering The column is filtered to exclude null values (WHERE NOT email_send_id IS NULL)
    • Aggregation The column is used in the GROUP BY clause
    • Output Columns:
      • email_send_id: This column is directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate total unsubscribes and unique unsubscribes
    • Output Columns:
      • total_unsubscribes: Sum of all unsubscribes
      • total_unique_unsubscribes: Count of distinct unsubscribes
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is likely used to calculate the total_unsubscribes and total_unique_unsubscribes in the output
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribes
      • total_unique_unsubscribes: Aggregated count of unique unsubscribes
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unsubscribes]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unsubscribes: Directly copied
Column Lineage
%3 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_id unsubscribes was_unsubcribed 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f2->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f2->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change email_send_id 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_id 20. model.hubspot.hubspot__email_event_status_change:f0->30. model.hubspot.int_hubspot__email_aggregate_status_change:f0 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
30. model.hubspot.int_hubspot__email_aggregate_status_change
  • Input Column: 20. model.hubspot.hubspot__email_event_status_change[email_send_id]
    • Filtering The column is filtered to exclude null values (WHERE NOT email_send_id IS NULL)
    • Aggregation The column is used in the GROUP BY clause
    • Output Columns:
      • email_send_id: This column is directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate total unsubscribes and unique unsubscribes
    • Output Columns:
      • total_unsubscribes: Sum of all unsubscribes
      • total_unique_unsubscribes: Count of distinct unsubscribes
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is likely used to calculate the total_unsubscribes and total_unique_unsubscribes in the output
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribes
      • total_unique_unsubscribes: Aggregated count of unique unsubscribes
33. model.hubspot.int_hubspot__engagement_metrics__by_contact

This SQL query calculates engagement metrics for each contact in HubSpot. It joins engagement data with contact data, then counts the number of different types of engagements (notes, tasks, calls, meetings, emails, incoming emails, and forwarded emails) for each contact. The result is a summary of engagement activities per contact.

IntegrationAggregationFeaturization
SQL Query
WITH engagements AS (
  SELECT
    *
  FROM TEST.PUBLIC_hubspot.hubspot__engagements
), engagement_contacts AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_contact
), engagement_contacts_joined AS (
  SELECT
    engagements.engagement_type,
    engagement_contacts.contact_id
  FROM engagements
  INNER JOIN engagement_contacts
    USING (engagement_id)
), engagement_contacts_agg AS (
  SELECT
    contact_id,
    COUNT(CASE WHEN engagement_type = 'NOTE' THEN contact_id END) AS count_engagement_notes,
    COUNT(CASE WHEN engagement_type = 'TASK' THEN contact_id END) AS count_engagement_tasks,
    COUNT(CASE WHEN engagement_type = 'CALL' THEN contact_id END) AS count_engagement_calls,
    COUNT(CASE WHEN engagement_type = 'MEETING' THEN contact_id END) AS count_engagement_meetings,
    COUNT(CASE WHEN engagement_type = 'EMAIL' THEN contact_id END) AS count_engagement_emails,
    COUNT(CASE WHEN engagement_type = 'INCOMING_EMAIL' THEN contact_id END) AS count_engagement_incoming_emails,
    COUNT(CASE WHEN engagement_type = 'FORWARDED_EMAIL' THEN contact_id END) AS count_engagement_forwarded_emails
  FROM engagement_contacts_joined
  GROUP BY
    1
)
SELECT
  *
FROM engagement_contacts_agg
%3 33. model.hubspot.int_hubspot__engagement_metrics__by_contact 33. model.hubspot.int_hubspot__engagement_metrics__by_contact contact_id 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements contact_ids 27. model.hubspot.hubspot__engagements:f0->33. model.hubspot.int_hubspot__engagement_metrics__by_contact:f0 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact
Name Type Comment
contact_id None None
Column Lineage
%3 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements contact_ids 33. model.hubspot.int_hubspot__engagement_metrics__by_contact 33. model.hubspot.int_hubspot__engagement_metrics__by_contact contact_id 27. model.hubspot.hubspot__engagements:f0->33. model.hubspot.int_hubspot__engagement_metrics__by_contact:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts contact_id 33. model.hubspot.int_hubspot__engagement_metrics__by_contact:f0->5. model.hubspot.hubspot__contacts:f0 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact contact_id 91. model.hubspot_source.stg_hubspot__engagement_contact:f0->27. model.hubspot.hubspot__engagements:f0 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp contact_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[contact_id]
    • Cleaning The column is cast to INT data type in the macro CTE
    • Output Columns:
      • contact_id: It is directly mapped after casting
27. model.hubspot.hubspot__engagements
  • Input Column: 91. model.hubspot_source.stg_hubspot__engagement_contact[contact_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Integration It's used in the GROUP BY clause to create the aggregated array
    • Output Columns:
      • contact_ids: The contact_id values are aggregated into the contact_ids array in the output
33. model.hubspot.int_hubspot__engagement_metrics__by_contact
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Integration This column is indirectly used through the join with the engagement_contacts table, which likely contains the individual contact IDs derived from this list.
    • Aggregation The contact IDs are used in the GROUP BY clause to aggregate engagement counts per contact.
    • Output Columns:
      • contact_id: The individual contact IDs from this list are mapped to the output 'contact_id' column.
5. model.hubspot.hubspot__contacts
  • Input Column: 33. model.hubspot.int_hubspot__engagement_metrics__by_contact[contact_id]
    • Integration This column is used as the key to join the engagement metrics with the main contact data in the LEFT JOIN operation.
    • Direct The column is directly copied to the output without transformation.
    • Output Columns:
      • contact_id: Directly copied to the output column with the same name.
34. model.hubspot_source.stg_hubspot__company

This SQL query is primarily focused on data cleaning and structuring for a HubSpot company staging model. It starts by selecting all columns from a temporary table, then defines a set of columns with specific data types. The query then selects and casts specific fields, potentially adding pass-through columns and calculated fields (as indicated by comments, though not explicitly shown in the provided SQL). The final result is a cleaned and structured dataset of company information from HubSpot.

CleaningIntegration
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__company_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS company_id,
    CAST(NULL AS BOOLEAN) AS is_company_deleted,
    CAST(NULL AS TEXT) AS company_name,
    CAST(NULL AS TEXT) AS description,
    CAST(NULL AS TIMESTAMP) AS created_date,
    CAST(NULL AS TEXT) AS industry,
    CAST(NULL AS TEXT) AS street_address,
    CAST(NULL AS TEXT) AS street_address_2,
    CAST(NULL AS TEXT) AS city,
    CAST(NULL AS TEXT) AS state,
    CAST(NULL AS TEXT) AS country,
    CAST(NULL AS INT) AS company_annual_revenue
  FROM base
), fields AS (
  SELECT
    company_id, /* just default columns + explicitly configured passthrough columns */ /* a few columns below are aliased within the macros/get_company_columns.sql macro */
    is_company_deleted,
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    company_name,
    description,
    created_date,
    industry,
    street_address,
    street_address_2,
    city,
    state,
    country,
    company_annual_revenue
  /* The below macro adds the fields defined within your hubspot__ticket_pass_through_columns variable into the staging model */ /* The below macro add the ability to create calculated fields using the hubspot__company_calculated_fields variable. */
  FROM macro
), joined AS (
  SELECT
    fields.*
  FROM fields
)
SELECT
  *
FROM joined
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company _fivetran_synced is_company_deleted company_id company_name description created_date industry street_address street_address_2 city state country company_annual_revenue 37. model.hubspot_source.stg_hubspot__company_tmp 37. model.hubspot_source.stg_hubspot__company_tmp id is_deleted 37. model.hubspot_source.stg_hubspot__company_tmp:f0->34. model.hubspot_source.stg_hubspot__company:f2 37. model.hubspot_source.stg_hubspot__company_tmp:f1->34. model.hubspot_source.stg_hubspot__company:f1
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
is_company_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
company_id bigint The ID of the company.
company_name text The name of the company.
description text A short statement about the company's mission and goals.
created_date timestamp without time zone The date the company was added to your account.
industry text The type of business the company performs.
street_address text The street address of the company.
street_address_2 text Additional address information for the company.
city text The city where the company is located.
state text The state where the company is located.
country text The country where the company is located.
company_annual_revenue integer The actual or estimated annual revenue of the company.
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company _fivetran_synced 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies _fivetran_synced 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 37. model.hubspot_source.stg_hubspot__company_tmp 37. model.hubspot_source.stg_hubspot__company_tmp is_deleted 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company is_company_deleted 37. model.hubspot_source.stg_hubspot__company_tmp:f0->34. model.hubspot_source.stg_hubspot__company:f0 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies is_company_deleted 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
34. model.hubspot_source.stg_hubspot__company
  • Input Column: 37. model.hubspot_source.stg_hubspot__company_tmp[is_deleted]
    • Cleaning The column is cleaned by casting it to BOOLEAN type
    • Output Columns:
      • is_company_deleted: The 'is_deleted' column is directly mapped to 'is_company_deleted' after casting to BOOLEAN
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[is_company_deleted]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_company_deleted: Directly copied to the output
Column Lineage
%3 37. model.hubspot_source.stg_hubspot__company_tmp 37. model.hubspot_source.stg_hubspot__company_tmp id 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company company_id 37. model.hubspot_source.stg_hubspot__company_tmp:f0->34. model.hubspot_source.stg_hubspot__company:f0 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies company_id 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
34. model.hubspot_source.stg_hubspot__company
  • Input Column: 37. model.hubspot_source.stg_hubspot__company_tmp[id]
    • Cleaning The column is cleaned by casting it to INT type
    • Integration The column is likely used as the primary key for the company record
    • Output Columns:
      • company_id: The 'id' column is directly mapped to 'company_id' after casting to INT
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[company_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as the key to join the companies table with the engagement_companies_agg CTE
    • Output Columns:
      • company_id: Directly copied to the output
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company company_name 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies company_name 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[company_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • company_name: Directly copied to the output
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company description 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies description 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[description]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • description: Directly copied to the output
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company created_date 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies created_date 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[created_date]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_date: Directly copied to the output
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company industry 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies industry 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[industry]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • industry: Directly copied to the output
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company street_address 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies street_address 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[street_address]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • street_address: Directly copied to the output
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company street_address_2 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies street_address_2 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[street_address_2]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • street_address_2: Directly copied to the output
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company city 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies city 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[city]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • city: Directly copied to the output
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company state 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies state 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[state]
    • Direct The state column is directly copied without any transformation
    • Output Columns:
      • state: It is directly mapped to the output 'state' column
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company country 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies country 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[country]
    • Direct The country column is directly copied without any transformation
    • Output Columns:
      • country: It is directly mapped to the output 'country' column
Column Lineage
%3 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company company_annual_revenue 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies company_annual_revenue 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[company_annual_revenue]
    • Direct The company_annual_revenue column is directly copied without any transformation
    • Output Columns:
      • company_annual_revenue: It is directly mapped to the output 'company_annual_revenue' column
35. model.hubspot_source.stg_hubspot__company_property_history

This SQL query performs data type casting and column renaming on the 'stg_hubspot__company_property_history' table. It first creates a base CTE from the temporary table, then defines a macro CTE with null values and appropriate data types. Finally, it casts and renames columns in the fields CTE, preparing the data for further use.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__company_property_history_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS company_id,
    CAST(NULL AS TEXT) AS name,
    CAST(NULL AS TEXT) AS source,
    CAST(NULL AS TEXT) AS source_id,
    CAST(NULL AS TIMESTAMP) AS change_timestamp,
    CAST(NULL AS TEXT) AS value
  FROM base
), fields AS (
  SELECT
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    company_id,
    name AS field_name,
    source AS change_source,
    source_id AS change_source_id,
    CAST(change_timestamp AS TIMESTAMP) AS change_timestamp, /* source field name = timestamp ; alias declared in macros/get_company_property_history_columns.sql */
    value AS new_value
  FROM macro
)
SELECT
  *
FROM fields
%3 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history _fivetran_synced change_source change_source_id change_timestamp company_id field_name new_value 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp company_id timestamp _fivetran_synced source source_id name value 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f4 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f1->35. model.hubspot_source.stg_hubspot__company_property_history:f3 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f2->35. model.hubspot_source.stg_hubspot__company_property_history:f0 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f3->35. model.hubspot_source.stg_hubspot__company_property_history:f1 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f4->35. model.hubspot_source.stg_hubspot__company_property_history:f2 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f5->35. model.hubspot_source.stg_hubspot__company_property_history:f5 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f6->35. model.hubspot_source.stg_hubspot__company_property_history:f6
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
change_source text The source (reason) of the change.
change_source_id integer The ID of the object that caused the change, if applicable.
change_timestamp timestamp without time zone The timestamp the changed occurred.
company_id bigint The ID of the related company record.
field_name text The name of the field being changed.
new_value text The new value of the field.
Column Lineage
%3 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp _fivetran_synced 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history _fivetran_synced 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Cast as TIMESTAMP and directly mapped
Column Lineage
%3 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp source 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history change_source 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history change_source 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source: Renamed to change_source in the output
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[change_source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source: Directly copied to the output
Column Lineage
%3 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp source_id 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history change_source_id 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history change_source_id 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[source_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source_id: Renamed to change_source_id in the output
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[change_source_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source_id: Directly copied to the output
Column Lineage
%3 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp timestamp 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history change_timestamp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history valid_from valid_to 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f1
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[timestamp]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • change_timestamp: Cast as TIMESTAMP and renamed
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[change_timestamp]
    • Direct The column is directly copied as valid_from
    • Other Used in LEAD function to calculate valid_to
    • Deduplication Used in window function to order changes
    • Output Columns:
      • valid_from: Directly mapped to change_timestamp
      • valid_to: Indirectly used to calculate the next change timestamp
Column Lineage
%3 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp company_id 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history company_id 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history company_id id 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f1
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly mapped to the output column
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[company_id]
    • Direct The column is directly copied without any transformation
    • Deduplication Used in window function to partition changes by company
    • Other Used in surrogate key generation
    • Output Columns:
      • company_id: Directly copied to the output
      • id: Part of the surrogate key generation
Column Lineage
%3 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp name 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history field_name 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history field_name id 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f1
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • field_name: Renamed to field_name in the output
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[field_name]
    • Direct The column is directly copied without any transformation
    • Deduplication Used in window function to partition changes by field
    • Other Used in surrogate key generation
    • Output Columns:
      • field_name: Directly copied to the output
      • id: Part of the surrogate key generation
Column Lineage
%3 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp value 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history new_value 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history new_value 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[value]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • new_value: Renamed to new_value in the output
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[new_value]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • new_value: Directly copied to the output
36. model.hubspot_source.stg_hubspot__company_property_history_tmp

This SQL query is a simple select statement that retrieves all columns from the TEST.hubspot.company_property_history table. The comment suggests that this query is part of a dbt compilation process and may be used as a placeholder or for syntax validation purposes.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.company_property_history
%3 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp company_id timestamp _fivetran_synced source source_id name value 111. source.hubspot_source.hubspot.company_property_history 111. source.hubspot_source.hubspot.company_property_history
Name Type Comment
company_id bigint None
timestamp text None
_fivetran_synced text None
source text None
source_id integer None
name text None
value text None
Column Lineage
%3 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp company_id 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history company_id 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history company_id id 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f1
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly mapped to the output column
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[company_id]
    • Direct The column is directly copied without any transformation
    • Deduplication Used in window function to partition changes by company
    • Other Used in surrogate key generation
    • Output Columns:
      • company_id: Directly copied to the output
      • id: Part of the surrogate key generation
Column Lineage
%3 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp timestamp 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history change_timestamp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history valid_from valid_to 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f1
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[timestamp]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • change_timestamp: Cast as TIMESTAMP and renamed
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[change_timestamp]
    • Direct The column is directly copied as valid_from
    • Other Used in LEAD function to calculate valid_to
    • Deduplication Used in window function to order changes
    • Output Columns:
      • valid_from: Directly mapped to change_timestamp
      • valid_to: Indirectly used to calculate the next change timestamp
Column Lineage
%3 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp _fivetran_synced 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history _fivetran_synced 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Cast as TIMESTAMP and directly mapped
Column Lineage
%3 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp source 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history change_source 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history change_source 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source: Renamed to change_source in the output
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[change_source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source: Directly copied to the output
Column Lineage
%3 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp source_id 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history change_source_id 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history change_source_id 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[source_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source_id: Renamed to change_source_id in the output
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[change_source_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source_id: Directly copied to the output
Column Lineage
%3 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp name 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history field_name 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history field_name id 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f1
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • field_name: Renamed to field_name in the output
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[field_name]
    • Direct The column is directly copied without any transformation
    • Deduplication Used in window function to partition changes by field
    • Other Used in surrogate key generation
    • Output Columns:
      • field_name: Directly copied to the output
      • id: Part of the surrogate key generation
Column Lineage
%3 36. model.hubspot_source.stg_hubspot__company_property_history_tmp 36. model.hubspot_source.stg_hubspot__company_property_history_tmp value 35. model.hubspot_source.stg_hubspot__company_property_history 35. model.hubspot_source.stg_hubspot__company_property_history new_value 36. model.hubspot_source.stg_hubspot__company_property_history_tmp:f0->35. model.hubspot_source.stg_hubspot__company_property_history:f0 2. model.hubspot.hubspot__company_history 2. model.hubspot.hubspot__company_history new_value 35. model.hubspot_source.stg_hubspot__company_property_history:f0->2. model.hubspot.hubspot__company_history:f0
35. model.hubspot_source.stg_hubspot__company_property_history
  • Input Column: 36. model.hubspot_source.stg_hubspot__company_property_history_tmp[value]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • new_value: Renamed to new_value in the output
2. model.hubspot.hubspot__company_history
  • Input Column: 35. model.hubspot_source.stg_hubspot__company_property_history[new_value]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • new_value: Directly copied to the output
37. model.hubspot_source.stg_hubspot__company_tmp

This SQL query selects all columns from the 'company' table in the 'hubspot' schema of the 'TEST' database. The comment suggests that this is a placeholder query, possibly used during dbt compilation, and that the actual table might not exist yet or all columns might have been excluded.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.company
%3 37. model.hubspot_source.stg_hubspot__company_tmp 37. model.hubspot_source.stg_hubspot__company_tmp id is_deleted 110. source.hubspot_source.hubspot.company 110. source.hubspot_source.hubspot.company
Name Type Comment
id bigint None
is_deleted boolean None
Column Lineage
%3 37. model.hubspot_source.stg_hubspot__company_tmp 37. model.hubspot_source.stg_hubspot__company_tmp id 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company company_id 37. model.hubspot_source.stg_hubspot__company_tmp:f0->34. model.hubspot_source.stg_hubspot__company:f0 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies company_id 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
34. model.hubspot_source.stg_hubspot__company
  • Input Column: 37. model.hubspot_source.stg_hubspot__company_tmp[id]
    • Cleaning The column is cleaned by casting it to INT type
    • Integration The column is likely used as the primary key for the company record
    • Output Columns:
      • company_id: The 'id' column is directly mapped to 'company_id' after casting to INT
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[company_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as the key to join the companies table with the engagement_companies_agg CTE
    • Output Columns:
      • company_id: Directly copied to the output
Column Lineage
%3 37. model.hubspot_source.stg_hubspot__company_tmp 37. model.hubspot_source.stg_hubspot__company_tmp is_deleted 34. model.hubspot_source.stg_hubspot__company 34. model.hubspot_source.stg_hubspot__company is_company_deleted 37. model.hubspot_source.stg_hubspot__company_tmp:f0->34. model.hubspot_source.stg_hubspot__company:f0 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies is_company_deleted 34. model.hubspot_source.stg_hubspot__company:f0->1. model.hubspot.hubspot__companies:f0
34. model.hubspot_source.stg_hubspot__company
  • Input Column: 37. model.hubspot_source.stg_hubspot__company_tmp[is_deleted]
    • Cleaning The column is cleaned by casting it to BOOLEAN type
    • Output Columns:
      • is_company_deleted: The 'is_deleted' column is directly mapped to 'is_company_deleted' after casting to BOOLEAN
1. model.hubspot.hubspot__companies
  • Input Column: 34. model.hubspot_source.stg_hubspot__company[is_company_deleted]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_company_deleted: Directly copied to the output
38. model.hubspot_source.stg_hubspot__contact

This SQL query is a staging model for HubSpot contact data. It selects and casts specific fields from a temporary table, applies default columns and configured pass-through columns, and prepares the data for further processing. The query includes placeholder logic for calculated fields and allows for customization through variables.

CleaningIntegrationOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__contact_tmp
), macro AS (
  SELECT
    CAST(NULL AS BOOLEAN) AS is_contact_deleted,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS contact_id,
    CAST(NULL AS TEXT) AS calculated_merged_vids,
    CAST(NULL AS TEXT) AS email,
    CAST(NULL AS TEXT) AS contact_company,
    CAST(NULL AS TEXT) AS first_name,
    CAST(NULL AS TEXT) AS last_name,
    CAST(NULL AS TIMESTAMP) AS created_date,
    CAST(NULL AS TEXT) AS job_title,
    CAST(NULL AS INT) AS company_annual_revenue
  FROM base
), fields AS (
  SELECT
    contact_id, /* just default columns + explicitly configured passthrough columns. */ /* a few columns below are aliased within the macros/get_contact_columns.sql macro */
    is_contact_deleted,
    calculated_merged_vids, /* will be null for BigQuery users until v3 api is rolled out to them */
    email,
    contact_company,
    first_name,
    last_name,
    CAST(created_date AS TIMESTAMP) AS created_date,
    job_title,
    company_annual_revenue,
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced
  /* The below macro adds the fields defined within your hubspot__contact_pass_through_columns variable into the staging model */ /* The below macro add the ability to create calculated fields using the hubspot__contact_calculated_fields variable. */
  FROM macro
), joined AS (
  SELECT
    fields.*
  FROM fields
)
SELECT
  *
FROM joined
%3 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact is_contact_deleted _fivetran_synced contact_id email contact_company first_name last_name created_date job_title company_annual_revenue calculated_merged_vids 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_deleted _fivetran_synced property_email id property_company property_firstname property_lastname property_createdate property_jobtitle property_annualrevenue property_hs_calculated_merged_vids property_created_at 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 45. model.hubspot_source.stg_hubspot__contact_tmp:f1->38. model.hubspot_source.stg_hubspot__contact:f1 45. model.hubspot_source.stg_hubspot__contact_tmp:f2->38. model.hubspot_source.stg_hubspot__contact:f3 45. model.hubspot_source.stg_hubspot__contact_tmp:f3->38. model.hubspot_source.stg_hubspot__contact:f2 45. model.hubspot_source.stg_hubspot__contact_tmp:f4->38. model.hubspot_source.stg_hubspot__contact:f4 45. model.hubspot_source.stg_hubspot__contact_tmp:f5->38. model.hubspot_source.stg_hubspot__contact:f5 45. model.hubspot_source.stg_hubspot__contact_tmp:f6->38. model.hubspot_source.stg_hubspot__contact:f6 45. model.hubspot_source.stg_hubspot__contact_tmp:f7->38. model.hubspot_source.stg_hubspot__contact:f7 45. model.hubspot_source.stg_hubspot__contact_tmp:f8->38. model.hubspot_source.stg_hubspot__contact:f8 45. model.hubspot_source.stg_hubspot__contact_tmp:f9->38. model.hubspot_source.stg_hubspot__contact:f9 45. model.hubspot_source.stg_hubspot__contact_tmp:f10->38. model.hubspot_source.stg_hubspot__contact:f10 45. model.hubspot_source.stg_hubspot__contact_tmp:f11->38. model.hubspot_source.stg_hubspot__contact:f7
Name Type Comment
is_contact_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
contact_id integer The ID of the contact.
email text The contact's email.
contact_company text The name of the contact's company.
first_name text The contact's first name.
last_name text The contact's last name.
created_date timestamp without time zone The date that the contact was created in your HubSpot account.
job_title integer The contact's job title.
company_annual_revenue integer The contact's annual company revenue.
calculated_merged_vids text List of mappings representing contact IDs that have been merged into the contact at hand. Format: :;: This field has replaced the `CONTACT_MERGE_AUDIT` table, which was deprecated by the Hubspot v3 CRM API.
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_deleted 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact is_contact_deleted 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust is_contact_deleted 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends is_contact_deleted 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_deleted]
    • Cleaning This column is likely used to determine the 'is_contact_deleted' field, though not explicitly shown in the provided SQL.
    • Output Columns:
      • is_contact_deleted: Likely transformed to determine if the contact is deleted
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, with a COALESCE function applied
    • Cleaning The column is cleaned by applying a COALESCE function to handle NULL values
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Cleaning The column is cleaned by coalescing with FALSE if it's null
    • Output Columns:
      • is_contact_deleted: Cleaned and mapped to the output
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, with a COALESCE function applied
    • Integration The column is used in the final SELECT statement
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE(is_contact_deleted, FALSE)
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function applied
    • Cleaning The COALESCE function is used to handle potentially null values
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function applied
    • Cleaning The column is cleaned by applying a default value of FALSE if it's NULL
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Cleaning The column is cleaned by using COALESCE to handle NULL values
    • Integration The column is used in the final SELECT statement
    • Output Columns:
      • is_contact_deleted: Cleaned and mapped to the output
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function to default to FALSE if null
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
17. model.hubspot.hubspot__email_event_print
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function applied
    • Cleaning The COALESCE function is used to replace NULL values with FALSE
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied to the output
    • Cleaning COALESCE is used to set a default value of FALSE if the column is NULL
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, with a COALESCE function to default to FALSE if null
    • Output Columns:
      • is_contact_deleted: Mapped with COALESCE(is_contact_deleted, FALSE)
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function applied
    • Cleaning The COALESCE function is used to set a default value of FALSE if the column is NULL
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[is_contact_deleted]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact _fivetran_synced 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends _fivetran_synced 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_synced]
    • Direct The column is directly copied with a cast to TIMESTAMP.
    • Output Columns:
      • _fivetran_synced: Directly mapped with a TIMESTAMP cast
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output column with the same name
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: The column is directly copied to the output '_fivetran_synced' column
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: It is directly mapped to the output column of the same name
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join operation between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output '_fivetran_synced' column
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct This column is directly copied from the input table to the output without any transformation.
    • Integration The column is implicitly used in the LEFT JOIN operation between the events_joined CTE and the contacts table.
    • Output Columns:
      • _fivetran_synced: This column is directly mapped to the '_fivetran_synced' column in the output.
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct This column is directly copied from the input table to the output without any transformation.
    • Integration This column is implicitly used in the LEFT JOIN operation between the events_joined CTE and the contacts table.
    • Output Columns:
      • _fivetran_synced: This column is directly mapped to the output '_fivetran_synced' column.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join operation between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output '_fivetran_synced' column
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output '_fivetran_synced' column
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the LEFT JOIN between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output '_fivetran_synced' column
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp id 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_id 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends contact_id 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:header 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:header
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[id]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_id: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with the contact_merge_audit CTE
    • Filtering Used in the WHERE clause to filter out merged contacts
    • Output Columns:
      • contact_id: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[contact_id]
    • Integration used as the key to join with contacts and engagements tables
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as the key to join with the events data
    • Output Columns:
      • contact_id: Directly copied to the output
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the contacts table
    • Output Columns:
      • contact_id: Directly copied to the output
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the final SELECT statement
    • Output Columns:
      • contact_id: Directly copied to the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the LEFT JOIN operation
    • Output Columns:
      • contact_id: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the LEFT JOIN operation
    • Output Columns:
      • contact_id: Directly copied to the output
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the final SELECT statement
    • Output Columns:
      • contact_id: Directly copied to the output
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the email events data
    • Output Columns:
      • contact_id: Directly copied to the output
17. model.hubspot.hubspot__email_event_print
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the email events data
    • Output Columns:
      • contact_id: Directly copied to the output
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied to the output without transformation
    • Integration Used as part of the LEFT JOIN operation
    • Output Columns:
      • contact_id: Directly copied to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the events data
    • Output Columns:
      • contact_id: Directly copied to the output
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the LEFT JOIN operation
    • Output Columns:
      • contact_id: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[contact_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_id: Directly copied to the output
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[contact_id]
    • Integration Used to join the email_sends table with the contact_list_member table
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_email 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact email 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust email 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts email 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->20. model.hubspot.hubspot__email_event_status_change:header 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->13. model.hubspot.hubspot__email_event_delivered:header 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->15. model.hubspot.hubspot__email_event_forward:header 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:header 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->12. model.hubspot.hubspot__email_event_deferred:header 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->14. model.hubspot.hubspot__email_event_dropped:header 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->16. model.hubspot.hubspot__email_event_opens:header 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->11. model.hubspot.hubspot__email_event_clicks:header 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->10. model.hubspot.hubspot__email_event_bounce:header 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->17. model.hubspot.hubspot__email_event_print:header 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->19. model.hubspot.hubspot__email_event_spam_report:header
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_email]
    • Direct The column is directly copied.
    • Output Columns:
      • email: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[email]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Direct The column is directly copied without any transformation
    • Integration Used to join with email metrics
    • Output Columns:
      • email: Directly copied
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with the events data
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with the recipient_email_address from the events table
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with recipient_email_address
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with recipient_email_address
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with recipient_email_address from the events table
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with events_joined.recipient_email_address
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as a key to join with the email events data
17. model.hubspot.hubspot__email_event_print
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with the recipient_email_address from the email events data
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration Used as the key to join with the recipient_email_address from the events table
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as a key to join with the events data
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with recipient_email_address from the events table
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_company 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_company 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_company 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts contact_company 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_company]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_company: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_company]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_company: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_company]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_company: Directly copied
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_firstname 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact first_name 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust first_name 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts first_name 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_firstname]
    • Direct The column is directly copied.
    • Output Columns:
      • first_name: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[first_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • first_name: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[first_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • first_name: Directly copied
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_lastname 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact last_name 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust last_name 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts last_name 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_lastname]
    • Direct The column is directly copied.
    • Output Columns:
      • last_name: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[last_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • last_name: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[last_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • last_name: Directly copied
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_created_at property_createdate 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact created_date 45. model.hubspot_source.stg_hubspot__contact_tmp:f1->38. model.hubspot_source.stg_hubspot__contact:f0 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust created_date 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts created_date 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_createdate]
    • Cleaning The column is cast to TIMESTAMP.
    • Output Columns:
      • created_date: Mapped with a TIMESTAMP cast
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_created_at]
    • Cleaning The column is cast to TIMESTAMP type
    • Output Columns:
      • created_date: This column is mapped to created_date after casting to TIMESTAMP
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[created_date]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • created_date: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[created_date]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • created_date: Directly copied
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_jobtitle 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact job_title 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust job_title 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts job_title 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_jobtitle]
    • Direct The column is directly copied.
    • Output Columns:
      • job_title: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[job_title]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • job_title: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[job_title]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • job_title: Directly copied
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_annualrevenue 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact company_annual_revenue 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust company_annual_revenue 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts company_annual_revenue 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_annualrevenue]
    • Cleaning The column is cast to INT type
    • Output Columns:
      • company_annual_revenue: This column is directly mapped to company_annual_revenue after casting
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[company_annual_revenue]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_annual_revenue: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[company_annual_revenue]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_annual_revenue: Directly copied
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_hs_calculated_merged_vids 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact calculated_merged_vids 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:header
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_hs_calculated_merged_vids]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • calculated_merged_vids: This column is directly mapped to calculated_merged_vids
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[calculated_merged_vids]
    • Featurization The column is split and flattened to extract merged contact IDs
    • Other Used to create the contact_merge_audit CTE
39. model.hubspot_source.stg_hubspot__contact_list

This SQL query stages data from a Hubspot contact list source table. It performs type casting on various fields, renames some columns for clarity, and transforms boolean fields into 'is_' prefixed columns. The query doesn't filter, deduplicate, or aggregate data, but primarily focuses on cleaning and standardizing the data format.

Cleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__contact_list_tmp
), macro AS (
  SELECT
    CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS BOOLEAN) AS deleteable,
    CAST(NULL AS BOOLEAN) AS dynamic,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS TEXT) AS metadata_error,
    CAST(NULL AS TIMESTAMP) AS metadata_last_processing_state_change_at,
    CAST(NULL AS TIMESTAMP) AS metadata_last_size_change_at,
    CAST(NULL AS TEXT) AS metadata_processing,
    CAST(NULL AS INT) AS metadata_size,
    CAST(NULL AS TEXT) AS name,
    CAST(NULL AS INT) AS portal_id,
    CAST(NULL AS TIMESTAMP) AS updated_at
  FROM base
), fields AS (
  SELECT
    _fivetran_deleted AS is_contact_list_deleted,
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    CAST(created_at AS TIMESTAMP) AS created_timestamp,
    deleteable AS is_deletable,
    dynamic AS is_dynamic,
    id AS contact_list_id,
    metadata_error,
    CAST(metadata_last_processing_state_change_at AS TIMESTAMP) AS metadata_last_processing_state_change_at,
    CAST(metadata_last_size_change_at AS TIMESTAMP) AS metadata_last_size_change_at,
    metadata_processing,
    metadata_size,
    name AS contact_list_name,
    portal_id,
    CAST(updated_at AS TIMESTAMP) AS updated_timestamp
  FROM macro
)
SELECT
  *
FROM fields
%3 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list is_contact_list_deleted _fivetran_synced contact_list_id contact_list_name created_timestamp is_deletable is_dynamic metadata_error metadata_last_processing_state_change_at metadata_last_size_change_at metadata_processing metadata_size portal_id updated_timestamp 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp id _fivetran_deleted _fivetran_synced created_at deleteable dynamic metadata_error metadata_last_processing_state_change_at metadata_last_size_change_at metadata_processing metadata_size portal_id updated_at name 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f2 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f1->39. model.hubspot_source.stg_hubspot__contact_list:f0 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f2->39. model.hubspot_source.stg_hubspot__contact_list:f1 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f3->39. model.hubspot_source.stg_hubspot__contact_list:f4 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f4->39. model.hubspot_source.stg_hubspot__contact_list:f5 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f5->39. model.hubspot_source.stg_hubspot__contact_list:f6 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f6->39. model.hubspot_source.stg_hubspot__contact_list:f7 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f7->39. model.hubspot_source.stg_hubspot__contact_list:f8 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f8->39. model.hubspot_source.stg_hubspot__contact_list:f9 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f9->39. model.hubspot_source.stg_hubspot__contact_list:f10 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f10->39. model.hubspot_source.stg_hubspot__contact_list:f11 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f11->39. model.hubspot_source.stg_hubspot__contact_list:f12 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f12->39. model.hubspot_source.stg_hubspot__contact_list:f13 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f13->39. model.hubspot_source.stg_hubspot__contact_list:f3
Name Type Comment
is_contact_list_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
contact_list_id integer The ID of the contact list.
contact_list_name text The name of the contact list.
created_timestamp timestamp without time zone A timestamp of the time the list was created.
is_deletable boolean If this is false, this is a system list and cannot be deleted.
is_dynamic boolean Whether the contact list is dynamic.
metadata_error integer Any errors that happened the last time the list was processed.
metadata_last_processing_state_change_at timestamp without time zone A timestamp of the last time that the processing state changed.
metadata_last_size_change_at timestamp without time zone A timestamp of the last time that the size of the list changed.
metadata_processing text One of DONE, REFRESHING, INITIALIZING, or PROCESSING. DONE indicates the list has finished processing, any other value indicates that list membership is being evaluated.
metadata_size integer The approximate number of contacts in the list.
portal_id integer The hub ID.
updated_timestamp timestamp without time zone A timestamp of the time that the list was last modified.
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp _fivetran_deleted 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list is_contact_list_deleted 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists is_contact_list_deleted 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[_fivetran_deleted]
    • Cleaning The column is renamed with an 'is_' prefix
    • Output Columns:
      • is_contact_list_deleted: Directly mapped after renaming
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[is_contact_list_deleted]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_contact_list_deleted: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp _fivetran_synced 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list _fivetran_synced 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists _fivetran_synced 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp id 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list contact_list_id 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists contact_list_id 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[id]
    • Cleaning The column is cast as INT and renamed
    • Output Columns:
      • contact_list_id: Directly mapped after casting
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[contact_list_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as the key to join with the email_metrics table
    • Output Columns:
      • contact_list_id: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp name 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list contact_list_name 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists contact_list_name 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[name]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • contact_list_name: Mapped after casting to TEXT and renamed
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[contact_list_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • contact_list_name: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp created_at 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list created_timestamp 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists created_timestamp 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[created_at]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • created_timestamp: Mapped after casting and renaming
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp deleteable 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list is_deletable 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists is_deletable 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[deleteable]
    • Cleaning The column is renamed with an 'is_' prefix
    • Output Columns:
      • is_deletable: Directly mapped after renaming
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[is_deletable]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_deletable: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp dynamic 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list is_dynamic 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists is_dynamic 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[dynamic]
    • Cleaning The column is renamed with an 'is_' prefix
    • Output Columns:
      • is_dynamic: Directly mapped after renaming
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[is_dynamic]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_dynamic: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp metadata_error 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list metadata_error 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists metadata_error 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[metadata_error]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • metadata_error: Directly mapped without changes
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[metadata_error]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • metadata_error: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp metadata_last_processing_state_change_at 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list metadata_last_processing_state_change_at 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists metadata_last_processing_state_change_at 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[metadata_last_processing_state_change_at]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • metadata_last_processing_state_change_at: Directly mapped after casting
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[metadata_last_processing_state_change_at]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • metadata_last_processing_state_change_at: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp metadata_last_size_change_at 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list metadata_last_size_change_at 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists metadata_last_size_change_at 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[metadata_last_size_change_at]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • metadata_last_size_change_at: Directly mapped after casting
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[metadata_last_size_change_at]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • metadata_last_size_change_at: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp metadata_processing 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list metadata_processing 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists metadata_processing 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[metadata_processing]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • metadata_processing: Directly mapped without changes
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[metadata_processing]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • metadata_processing: Directly copied to the output
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp metadata_size 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list metadata_size 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists metadata_size 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[metadata_size]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT
    • Output Columns:
      • metadata_size: Directly mapped after casting to INT
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[metadata_size]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • metadata_size: Directly copied to the output
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp portal_id 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list portal_id 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists portal_id 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[portal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT
    • Output Columns:
      • portal_id: Directly mapped after casting to INT
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[portal_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • portal_id: Directly copied to the output
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp updated_at 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list updated_timestamp 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists updated_timestamp 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[updated_at]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • updated_timestamp: Mapped after casting to TIMESTAMP and renamed
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[updated_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • updated_timestamp: Directly copied to the output
40. model.hubspot_source.stg_hubspot__contact_list_member

This SQL query performs data type casting and column renaming for the 'stg_hubspot__contact_list_member' model. It starts with a base CTE that selects all columns from a temporary table. Then, it defines a structure with NULL values and specific data types. Finally, it casts the columns to the desired data types and renames some columns before selecting all fields from the final CTE.

Cleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__contact_list_member_tmp
), macro AS (
  SELECT
    CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TIMESTAMP) AS added_at,
    CAST(NULL AS INT) AS contact_id,
    CAST(NULL AS INT) AS contact_list_id
  FROM base
), fields AS (
  SELECT
    _fivetran_deleted AS is_contact_list_member_deleted,
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    CAST(added_at AS TIMESTAMP) AS added_timestamp,
    contact_id,
    contact_list_id
  FROM macro
)
SELECT
  *
FROM fields
%3 40. model.hubspot_source.stg_hubspot__contact_list_member 40. model.hubspot_source.stg_hubspot__contact_list_member is_contact_list_member_deleted _fivetran_synced added_timestamp contact_id contact_list_id 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp contact_id contact_list_id _fivetran_deleted _fivetran_synced added_at 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp:f0->40. model.hubspot_source.stg_hubspot__contact_list_member:f3 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp:f1->40. model.hubspot_source.stg_hubspot__contact_list_member:f4 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp:f2->40. model.hubspot_source.stg_hubspot__contact_list_member:f0 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp:f3->40. model.hubspot_source.stg_hubspot__contact_list_member:f1 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp:f4->40. model.hubspot_source.stg_hubspot__contact_list_member:f2
Name Type Comment
is_contact_list_member_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
added_timestamp timestamp without time zone The timestamp a contact was added to a list.
contact_id integer The ID of the related contact.
contact_list_id integer The ID of the related contact list.
Column Lineage
%3 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp _fivetran_deleted 40. model.hubspot_source.stg_hubspot__contact_list_member 40. model.hubspot_source.stg_hubspot__contact_list_member is_contact_list_member_deleted 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp:f0->40. model.hubspot_source.stg_hubspot__contact_list_member:f0
40. model.hubspot_source.stg_hubspot__contact_list_member
  • Input Column: 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp[_fivetran_deleted]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as BOOLEAN in the macro CTE
    • Output Columns:
      • is_contact_list_member_deleted: Renamed and mapped after casting
Column Lineage
%3 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp _fivetran_synced 40. model.hubspot_source.stg_hubspot__contact_list_member 40. model.hubspot_source.stg_hubspot__contact_list_member _fivetran_synced 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp:f0->40. model.hubspot_source.stg_hubspot__contact_list_member:f0
40. model.hubspot_source.stg_hubspot__contact_list_member
  • Input Column: 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TIMESTAMP in both macro and fields CTEs
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
Column Lineage
%3 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp added_at 40. model.hubspot_source.stg_hubspot__contact_list_member 40. model.hubspot_source.stg_hubspot__contact_list_member added_timestamp 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp:f0->40. model.hubspot_source.stg_hubspot__contact_list_member:f0
40. model.hubspot_source.stg_hubspot__contact_list_member
  • Input Column: 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp[added_at]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TIMESTAMP in both macro and fields CTEs
    • Output Columns:
      • added_timestamp: Renamed and mapped after casting
Column Lineage
%3 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp contact_id 40. model.hubspot_source.stg_hubspot__contact_list_member 40. model.hubspot_source.stg_hubspot__contact_list_member contact_id 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp:f0->40. model.hubspot_source.stg_hubspot__contact_list_member:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 40. model.hubspot_source.stg_hubspot__contact_list_member:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:header
40. model.hubspot_source.stg_hubspot__contact_list_member
  • Input Column: 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp[contact_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT in the macro CTE
    • Output Columns:
      • contact_id: Directly mapped after casting
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 40. model.hubspot_source.stg_hubspot__contact_list_member[contact_id]
    • Integration This column is used as a key to join the email_sends table with the contact_list_member table.
Column Lineage
%3 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp contact_list_id 40. model.hubspot_source.stg_hubspot__contact_list_member 40. model.hubspot_source.stg_hubspot__contact_list_member contact_list_id 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp:f0->40. model.hubspot_source.stg_hubspot__contact_list_member:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list contact_list_id 40. model.hubspot_source.stg_hubspot__contact_list_member:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists contact_list_id 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
40. model.hubspot_source.stg_hubspot__contact_list_member
  • Input Column: 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp[contact_list_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT in the macro CTE
    • Output Columns:
      • contact_list_id: Directly mapped after casting
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 40. model.hubspot_source.stg_hubspot__contact_list_member[contact_list_id]
    • Integration This column is used in the LEFT JOIN operation to connect email sends with contact lists.
    • Filtering It's used in the WHERE clause to filter out null values.
    • Aggregation It's used in the GROUP BY clause to aggregate email metrics per contact list.
    • Output Columns:
      • contact_list_id: This column is directly copied to the output.
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[contact_list_id]
    • Integration Used as the key to join the contact_lists and email_metrics tables
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • contact_list_id: Directly copied
41. model.hubspot_source.stg_hubspot__contact_list_member_tmp

This SQL query selects all columns from the 'contact_list_member' table in the 'hubspot' schema of the 'TEST' database. The query appears to be a placeholder or template, as indicated by the comment suggesting that no columns were returned, possibly due to the relation not existing yet or all columns being excluded. The purpose seems to be setting up a staging table for Hubspot contact list member data.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.contact_list_member
%3 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp contact_id contact_list_id _fivetran_deleted _fivetran_synced added_at 114. source.hubspot_source.hubspot.contact_list_member 114. source.hubspot_source.hubspot.contact_list_member
Name Type Comment
contact_id integer None
contact_list_id integer None
_fivetran_deleted boolean None
_fivetran_synced text None
added_at text None
Column Lineage
%3 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp contact_id 40. model.hubspot_source.stg_hubspot__contact_list_member 40. model.hubspot_source.stg_hubspot__contact_list_member contact_id 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp:f0->40. model.hubspot_source.stg_hubspot__contact_list_member:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 40. model.hubspot_source.stg_hubspot__contact_list_member:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:header
40. model.hubspot_source.stg_hubspot__contact_list_member
  • Input Column: 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp[contact_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT in the macro CTE
    • Output Columns:
      • contact_id: Directly mapped after casting
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 40. model.hubspot_source.stg_hubspot__contact_list_member[contact_id]
    • Integration This column is used as a key to join the email_sends table with the contact_list_member table.
Column Lineage
%3 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp contact_list_id 40. model.hubspot_source.stg_hubspot__contact_list_member 40. model.hubspot_source.stg_hubspot__contact_list_member contact_list_id 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp:f0->40. model.hubspot_source.stg_hubspot__contact_list_member:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list contact_list_id 40. model.hubspot_source.stg_hubspot__contact_list_member:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists contact_list_id 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
40. model.hubspot_source.stg_hubspot__contact_list_member
  • Input Column: 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp[contact_list_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT in the macro CTE
    • Output Columns:
      • contact_list_id: Directly mapped after casting
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 40. model.hubspot_source.stg_hubspot__contact_list_member[contact_list_id]
    • Integration This column is used in the LEFT JOIN operation to connect email sends with contact lists.
    • Filtering It's used in the WHERE clause to filter out null values.
    • Aggregation It's used in the GROUP BY clause to aggregate email metrics per contact list.
    • Output Columns:
      • contact_list_id: This column is directly copied to the output.
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[contact_list_id]
    • Integration Used as the key to join the contact_lists and email_metrics tables
    • Direct Directly copied to the output without transformation
    • Output Columns:
      • contact_list_id: Directly copied
Column Lineage
%3 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp _fivetran_deleted 40. model.hubspot_source.stg_hubspot__contact_list_member 40. model.hubspot_source.stg_hubspot__contact_list_member is_contact_list_member_deleted 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp:f0->40. model.hubspot_source.stg_hubspot__contact_list_member:f0
40. model.hubspot_source.stg_hubspot__contact_list_member
  • Input Column: 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp[_fivetran_deleted]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as BOOLEAN in the macro CTE
    • Output Columns:
      • is_contact_list_member_deleted: Renamed and mapped after casting
Column Lineage
%3 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp _fivetran_synced 40. model.hubspot_source.stg_hubspot__contact_list_member 40. model.hubspot_source.stg_hubspot__contact_list_member _fivetran_synced 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp:f0->40. model.hubspot_source.stg_hubspot__contact_list_member:f0
40. model.hubspot_source.stg_hubspot__contact_list_member
  • Input Column: 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TIMESTAMP in both macro and fields CTEs
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
Column Lineage
%3 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp added_at 40. model.hubspot_source.stg_hubspot__contact_list_member 40. model.hubspot_source.stg_hubspot__contact_list_member added_timestamp 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp:f0->40. model.hubspot_source.stg_hubspot__contact_list_member:f0
40. model.hubspot_source.stg_hubspot__contact_list_member
  • Input Column: 41. model.hubspot_source.stg_hubspot__contact_list_member_tmp[added_at]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TIMESTAMP in both macro and fields CTEs
    • Output Columns:
      • added_timestamp: Renamed and mapped after casting
42. model.hubspot_source.stg_hubspot__contact_list_tmp

This SQL query is a simple SELECT statement that retrieves all columns from the TEST.hubspot.contact_list table. The comment suggests that no columns were returned, possibly because the relation doesn't exist yet or all columns were excluded. The query is likely a placeholder or template for future development.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.contact_list
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp id _fivetran_deleted _fivetran_synced created_at deleteable dynamic metadata_error metadata_last_processing_state_change_at metadata_last_size_change_at metadata_processing metadata_size offset portal_id updated_at name 113. source.hubspot_source.hubspot.contact_list 113. source.hubspot_source.hubspot.contact_list
Name Type Comment
id integer None
_fivetran_deleted boolean None
_fivetran_synced text None
created_at text None
deleteable boolean None
dynamic boolean None
metadata_error integer None
metadata_last_processing_state_change_at text None
metadata_last_size_change_at text None
metadata_processing text None
metadata_size integer None
offset integer None
portal_id integer None
updated_at text None
name text None
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp id 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list contact_list_id 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists contact_list_id 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[id]
    • Cleaning The column is cast as INT and renamed
    • Output Columns:
      • contact_list_id: Directly mapped after casting
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[contact_list_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as the key to join with the email_metrics table
    • Output Columns:
      • contact_list_id: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp _fivetran_deleted 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list is_contact_list_deleted 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists is_contact_list_deleted 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[_fivetran_deleted]
    • Cleaning The column is renamed with an 'is_' prefix
    • Output Columns:
      • is_contact_list_deleted: Directly mapped after renaming
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[is_contact_list_deleted]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_contact_list_deleted: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp _fivetran_synced 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list _fivetran_synced 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists _fivetran_synced 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp created_at 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list created_timestamp 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists created_timestamp 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[created_at]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • created_timestamp: Mapped after casting and renaming
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp deleteable 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list is_deletable 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists is_deletable 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[deleteable]
    • Cleaning The column is renamed with an 'is_' prefix
    • Output Columns:
      • is_deletable: Directly mapped after renaming
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[is_deletable]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_deletable: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp dynamic 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list is_dynamic 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists is_dynamic 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[dynamic]
    • Cleaning The column is renamed with an 'is_' prefix
    • Output Columns:
      • is_dynamic: Directly mapped after renaming
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[is_dynamic]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_dynamic: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp metadata_error 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list metadata_error 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists metadata_error 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[metadata_error]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • metadata_error: Directly mapped without changes
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[metadata_error]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • metadata_error: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp metadata_last_processing_state_change_at 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list metadata_last_processing_state_change_at 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists metadata_last_processing_state_change_at 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[metadata_last_processing_state_change_at]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • metadata_last_processing_state_change_at: Directly mapped after casting
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[metadata_last_processing_state_change_at]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • metadata_last_processing_state_change_at: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp metadata_last_size_change_at 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list metadata_last_size_change_at 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists metadata_last_size_change_at 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[metadata_last_size_change_at]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • metadata_last_size_change_at: Directly mapped after casting
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[metadata_last_size_change_at]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • metadata_last_size_change_at: Directly mapped
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp metadata_processing 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list metadata_processing 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists metadata_processing 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[metadata_processing]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • metadata_processing: Directly mapped without changes
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[metadata_processing]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • metadata_processing: Directly copied to the output
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp metadata_size 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list metadata_size 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists metadata_size 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[metadata_size]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT
    • Output Columns:
      • metadata_size: Directly mapped after casting to INT
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[metadata_size]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • metadata_size: Directly copied to the output
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp portal_id 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list portal_id 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists portal_id 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[portal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT
    • Output Columns:
      • portal_id: Directly mapped after casting to INT
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[portal_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • portal_id: Directly copied to the output
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp updated_at 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list updated_timestamp 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists updated_timestamp 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[updated_at]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • updated_timestamp: Mapped after casting to TIMESTAMP and renamed
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[updated_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • updated_timestamp: Directly copied to the output
Column Lineage
%3 42. model.hubspot_source.stg_hubspot__contact_list_tmp 42. model.hubspot_source.stg_hubspot__contact_list_tmp name 39. model.hubspot_source.stg_hubspot__contact_list 39. model.hubspot_source.stg_hubspot__contact_list contact_list_name 42. model.hubspot_source.stg_hubspot__contact_list_tmp:f0->39. model.hubspot_source.stg_hubspot__contact_list:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists contact_list_name 39. model.hubspot_source.stg_hubspot__contact_list:f0->4. model.hubspot.hubspot__contact_lists:f0
39. model.hubspot_source.stg_hubspot__contact_list
  • Input Column: 42. model.hubspot_source.stg_hubspot__contact_list_tmp[name]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • contact_list_name: Mapped after casting to TEXT and renamed
4. model.hubspot.hubspot__contact_lists
  • Input Column: 39. model.hubspot_source.stg_hubspot__contact_list[contact_list_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • contact_list_name: Directly mapped
43. model.hubspot_source.stg_hubspot__contact_property_history

This SQL query is primarily focused on data cleaning and standardization. It starts by selecting all columns from a temporary staging table, then creates a macro CTE with NULL values to define the structure. The fields CTE then casts and renames columns to ensure proper data types and consistent naming conventions. The final SELECT statement returns all columns from the fields CTE.

Cleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__contact_property_history_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS contact_id,
    CAST(NULL AS TEXT) AS name,
    CAST(NULL AS TEXT) AS source,
    CAST(NULL AS TEXT) AS source_id,
    CAST(NULL AS TIMESTAMP) AS change_timestamp,
    CAST(NULL AS TEXT) AS value
  FROM base
), fields AS (
  SELECT
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    contact_id,
    name AS field_name,
    source AS change_source,
    source_id AS change_source_id,
    CAST(change_timestamp AS TIMESTAMP) AS change_timestamp, /* source field name = timestamp ; alias declared in macros/get_contact_property_history_columns.sql */
    value AS new_value
  FROM macro
)
SELECT
  *
FROM fields
%3 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history _fivetran_synced change_source change_source_id change_timestamp contact_id field_name new_value 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp contact_id timestamp _fivetran_synced source name value source_id 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f4 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f1->43. model.hubspot_source.stg_hubspot__contact_property_history:f3 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f2->43. model.hubspot_source.stg_hubspot__contact_property_history:f0 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f3->43. model.hubspot_source.stg_hubspot__contact_property_history:f1 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f4->43. model.hubspot_source.stg_hubspot__contact_property_history:f5 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f5->43. model.hubspot_source.stg_hubspot__contact_property_history:f6 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f6->43. model.hubspot_source.stg_hubspot__contact_property_history:f2
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
change_source text The source (reason) of the change.
change_source_id text The ID of the object that caused the change, if applicable.
change_timestamp timestamp without time zone The timestamp the changed occurred.
contact_id integer The ID of the related contact record.
field_name text The name of the field being changed.
new_value text The new value of the field.
Column Lineage
%3 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp _fivetran_synced 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history _fivetran_synced 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[_fivetran_synced]
    • Cleaning The column is cleaned by casting to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Casted to TIMESTAMP
Column Lineage
%3 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp source 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history change_source 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history change_source 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source: Directly copied and renamed
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[change_source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source: Directly copied
Column Lineage
%3 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp source_id 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history change_source_id 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history change_source_id 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[source_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source_id: Directly copied and renamed
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[change_source_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source_id: Directly copied
Column Lineage
%3 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp timestamp 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history change_timestamp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history valid_from valid_to 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f1
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[timestamp]
    • Cleaning The column is cleaned by casting to TIMESTAMP data type
    • Output Columns:
      • change_timestamp: Casted to TIMESTAMP and renamed
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[change_timestamp]
    • Direct The column is directly copied as valid_from
    • Other Used to calculate the valid_to timestamp for each record
    • Deduplication Used in the PARTITION BY and ORDER BY clauses of the window function
    • Output Columns:
      • valid_from: Directly copied
      • valid_to: Used in LEAD function to calculate the next change timestamp
Column Lineage
%3 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp contact_id 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history contact_id 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history contact_id id 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f1
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[contact_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_id: Directly copied
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[contact_id]
    • Direct The column is directly copied without any transformation
    • Deduplication Used in the PARTITION BY clause of the window function
    • Other Used in the surrogate key generation
    • Output Columns:
      • contact_id: Directly copied
      • id: Part of the MD5 hash for the surrogate key
Column Lineage
%3 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp name 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history field_name 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history field_name id 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f1
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • field_name: Directly copied and renamed
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[field_name]
    • Direct The column is directly copied without any transformation
    • Deduplication Used in the PARTITION BY clause of the window function
    • Other Used in the surrogate key generation
    • Output Columns:
      • field_name: Directly copied
      • id: Part of the MD5 hash for the surrogate key
Column Lineage
%3 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp value 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history new_value 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history new_value 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[value]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • new_value: Directly copied and renamed
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[new_value]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • new_value: Directly copied
44. model.hubspot_source.stg_hubspot__contact_property_history_tmp

This SQL query is a simple SELECT statement that retrieves all columns from the 'contact_property_history' table in the 'hubspot' schema of the 'TEST' database. The query does not perform any filtering, transformation, or aggregation of the data. It's a straightforward extraction of all available data from the specified table.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.contact_property_history
%3 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp contact_id timestamp _fivetran_synced source name value source_id 115. source.hubspot_source.hubspot.contact_property_history 115. source.hubspot_source.hubspot.contact_property_history
Name Type Comment
contact_id integer None
timestamp text None
_fivetran_synced text None
source text None
name text None
value text None
source_id text None
Column Lineage
%3 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp contact_id 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history contact_id 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history contact_id id 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f1
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[contact_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_id: Directly copied
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[contact_id]
    • Direct The column is directly copied without any transformation
    • Deduplication Used in the PARTITION BY clause of the window function
    • Other Used in the surrogate key generation
    • Output Columns:
      • contact_id: Directly copied
      • id: Part of the MD5 hash for the surrogate key
Column Lineage
%3 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp timestamp 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history change_timestamp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history valid_from valid_to 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f1
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[timestamp]
    • Cleaning The column is cleaned by casting to TIMESTAMP data type
    • Output Columns:
      • change_timestamp: Casted to TIMESTAMP and renamed
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[change_timestamp]
    • Direct The column is directly copied as valid_from
    • Other Used to calculate the valid_to timestamp for each record
    • Deduplication Used in the PARTITION BY and ORDER BY clauses of the window function
    • Output Columns:
      • valid_from: Directly copied
      • valid_to: Used in LEAD function to calculate the next change timestamp
Column Lineage
%3 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp _fivetran_synced 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history _fivetran_synced 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[_fivetran_synced]
    • Cleaning The column is cleaned by casting to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Casted to TIMESTAMP
Column Lineage
%3 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp source 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history change_source 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history change_source 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source: Directly copied and renamed
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[change_source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source: Directly copied
Column Lineage
%3 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp name 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history field_name 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history field_name id 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f1
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • field_name: Directly copied and renamed
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[field_name]
    • Direct The column is directly copied without any transformation
    • Deduplication Used in the PARTITION BY clause of the window function
    • Other Used in the surrogate key generation
    • Output Columns:
      • field_name: Directly copied
      • id: Part of the MD5 hash for the surrogate key
Column Lineage
%3 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp value 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history new_value 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history new_value 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[value]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • new_value: Directly copied and renamed
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[new_value]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • new_value: Directly copied
Column Lineage
%3 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp source_id 43. model.hubspot_source.stg_hubspot__contact_property_history 43. model.hubspot_source.stg_hubspot__contact_property_history change_source_id 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp:f0->43. model.hubspot_source.stg_hubspot__contact_property_history:f0 3. model.hubspot.hubspot__contact_history 3. model.hubspot.hubspot__contact_history change_source_id 43. model.hubspot_source.stg_hubspot__contact_property_history:f0->3. model.hubspot.hubspot__contact_history:f0
43. model.hubspot_source.stg_hubspot__contact_property_history
  • Input Column: 44. model.hubspot_source.stg_hubspot__contact_property_history_tmp[source_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source_id: Directly copied and renamed
3. model.hubspot.hubspot__contact_history
  • Input Column: 43. model.hubspot_source.stg_hubspot__contact_property_history[change_source_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source_id: Directly copied
45. model.hubspot_source.stg_hubspot__contact_tmp

This SQL query selects all columns from the 'contact' table in the 'hubspot' schema of the 'TEST' database. The comment suggests that this query is part of a dbt model and is designed to create a temporary staging table for Hubspot contact data. The query itself is simple and doesn't perform any transformations or filtering on the data.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.contact
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_deleted _fivetran_synced property_email id property_company property_firstname property_lastname property_email_1 property_createdate property_jobtitle property_annualrevenue property_hs_calculated_merged_vids property_created_at 112. source.hubspot_source.hubspot.contact 112. source.hubspot_source.hubspot.contact
Name Type Comment
_fivetran_deleted boolean None
_fivetran_synced timestamp without time zone None
property_email text None
id integer None
property_company text None
property_firstname text None
property_lastname text None
property_email_1 text None
property_createdate timestamp without time zone None
property_jobtitle integer None
property_annualrevenue integer None
property_hs_calculated_merged_vids text None
property_created_at timestamp without time zone None
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_deleted 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact is_contact_deleted 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust is_contact_deleted 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report is_contact_deleted 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends is_contact_deleted 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_deleted]
    • Cleaning This column is likely used to determine the 'is_contact_deleted' field, though not explicitly shown in the provided SQL.
    • Output Columns:
      • is_contact_deleted: Likely transformed to determine if the contact is deleted
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, with a COALESCE function applied
    • Cleaning The column is cleaned by applying a COALESCE function to handle NULL values
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Cleaning The column is cleaned by coalescing with FALSE if it's null
    • Output Columns:
      • is_contact_deleted: Cleaned and mapped to the output
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, with a COALESCE function applied
    • Integration The column is used in the final SELECT statement
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE(is_contact_deleted, FALSE)
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function applied
    • Cleaning The COALESCE function is used to handle potentially null values
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function applied
    • Cleaning The column is cleaned by applying a default value of FALSE if it's NULL
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Cleaning The column is cleaned by using COALESCE to handle NULL values
    • Integration The column is used in the final SELECT statement
    • Output Columns:
      • is_contact_deleted: Cleaned and mapped to the output
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function to default to FALSE if null
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
17. model.hubspot.hubspot__email_event_print
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function applied
    • Cleaning The COALESCE function is used to replace NULL values with FALSE
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied to the output
    • Cleaning COALESCE is used to set a default value of FALSE if the column is NULL
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, with a COALESCE function to default to FALSE if null
    • Output Columns:
      • is_contact_deleted: Mapped with COALESCE(is_contact_deleted, FALSE)
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[is_contact_deleted]
    • Direct The column is directly copied, but with a COALESCE function applied
    • Cleaning The COALESCE function is used to set a default value of FALSE if the column is NULL
    • Output Columns:
      • is_contact_deleted: Copied to the output with COALESCE applied
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[is_contact_deleted]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_contact_deleted: Directly copied
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact _fivetran_synced 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust _fivetran_synced 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report _fivetran_synced 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends _fivetran_synced 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[_fivetran_synced]
    • Direct The column is directly copied with a cast to TIMESTAMP.
    • Output Columns:
      • _fivetran_synced: Directly mapped with a TIMESTAMP cast
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output column with the same name
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: The column is directly copied to the output '_fivetran_synced' column
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: It is directly mapped to the output column of the same name
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join operation between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output '_fivetran_synced' column
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct This column is directly copied from the input table to the output without any transformation.
    • Integration The column is implicitly used in the LEFT JOIN operation between the events_joined CTE and the contacts table.
    • Output Columns:
      • _fivetran_synced: This column is directly mapped to the '_fivetran_synced' column in the output.
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct This column is directly copied from the input table to the output without any transformation.
    • Integration This column is implicitly used in the LEFT JOIN operation between the events_joined CTE and the contacts table.
    • Output Columns:
      • _fivetran_synced: This column is directly mapped to the output '_fivetran_synced' column.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join operation between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output '_fivetran_synced' column
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output '_fivetran_synced' column
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the LEFT JOIN between the contacts table and the events_joined CTE
    • Output Columns:
      • _fivetran_synced: It is directly copied to the output '_fivetran_synced' column
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_email 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact email 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust email 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts email 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->20. model.hubspot.hubspot__email_event_status_change:header 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->13. model.hubspot.hubspot__email_event_delivered:header 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->15. model.hubspot.hubspot__email_event_forward:header 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:header 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->12. model.hubspot.hubspot__email_event_deferred:header 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->14. model.hubspot.hubspot__email_event_dropped:header 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->16. model.hubspot.hubspot__email_event_opens:header 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->11. model.hubspot.hubspot__email_event_clicks:header 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->10. model.hubspot.hubspot__email_event_bounce:header 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->17. model.hubspot.hubspot__email_event_print:header 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->19. model.hubspot.hubspot__email_event_spam_report:header
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_email]
    • Direct The column is directly copied.
    • Output Columns:
      • email: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[email]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Direct The column is directly copied without any transformation
    • Integration Used to join with email metrics
    • Output Columns:
      • email: Directly copied
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with the events data
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with the recipient_email_address from the events table
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with recipient_email_address
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with recipient_email_address
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with recipient_email_address from the events table
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with events_joined.recipient_email_address
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as a key to join with the email events data
17. model.hubspot.hubspot__email_event_print
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with the recipient_email_address from the email events data
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration Used as the key to join with the recipient_email_address from the events table
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as a key to join with the events data
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[email]
    • Integration The column is used as the key to join with recipient_email_address from the events table
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp id 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_id 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_id 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report contact_id 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends contact_id 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:header 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 21. model.hubspot.hubspot__email_sends:f0->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:header
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[id]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_id: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with the contact_merge_audit CTE
    • Filtering Used in the WHERE clause to filter out merged contacts
    • Output Columns:
      • contact_id: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[contact_id]
    • Integration used as the key to join with contacts and engagements tables
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as the key to join with the events data
    • Output Columns:
      • contact_id: Directly copied to the output
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the contacts table
    • Output Columns:
      • contact_id: Directly copied to the output
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the final SELECT statement
    • Output Columns:
      • contact_id: Directly copied to the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the LEFT JOIN operation
    • Output Columns:
      • contact_id: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the LEFT JOIN operation
    • Output Columns:
      • contact_id: Directly copied to the output
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the final SELECT statement
    • Output Columns:
      • contact_id: Directly copied to the output
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the email events data
    • Output Columns:
      • contact_id: Directly copied to the output
17. model.hubspot.hubspot__email_event_print
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the email events data
    • Output Columns:
      • contact_id: Directly copied to the output
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied to the output without transformation
    • Integration Used as part of the LEFT JOIN operation
    • Output Columns:
      • contact_id: Directly copied to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the events data
    • Output Columns:
      • contact_id: Directly copied to the output
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the LEFT JOIN operation
    • Output Columns:
      • contact_id: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[contact_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_id: Directly copied to the output
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[contact_id]
    • Integration Used to join the email_sends table with the contact_list_member table
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_company 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact contact_company 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust contact_company 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts contact_company 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_company]
    • Direct The column is directly copied.
    • Output Columns:
      • contact_company: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[contact_company]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_company: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[contact_company]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_company: Directly copied
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_firstname 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact first_name 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust first_name 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts first_name 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_firstname]
    • Direct The column is directly copied.
    • Output Columns:
      • first_name: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[first_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • first_name: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[first_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • first_name: Directly copied
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_lastname 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact last_name 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust last_name 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts last_name 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_lastname]
    • Direct The column is directly copied.
    • Output Columns:
      • last_name: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[last_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • last_name: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[last_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • last_name: Directly copied
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_createdate 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact created_date 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust created_date 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts created_date 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_createdate]
    • Cleaning The column is cast to TIMESTAMP.
    • Output Columns:
      • created_date: Mapped with a TIMESTAMP cast
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[created_date]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • created_date: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[created_date]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • created_date: Directly copied
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_jobtitle 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact job_title 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust job_title 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts job_title 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_jobtitle]
    • Direct The column is directly copied.
    • Output Columns:
      • job_title: Directly mapped
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[job_title]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • job_title: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[job_title]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • job_title: Directly copied
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_annualrevenue 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact company_annual_revenue 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust company_annual_revenue 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts company_annual_revenue 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_annualrevenue]
    • Cleaning The column is cast to INT type
    • Output Columns:
      • company_annual_revenue: This column is directly mapped to company_annual_revenue after casting
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[company_annual_revenue]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_annual_revenue: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[company_annual_revenue]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_annual_revenue: Directly copied
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_hs_calculated_merged_vids 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact calculated_merged_vids 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:header
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_hs_calculated_merged_vids]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • calculated_merged_vids: This column is directly mapped to calculated_merged_vids
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[calculated_merged_vids]
    • Featurization The column is split and flattened to extract merged contact IDs
    • Other Used to create the contact_merge_audit CTE
Column Lineage
%3 45. model.hubspot_source.stg_hubspot__contact_tmp 45. model.hubspot_source.stg_hubspot__contact_tmp property_created_at 38. model.hubspot_source.stg_hubspot__contact 38. model.hubspot_source.stg_hubspot__contact created_date 45. model.hubspot_source.stg_hubspot__contact_tmp:f0->38. model.hubspot_source.stg_hubspot__contact:f0 28. model.hubspot.int_hubspot__contact_merge_adjust 28. model.hubspot.int_hubspot__contact_merge_adjust created_date 38. model.hubspot_source.stg_hubspot__contact:f0->28. model.hubspot.int_hubspot__contact_merge_adjust:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts created_date 28. model.hubspot.int_hubspot__contact_merge_adjust:f0->5. model.hubspot.hubspot__contacts:f0
38. model.hubspot_source.stg_hubspot__contact
  • Input Column: 45. model.hubspot_source.stg_hubspot__contact_tmp[property_created_at]
    • Cleaning The column is cast to TIMESTAMP type
    • Output Columns:
      • created_date: This column is mapped to created_date after casting to TIMESTAMP
28. model.hubspot.int_hubspot__contact_merge_adjust
  • Input Column: 38. model.hubspot_source.stg_hubspot__contact[created_date]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • created_date: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 28. model.hubspot.int_hubspot__contact_merge_adjust[created_date]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • created_date: Directly copied
46. model.hubspot_source.stg_hubspot__deal

This SQL query is primarily focused on data cleaning and type casting for a HubSpot deals staging model. It starts with a base CTE that selects all columns from a temporary table. Then, it defines a macro CTE that sets up null values with specific data types for each column. The fields CTE then casts various columns to their appropriate data types and selects specific columns from the macro CTE. Finally, it joins the fields back to themselves (which effectively just selects all columns from the fields CTE) and returns the result.

Cleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS deal_id,
    CAST(NULL AS TEXT) AS deal_pipeline_id,
    CAST(NULL AS TEXT) AS deal_pipeline_stage_id,
    CAST(NULL AS BOOLEAN) AS is_deal_deleted,
    CAST(NULL AS INT) AS owner_id,
    CAST(NULL AS INT) AS portal_id,
    CAST(NULL AS TEXT) AS deal_name,
    CAST(NULL AS TEXT) AS description,
    CAST(NULL AS INT) AS amount,
    CAST(NULL AS TIMESTAMP) AS closed_date,
    CAST(NULL AS TIMESTAMP) AS created_date
  FROM base
), fields AS (
  SELECT
    deal_name, /* just default columns + explicitly configured passthrough columns */ /* a few columns below are aliased within the macros/get_deal_columns.sql macro */
    CAST(closed_date AS TIMESTAMP) AS closed_date,
    CAST(created_date AS TIMESTAMP) AS created_date,
    is_deal_deleted,
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    deal_id,
    CAST(deal_pipeline_id AS TEXT) AS deal_pipeline_id,
    CAST(deal_pipeline_stage_id AS TEXT) AS deal_pipeline_stage_id,
    owner_id,
    portal_id,
    description,
    amount
  /* The below macro adds the fields defined within your hubspot__deal_pass_through_columns variable into the staging model */ /* The below macro add the ability to create calculated fields using the hubspot__deal_calculated_fields variable. */
  FROM macro
), joined AS (
  SELECT
    fields.*
  FROM fields
)
SELECT
  *
FROM joined
%3 46. model.hubspot_source.stg_hubspot__deal 46. model.hubspot_source.stg_hubspot__deal is_deal_deleted _fivetran_synced deal_id portal_id deal_pipeline_id deal_pipeline_stage_id owner_id deal_name description amount closed_date created_date 59. model.hubspot_source.stg_hubspot__deal_tmp 59. model.hubspot_source.stg_hubspot__deal_tmp deal_id owner_id deal_pipeline_id deal_pipeline_stage_id is_deleted 59. model.hubspot_source.stg_hubspot__deal_tmp:f0->46. model.hubspot_source.stg_hubspot__deal:f2 59. model.hubspot_source.stg_hubspot__deal_tmp:f1->46. model.hubspot_source.stg_hubspot__deal:f6 59. model.hubspot_source.stg_hubspot__deal_tmp:f2->46. model.hubspot_source.stg_hubspot__deal:f4 59. model.hubspot_source.stg_hubspot__deal_tmp:f3->46. model.hubspot_source.stg_hubspot__deal:f5 59. model.hubspot_source.stg_hubspot__deal_tmp:f4->46. model.hubspot_source.stg_hubspot__deal:f0
Name Type Comment
is_deal_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
deal_id bigint The ID of the deal
portal_id integer The hub ID.
deal_pipeline_id text The ID of the deal's pipeline.
deal_pipeline_stage_id text The ID of the deal's pipeline stage.
owner_id bigint The ID of the deal's owner.
deal_name text The name you have given this deal.
description text A brief description of the deal.
amount integer The total value of the deal in the deal's currency.
closed_date timestamp without time zone The day the deal is expected to close, or was closed.
created_date timestamp without time zone The date the deal was created. This property is set automatically by HubSpot.
Column Lineage
%3 59. model.hubspot_source.stg_hubspot__deal_tmp 59. model.hubspot_source.stg_hubspot__deal_tmp is_deleted 46. model.hubspot_source.stg_hubspot__deal 46. model.hubspot_source.stg_hubspot__deal is_deal_deleted 59. model.hubspot_source.stg_hubspot__deal_tmp:f0->46. model.hubspot_source.stg_hubspot__deal:f0
46. model.hubspot_source.stg_hubspot__deal
  • Input Column: 59. model.hubspot_source.stg_hubspot__deal_tmp[is_deleted]
    • Direct The is_deleted column is directly copied
    • Cleaning The column is renamed to is_deal_deleted and cast as BOOLEAN
    • Output Columns:
      • is_deal_deleted: Mapped after renaming and casting to BOOLEAN
Column Lineage
%3 59. model.hubspot_source.stg_hubspot__deal_tmp 59. model.hubspot_source.stg_hubspot__deal_tmp deal_id 46. model.hubspot_source.stg_hubspot__deal 46. model.hubspot_source.stg_hubspot__deal deal_id 59. model.hubspot_source.stg_hubspot__deal_tmp:f0->46. model.hubspot_source.stg_hubspot__deal:f0
46. model.hubspot_source.stg_hubspot__deal
  • Input Column: 59. model.hubspot_source.stg_hubspot__deal_tmp[deal_id]
    • Direct The deal_id is directly copied without any transformation
    • Cleaning The deal_id is cast as INT
    • Output Columns:
      • deal_id: Directly mapped after casting to INT
Column Lineage
%3 59. model.hubspot_source.stg_hubspot__deal_tmp 59. model.hubspot_source.stg_hubspot__deal_tmp deal_pipeline_id 46. model.hubspot_source.stg_hubspot__deal 46. model.hubspot_source.stg_hubspot__deal deal_pipeline_id 59. model.hubspot_source.stg_hubspot__deal_tmp:f0->46. model.hubspot_source.stg_hubspot__deal:f0
46. model.hubspot_source.stg_hubspot__deal
  • Input Column: 59. model.hubspot_source.stg_hubspot__deal_tmp[deal_pipeline_id]
    • Direct The deal_pipeline_id is directly copied without any transformation
    • Cleaning The deal_pipeline_id is cast as TEXT
    • Output Columns:
      • deal_pipeline_id: Directly mapped after casting to TEXT
Column Lineage
%3 59. model.hubspot_source.stg_hubspot__deal_tmp 59. model.hubspot_source.stg_hubspot__deal_tmp deal_pipeline_stage_id 46. model.hubspot_source.stg_hubspot__deal 46. model.hubspot_source.stg_hubspot__deal deal_pipeline_stage_id 59. model.hubspot_source.stg_hubspot__deal_tmp:f0->46. model.hubspot_source.stg_hubspot__deal:f0
46. model.hubspot_source.stg_hubspot__deal
  • Input Column: 59. model.hubspot_source.stg_hubspot__deal_tmp[deal_pipeline_stage_id]
    • Direct The deal_pipeline_stage_id is directly copied without any transformation
    • Cleaning The deal_pipeline_stage_id is cast as TEXT
    • Output Columns:
      • deal_pipeline_stage_id: Directly mapped after casting to TEXT
Column Lineage
%3 59. model.hubspot_source.stg_hubspot__deal_tmp 59. model.hubspot_source.stg_hubspot__deal_tmp owner_id 46. model.hubspot_source.stg_hubspot__deal 46. model.hubspot_source.stg_hubspot__deal owner_id 59. model.hubspot_source.stg_hubspot__deal_tmp:f0->46. model.hubspot_source.stg_hubspot__deal:f0
46. model.hubspot_source.stg_hubspot__deal
  • Input Column: 59. model.hubspot_source.stg_hubspot__deal_tmp[owner_id]
    • Direct The owner_id is directly copied without any transformation
    • Cleaning The owner_id is cast as INT
    • Output Columns:
      • owner_id: Directly mapped after casting to INT
47. model.hubspot_source.stg_hubspot__deal_company

This SQL query creates a staging table for Hubspot deal-company associations. It starts with a base table, then creates a macro CTE to define the structure and data types of the fields. Finally, it selects and casts the fields from the macro CTE to create the final output. The query primarily focuses on data type standardization and structure definition.

Cleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal_company_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS deal_id,
    CAST(NULL AS INT) AS company_id,
    CAST(NULL AS INT) AS type_id
  FROM base
), fields AS (
  SELECT
    company_id,
    deal_id,
    type_id,
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced
  FROM macro
)
SELECT
  *
FROM fields
%3 47. model.hubspot_source.stg_hubspot__deal_company 47. model.hubspot_source.stg_hubspot__deal_company company_id deal_id type_id _fivetran_synced 48. model.hubspot_source.stg_hubspot__deal_company_tmp 48. model.hubspot_source.stg_hubspot__deal_company_tmp company_id deal_id type_id 48. model.hubspot_source.stg_hubspot__deal_company_tmp:f0->47. model.hubspot_source.stg_hubspot__deal_company:f0 48. model.hubspot_source.stg_hubspot__deal_company_tmp:f1->47. model.hubspot_source.stg_hubspot__deal_company:f1 48. model.hubspot_source.stg_hubspot__deal_company_tmp:f2->47. model.hubspot_source.stg_hubspot__deal_company:f2
Name Type Comment
company_id integer The ID of the company.
deal_id integer The ID of the deal.
type_id integer The ID of the type.
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
Column Lineage
%3 48. model.hubspot_source.stg_hubspot__deal_company_tmp 48. model.hubspot_source.stg_hubspot__deal_company_tmp company_id 47. model.hubspot_source.stg_hubspot__deal_company 47. model.hubspot_source.stg_hubspot__deal_company company_id 48. model.hubspot_source.stg_hubspot__deal_company_tmp:f0->47. model.hubspot_source.stg_hubspot__deal_company:f0
47. model.hubspot_source.stg_hubspot__deal_company
  • Input Column: 48. model.hubspot_source.stg_hubspot__deal_company_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT in the macro CTE
    • Output Columns:
      • company_id: Directly copied after casting to INT
Column Lineage
%3 48. model.hubspot_source.stg_hubspot__deal_company_tmp 48. model.hubspot_source.stg_hubspot__deal_company_tmp deal_id 47. model.hubspot_source.stg_hubspot__deal_company 47. model.hubspot_source.stg_hubspot__deal_company deal_id 48. model.hubspot_source.stg_hubspot__deal_company_tmp:f0->47. model.hubspot_source.stg_hubspot__deal_company:f0
47. model.hubspot_source.stg_hubspot__deal_company
  • Input Column: 48. model.hubspot_source.stg_hubspot__deal_company_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT in the macro CTE
    • Output Columns:
      • deal_id: Directly copied after casting to INT
Column Lineage
%3 48. model.hubspot_source.stg_hubspot__deal_company_tmp 48. model.hubspot_source.stg_hubspot__deal_company_tmp type_id 47. model.hubspot_source.stg_hubspot__deal_company 47. model.hubspot_source.stg_hubspot__deal_company type_id 48. model.hubspot_source.stg_hubspot__deal_company_tmp:f0->47. model.hubspot_source.stg_hubspot__deal_company:f0
47. model.hubspot_source.stg_hubspot__deal_company
  • Input Column: 48. model.hubspot_source.stg_hubspot__deal_company_tmp[type_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT in the macro CTE
    • Output Columns:
      • type_id: Directly copied after casting to INT
48. model.hubspot_source.stg_hubspot__deal_company_tmp

This SQL query selects all columns from the 'deal_company' table in the 'hubspot' schema of the 'TEST' database. The query is likely a staging step to prepare data for further processing or analysis in a dbt (data build tool) project. The comment suggests that the table might not exist yet or all columns were excluded, and the star (*) is used as a placeholder during dbt compilation.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.deal_company
%3 48. model.hubspot_source.stg_hubspot__deal_company_tmp 48. model.hubspot_source.stg_hubspot__deal_company_tmp company_id deal_id type_id 117. source.hubspot_source.hubspot.deal_company 117. source.hubspot_source.hubspot.deal_company
Name Type Comment
company_id integer None
deal_id integer None
type_id integer None
Column Lineage
%3 48. model.hubspot_source.stg_hubspot__deal_company_tmp 48. model.hubspot_source.stg_hubspot__deal_company_tmp company_id 47. model.hubspot_source.stg_hubspot__deal_company 47. model.hubspot_source.stg_hubspot__deal_company company_id 48. model.hubspot_source.stg_hubspot__deal_company_tmp:f0->47. model.hubspot_source.stg_hubspot__deal_company:f0
47. model.hubspot_source.stg_hubspot__deal_company
  • Input Column: 48. model.hubspot_source.stg_hubspot__deal_company_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT in the macro CTE
    • Output Columns:
      • company_id: Directly copied after casting to INT
Column Lineage
%3 48. model.hubspot_source.stg_hubspot__deal_company_tmp 48. model.hubspot_source.stg_hubspot__deal_company_tmp deal_id 47. model.hubspot_source.stg_hubspot__deal_company 47. model.hubspot_source.stg_hubspot__deal_company deal_id 48. model.hubspot_source.stg_hubspot__deal_company_tmp:f0->47. model.hubspot_source.stg_hubspot__deal_company:f0
47. model.hubspot_source.stg_hubspot__deal_company
  • Input Column: 48. model.hubspot_source.stg_hubspot__deal_company_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT in the macro CTE
    • Output Columns:
      • deal_id: Directly copied after casting to INT
Column Lineage
%3 48. model.hubspot_source.stg_hubspot__deal_company_tmp 48. model.hubspot_source.stg_hubspot__deal_company_tmp type_id 47. model.hubspot_source.stg_hubspot__deal_company 47. model.hubspot_source.stg_hubspot__deal_company type_id 48. model.hubspot_source.stg_hubspot__deal_company_tmp:f0->47. model.hubspot_source.stg_hubspot__deal_company:f0
47. model.hubspot_source.stg_hubspot__deal_company
  • Input Column: 48. model.hubspot_source.stg_hubspot__deal_company_tmp[type_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT in the macro CTE
    • Output Columns:
      • type_id: Directly copied after casting to INT
49. model.hubspot_source.stg_hubspot__deal_contact

This SQL query performs a data type casting operation on a staging table for Hubspot deal-contact relationships. It selects all columns from a temporary table, creates a macro CTE with null values and specific data types, and then casts the columns to their appropriate data types in the final select statement. The query doesn't filter, deduplicate, or aggregate data, but rather focuses on standardizing the data types of the columns.

Cleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal_contact_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS deal_id,
    CAST(NULL AS INT) AS contact_id,
    CAST(NULL AS INT) AS type_id
  FROM base
), fields AS (
  SELECT
    contact_id,
    deal_id,
    type_id,
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced
  FROM macro
)
SELECT
  *
FROM fields
%3 49. model.hubspot_source.stg_hubspot__deal_contact 49. model.hubspot_source.stg_hubspot__deal_contact contact_id deal_id type_id _fivetran_synced 50. model.hubspot_source.stg_hubspot__deal_contact_tmp 50. model.hubspot_source.stg_hubspot__deal_contact_tmp contact_id deal_id _fivetran_synced type_id 50. model.hubspot_source.stg_hubspot__deal_contact_tmp:f0->49. model.hubspot_source.stg_hubspot__deal_contact:f0 50. model.hubspot_source.stg_hubspot__deal_contact_tmp:f1->49. model.hubspot_source.stg_hubspot__deal_contact:f1 50. model.hubspot_source.stg_hubspot__deal_contact_tmp:f2->49. model.hubspot_source.stg_hubspot__deal_contact:f3 50. model.hubspot_source.stg_hubspot__deal_contact_tmp:f3->49. model.hubspot_source.stg_hubspot__deal_contact:f2
Name Type Comment
contact_id bigint The ID of the contact.
deal_id bigint The ID of the deal.
type_id integer The ID of the type.
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
Column Lineage
%3 50. model.hubspot_source.stg_hubspot__deal_contact_tmp 50. model.hubspot_source.stg_hubspot__deal_contact_tmp contact_id 49. model.hubspot_source.stg_hubspot__deal_contact 49. model.hubspot_source.stg_hubspot__deal_contact contact_id 50. model.hubspot_source.stg_hubspot__deal_contact_tmp:f0->49. model.hubspot_source.stg_hubspot__deal_contact:f0
49. model.hubspot_source.stg_hubspot__deal_contact
  • Input Column: 50. model.hubspot_source.stg_hubspot__deal_contact_tmp[contact_id]
    • Cleaning The column is cast to INTEGER data type
    • Output Columns:
      • contact_id: Directly mapped after casting
Column Lineage
%3 50. model.hubspot_source.stg_hubspot__deal_contact_tmp 50. model.hubspot_source.stg_hubspot__deal_contact_tmp deal_id 49. model.hubspot_source.stg_hubspot__deal_contact 49. model.hubspot_source.stg_hubspot__deal_contact deal_id 50. model.hubspot_source.stg_hubspot__deal_contact_tmp:f0->49. model.hubspot_source.stg_hubspot__deal_contact:f0
49. model.hubspot_source.stg_hubspot__deal_contact
  • Input Column: 50. model.hubspot_source.stg_hubspot__deal_contact_tmp[deal_id]
    • Cleaning The column is cast to INTEGER data type
    • Output Columns:
      • deal_id: Directly mapped after casting
Column Lineage
%3 50. model.hubspot_source.stg_hubspot__deal_contact_tmp 50. model.hubspot_source.stg_hubspot__deal_contact_tmp type_id 49. model.hubspot_source.stg_hubspot__deal_contact 49. model.hubspot_source.stg_hubspot__deal_contact type_id 50. model.hubspot_source.stg_hubspot__deal_contact_tmp:f0->49. model.hubspot_source.stg_hubspot__deal_contact:f0
49. model.hubspot_source.stg_hubspot__deal_contact
  • Input Column: 50. model.hubspot_source.stg_hubspot__deal_contact_tmp[type_id]
    • Cleaning The column is cast to INTEGER data type
    • Output Columns:
      • type_id: Directly mapped after casting
Column Lineage
%3 50. model.hubspot_source.stg_hubspot__deal_contact_tmp 50. model.hubspot_source.stg_hubspot__deal_contact_tmp _fivetran_synced 49. model.hubspot_source.stg_hubspot__deal_contact 49. model.hubspot_source.stg_hubspot__deal_contact _fivetran_synced 50. model.hubspot_source.stg_hubspot__deal_contact_tmp:f0->49. model.hubspot_source.stg_hubspot__deal_contact:f0
49. model.hubspot_source.stg_hubspot__deal_contact
  • Input Column: 50. model.hubspot_source.stg_hubspot__deal_contact_tmp[_fivetran_synced]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
50. model.hubspot_source.stg_hubspot__deal_contact_tmp

This SQL query selects all columns from the 'deal_contact' table in the 'hubspot' schema of the 'TEST' database. The query is likely a placeholder or template, as indicated by the comment suggesting that no columns were returned, possibly because the relation doesn't exist yet or all columns were excluded.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.deal_contact
%3 50. model.hubspot_source.stg_hubspot__deal_contact_tmp 50. model.hubspot_source.stg_hubspot__deal_contact_tmp contact_id deal_id _fivetran_synced type_id 118. source.hubspot_source.hubspot.deal_contact 118. source.hubspot_source.hubspot.deal_contact
Name Type Comment
contact_id bigint None
deal_id bigint None
_fivetran_synced timestamp without time zone None
type_id integer None
Column Lineage
%3 50. model.hubspot_source.stg_hubspot__deal_contact_tmp 50. model.hubspot_source.stg_hubspot__deal_contact_tmp contact_id 49. model.hubspot_source.stg_hubspot__deal_contact 49. model.hubspot_source.stg_hubspot__deal_contact contact_id 50. model.hubspot_source.stg_hubspot__deal_contact_tmp:f0->49. model.hubspot_source.stg_hubspot__deal_contact:f0
49. model.hubspot_source.stg_hubspot__deal_contact
  • Input Column: 50. model.hubspot_source.stg_hubspot__deal_contact_tmp[contact_id]
    • Cleaning The column is cast to INTEGER data type
    • Output Columns:
      • contact_id: Directly mapped after casting
Column Lineage
%3 50. model.hubspot_source.stg_hubspot__deal_contact_tmp 50. model.hubspot_source.stg_hubspot__deal_contact_tmp deal_id 49. model.hubspot_source.stg_hubspot__deal_contact 49. model.hubspot_source.stg_hubspot__deal_contact deal_id 50. model.hubspot_source.stg_hubspot__deal_contact_tmp:f0->49. model.hubspot_source.stg_hubspot__deal_contact:f0
49. model.hubspot_source.stg_hubspot__deal_contact
  • Input Column: 50. model.hubspot_source.stg_hubspot__deal_contact_tmp[deal_id]
    • Cleaning The column is cast to INTEGER data type
    • Output Columns:
      • deal_id: Directly mapped after casting
Column Lineage
%3 50. model.hubspot_source.stg_hubspot__deal_contact_tmp 50. model.hubspot_source.stg_hubspot__deal_contact_tmp _fivetran_synced 49. model.hubspot_source.stg_hubspot__deal_contact 49. model.hubspot_source.stg_hubspot__deal_contact _fivetran_synced 50. model.hubspot_source.stg_hubspot__deal_contact_tmp:f0->49. model.hubspot_source.stg_hubspot__deal_contact:f0
49. model.hubspot_source.stg_hubspot__deal_contact
  • Input Column: 50. model.hubspot_source.stg_hubspot__deal_contact_tmp[_fivetran_synced]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
Column Lineage
%3 50. model.hubspot_source.stg_hubspot__deal_contact_tmp 50. model.hubspot_source.stg_hubspot__deal_contact_tmp type_id 49. model.hubspot_source.stg_hubspot__deal_contact 49. model.hubspot_source.stg_hubspot__deal_contact type_id 50. model.hubspot_source.stg_hubspot__deal_contact_tmp:f0->49. model.hubspot_source.stg_hubspot__deal_contact:f0
49. model.hubspot_source.stg_hubspot__deal_contact
  • Input Column: 50. model.hubspot_source.stg_hubspot__deal_contact_tmp[type_id]
    • Cleaning The column is cast to INTEGER data type
    • Output Columns:
      • type_id: Directly mapped after casting
51. model.hubspot_source.stg_hubspot__deal_pipeline

This SQL query performs data cleaning and transformation on the 'stg_hubspot__deal_pipeline_tmp' table. It casts columns to specific data types, renames some columns, and modifies others (e.g., converting '_fivetran_deleted' to 'is_deal_pipeline_deleted'). The query doesn't filter, deduplicate, or aggregate data, but focuses on standardizing and reformatting the existing columns.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal_pipeline_tmp
), macro AS (
  SELECT
    CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS BOOLEAN) AS active,
    CAST(NULL AS INT) AS display_order,
    CAST(NULL AS TEXT) AS label,
    CAST(NULL AS TEXT) AS pipeline_id,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS TIMESTAMP) AS updated_at
  FROM base
), fields AS (
  SELECT
    _fivetran_deleted AS is_deal_pipeline_deleted,
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    active AS is_active,
    display_order,
    label AS pipeline_label,
    CAST(pipeline_id AS TEXT) AS deal_pipeline_id,
    created_at AS deal_pipeline_created_at,
    updated_at AS deal_pipeline_updated_at
  FROM macro
)
SELECT
  *
FROM fields
%3 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline is_deal_pipeline_deleted _fivetran_synced deal_pipeline_id display_order deal_pipeline_created_at deal_pipeline_updated_at is_active pipeline_label 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp pipeline_id _fivetran_deleted _fivetran_synced active display_order label created_at updated_at 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f2 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f1->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f2->51. model.hubspot_source.stg_hubspot__deal_pipeline:f1 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f3->51. model.hubspot_source.stg_hubspot__deal_pipeline:f6 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f4->51. model.hubspot_source.stg_hubspot__deal_pipeline:f3 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f5->51. model.hubspot_source.stg_hubspot__deal_pipeline:f7 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f6->51. model.hubspot_source.stg_hubspot__deal_pipeline:f4 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f7->51. model.hubspot_source.stg_hubspot__deal_pipeline:f5
Name Type Comment
is_deal_pipeline_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
deal_pipeline_id text The ID of the pipeline.
display_order integer Used to determine the order in which the pipelines appear when viewed in HubSpot
deal_pipeline_created_at text A timestamp representing when the record was created.
deal_pipeline_updated_at text A timestamp representing when the record was updated.
is_active boolean Whether the stage is currently in use.
pipeline_label text The human-readable label for the pipeline. The label is used when showing the pipeline in HubSpot.
Column Lineage
%3 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp _fivetran_deleted 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline is_deal_pipeline_deleted 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages is_deal_pipeline_deleted 51. model.hubspot_source.stg_hubspot__deal_pipeline:f0->7. model.hubspot.hubspot__deal_stages:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[_fivetran_deleted]
    • Cleaning The column is renamed
    • Output Columns:
      • is_deal_pipeline_deleted: It is directly copied and renamed
7. model.hubspot.hubspot__deal_stages
  • Input Column: 51. model.hubspot_source.stg_hubspot__deal_pipeline[is_deal_pipeline_deleted]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cleaned by applying a COALESCE function to handle NULL values
    • Output Columns:
      • is_deal_pipeline_deleted: Directly mapped after COALESCE
Column Lineage
%3 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp _fivetran_synced 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline _fivetran_synced 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: It is directly copied after casting
Column Lineage
%3 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp pipeline_id 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline deal_pipeline_id 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_id 51. model.hubspot_source.stg_hubspot__deal_pipeline:f0->7. model.hubspot.hubspot__deal_stages:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[pipeline_id]
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • deal_pipeline_id: It is directly copied after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 51. model.hubspot_source.stg_hubspot__deal_pipeline[deal_pipeline_id]
    • Integration The column is used as a key to join with other tables
    • Output Columns:
      • pipeline_id: Mapped through joins and selection in the final subquery
Column Lineage
%3 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp display_order 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline display_order 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_display_order 51. model.hubspot_source.stg_hubspot__deal_pipeline:f0->7. model.hubspot.hubspot__deal_stages:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[display_order]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • display_order: It is directly copied
7. model.hubspot.hubspot__deal_stages
  • Input Column: 51. model.hubspot_source.stg_hubspot__deal_pipeline[display_order]
    • Direct The column is directly selected in the final subquery
    • Output Columns:
      • pipeline_display_order: Directly mapped in the final SELECT statement
Column Lineage
%3 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp created_at 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline deal_pipeline_created_at 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[created_at]
    • Cleaning The column is renamed
    • Output Columns:
      • deal_pipeline_created_at: It is directly copied and renamed
Column Lineage
%3 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp updated_at 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline deal_pipeline_updated_at 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[updated_at]
    • Cleaning The column is renamed
    • Output Columns:
      • deal_pipeline_updated_at: It is directly copied and renamed
Column Lineage
%3 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp active 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline is_active 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages is_pipeline_active 51. model.hubspot_source.stg_hubspot__deal_pipeline:f0->7. model.hubspot.hubspot__deal_stages:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[active]
    • Cleaning The column is renamed
    • Output Columns:
      • is_active: It is directly copied and renamed
7. model.hubspot.hubspot__deal_stages
  • Input Column: 51. model.hubspot_source.stg_hubspot__deal_pipeline[is_active]
    • Direct The column is directly selected in the final subquery
    • Output Columns:
      • is_pipeline_active: Directly mapped in the final SELECT statement
Column Lineage
%3 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp label 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline pipeline_label 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_label 51. model.hubspot_source.stg_hubspot__deal_pipeline:f0->7. model.hubspot.hubspot__deal_stages:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[label]
    • Cleaning The column is renamed
    • Output Columns:
      • pipeline_label: It is directly copied and renamed
7. model.hubspot.hubspot__deal_stages
  • Input Column: 51. model.hubspot_source.stg_hubspot__deal_pipeline[pipeline_label]
    • Direct The column is directly selected in the final subquery
    • Output Columns:
      • pipeline_label: Directly mapped in the final SELECT statement
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage

This SQL query performs a series of data type conversions and column renamings on the 'stg_hubspot__deal_pipeline_stage' model. It starts by selecting all columns from a temporary table, then creates a macro with null values and specific data types for each column. Finally, it applies these data type conversions and renames several columns to more descriptive names.

Cleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal_pipeline_stage_tmp
), macro AS (
  SELECT
    CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS BOOLEAN) AS active,
    CAST(NULL AS BOOLEAN) AS closed_won,
    CAST(NULL AS INT) AS display_order,
    CAST(NULL AS TEXT) AS label,
    CAST(NULL AS TEXT) AS pipeline_id,
    CAST(NULL AS FLOAT) AS probability,
    CAST(NULL AS TEXT) AS stage_id,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS TIMESTAMP) AS updated_at
  FROM base
), fields AS (
  SELECT
    _fivetran_deleted AS is_deal_pipeline_stage_deleted,
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    active AS is_active,
    closed_won AS is_closed_won,
    display_order,
    label AS pipeline_stage_label,
    pipeline_id AS deal_pipeline_id,
    probability,
    CAST(stage_id AS TEXT) AS deal_pipeline_stage_id,
    created_at AS deal_pipeline_stage_created_at,
    updated_at AS deal_pipeline_stage_updated_at
  FROM macro
)
SELECT
  *
FROM fields
%3 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage is_deal_pipeline_stage_deleted _fivetran_synced deal_pipeline_id deal_pipeline_stage_id display_order is_active is_closed_won pipeline_stage_label probability deal_pipeline_stage_created_at deal_pipeline_stage_updated_at 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp _fivetran_deleted _fivetran_synced active closed_won display_order probability stage_id label pipeline_id created_at updated_at 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f1->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f1 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f2->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f5 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f3->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f6 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f4->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f4 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f5->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f8 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f6->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f7->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f7 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f8->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f2 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f9->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f9 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f10->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f10
Name Type Comment
is_deal_pipeline_stage_deleted boolean Boolean indicating whether a record has been deleted in Hubspot and/or inferred deleted in Hubspot by Fivetran; _fivetran_deleted and is_deleted fields are equivalent.
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
deal_pipeline_id text The ID of the related pipeline.
deal_pipeline_stage_id text The ID of the pipeline stage.
display_order integer Used to determine the order in which the stages appear when viewed in HubSpot.
is_active boolean Whether the pipeline stage is currently in use.
is_closed_won boolean Whether the stage represents a Closed Won deal.
pipeline_stage_label text The human-readable label for the stage. The label is used when showing the stage in HubSpot.
probability double precision The probability that the deal will close. Used for the deal forecast.
deal_pipeline_stage_created_at text A timestamp representing when the record was created.
deal_pipeline_stage_updated_at text A timestamp representing when the record was updated.
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp _fivetran_deleted 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage is_deal_pipeline_stage_deleted 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages is_deal_pipeline_stage_deleted 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[_fivetran_deleted]
    • Cleaning The column is cast to BOOLEAN and renamed
    • Output Columns:
      • is_deal_pipeline_stage_deleted: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[is_deal_pipeline_stage_deleted]
    • Direct The column is directly copied to the output
    • Cleaning The column is cleaned by applying a COALESCE function to handle NULL values
    • Output Columns:
      • is_deal_pipeline_stage_deleted: Directly copied and cleaned with COALESCE
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp _fivetran_synced 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage _fivetran_synced 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[_fivetran_synced]
    • Cleaning The column is cast to TIMESTAMP
    • Direct The column is directly copied after casting
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp pipeline_id 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage deal_pipeline_id 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_id 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[pipeline_id]
    • Cleaning The column is cast to TEXT and renamed
    • Output Columns:
      • deal_pipeline_id: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[deal_pipeline_id]
    • Integration The column is used as a key to join with the pipeline table
    • Output Columns:
      • pipeline_id: Indirectly mapped through the join operation
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp stage_id 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage deal_pipeline_stage_id 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_stage_id 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[stage_id]
    • Cleaning The column is cast to TEXT and renamed
    • Output Columns:
      • deal_pipeline_stage_id: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[deal_pipeline_stage_id]
    • Integration The column is used as a key to join with the deal_stage table
    • Output Columns:
      • pipeline_stage_id: Indirectly mapped through the join operation
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp display_order 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage display_order 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_stage_display_order 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[display_order]
    • Cleaning The column is cast to INT
    • Direct The column is directly copied after casting
    • Output Columns:
      • display_order: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[display_order]
    • Direct The column is directly copied to the output
    • Output Columns:
      • pipeline_stage_display_order: Directly copied
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp active 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage is_active 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages is_pipeline_stage_active 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[active]
    • Cleaning The column is cast to BOOLEAN and renamed
    • Output Columns:
      • is_active: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[is_active]
    • Direct The column is directly copied to the output
    • Output Columns:
      • is_pipeline_stage_active: Directly copied
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp closed_won 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage is_closed_won 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages is_pipeline_stage_closed_won 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[closed_won]
    • Cleaning The column is cast to BOOLEAN and renamed
    • Output Columns:
      • is_closed_won: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[is_closed_won]
    • Direct The column is directly copied to the output
    • Output Columns:
      • is_pipeline_stage_closed_won: Directly copied
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp label 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage pipeline_stage_label 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_stage_label 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[label]
    • Cleaning The column is cast to TEXT and renamed
    • Output Columns:
      • pipeline_stage_label: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[pipeline_stage_label]
    • Direct The column is directly copied to the output
    • Output Columns:
      • pipeline_stage_label: Directly copied
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp probability 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage probability 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_stage_probability 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[probability]
    • Cleaning The column is cast to FLOAT
    • Direct The column is directly copied after casting
    • Output Columns:
      • probability: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[probability]
    • Direct The column is directly copied to the output
    • Output Columns:
      • pipeline_stage_probability: Directly copied
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp created_at 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage deal_pipeline_stage_created_at 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages deal_pipeline_stage_created_at 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[created_at]
    • Cleaning The column is cast to TIMESTAMP and renamed
    • Output Columns:
      • deal_pipeline_stage_created_at: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[deal_pipeline_stage_created_at]
    • Direct The column is directly copied to the output
    • Output Columns:
      • deal_pipeline_stage_created_at: Directly copied
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp updated_at 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage deal_pipeline_stage_updated_at 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages deal_pipeline_stage_updated_at 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[updated_at]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cleaned by casting it to a TIMESTAMP data type
    • Output Columns:
      • deal_pipeline_stage_updated_at: The 'updated_at' column is directly mapped to 'deal_pipeline_stage_updated_at' with a TIMESTAMP cast
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[deal_pipeline_stage_updated_at]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • deal_pipeline_stage_updated_at: It is directly copied to the output column with the same name
53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp

This SQL query is a simple SELECT statement that retrieves all columns from the 'deal_pipeline_stage' table in the 'hubspot' schema of the 'TEST' database. The comment suggests that this query is part of a dbt model and may be used as a placeholder or for initial setup purposes.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.deal_pipeline_stage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp _fivetran_deleted _fivetran_synced active closed_won display_order probability stage_id label pipeline_id created_at updated_at 120. source.hubspot_source.hubspot.deal_pipeline_stage 120. source.hubspot_source.hubspot.deal_pipeline_stage
Name Type Comment
_fivetran_deleted boolean None
_fivetran_synced text None
active boolean None
closed_won boolean None
display_order integer None
probability double precision None
stage_id character varying(100) None
label text None
pipeline_id text None
created_at text None
updated_at text None
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp _fivetran_deleted 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage is_deal_pipeline_stage_deleted 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages is_deal_pipeline_stage_deleted 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[_fivetran_deleted]
    • Cleaning The column is cast to BOOLEAN and renamed
    • Output Columns:
      • is_deal_pipeline_stage_deleted: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[is_deal_pipeline_stage_deleted]
    • Direct The column is directly copied to the output
    • Cleaning The column is cleaned by applying a COALESCE function to handle NULL values
    • Output Columns:
      • is_deal_pipeline_stage_deleted: Directly copied and cleaned with COALESCE
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp _fivetran_synced 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage _fivetran_synced 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[_fivetran_synced]
    • Cleaning The column is cast to TIMESTAMP
    • Direct The column is directly copied after casting
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp active 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage is_active 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages is_pipeline_stage_active 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[active]
    • Cleaning The column is cast to BOOLEAN and renamed
    • Output Columns:
      • is_active: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[is_active]
    • Direct The column is directly copied to the output
    • Output Columns:
      • is_pipeline_stage_active: Directly copied
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp closed_won 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage is_closed_won 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages is_pipeline_stage_closed_won 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[closed_won]
    • Cleaning The column is cast to BOOLEAN and renamed
    • Output Columns:
      • is_closed_won: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[is_closed_won]
    • Direct The column is directly copied to the output
    • Output Columns:
      • is_pipeline_stage_closed_won: Directly copied
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp display_order 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage display_order 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_stage_display_order 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[display_order]
    • Cleaning The column is cast to INT
    • Direct The column is directly copied after casting
    • Output Columns:
      • display_order: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[display_order]
    • Direct The column is directly copied to the output
    • Output Columns:
      • pipeline_stage_display_order: Directly copied
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp probability 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage probability 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_stage_probability 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[probability]
    • Cleaning The column is cast to FLOAT
    • Direct The column is directly copied after casting
    • Output Columns:
      • probability: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[probability]
    • Direct The column is directly copied to the output
    • Output Columns:
      • pipeline_stage_probability: Directly copied
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp stage_id 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage deal_pipeline_stage_id 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_stage_id 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[stage_id]
    • Cleaning The column is cast to TEXT and renamed
    • Output Columns:
      • deal_pipeline_stage_id: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[deal_pipeline_stage_id]
    • Integration The column is used as a key to join with the deal_stage table
    • Output Columns:
      • pipeline_stage_id: Indirectly mapped through the join operation
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp label 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage pipeline_stage_label 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_stage_label 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[label]
    • Cleaning The column is cast to TEXT and renamed
    • Output Columns:
      • pipeline_stage_label: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[pipeline_stage_label]
    • Direct The column is directly copied to the output
    • Output Columns:
      • pipeline_stage_label: Directly copied
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp pipeline_id 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage deal_pipeline_id 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_id 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[pipeline_id]
    • Cleaning The column is cast to TEXT and renamed
    • Output Columns:
      • deal_pipeline_id: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[deal_pipeline_id]
    • Integration The column is used as a key to join with the pipeline table
    • Output Columns:
      • pipeline_id: Indirectly mapped through the join operation
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp created_at 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage deal_pipeline_stage_created_at 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages deal_pipeline_stage_created_at 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[created_at]
    • Cleaning The column is cast to TIMESTAMP and renamed
    • Output Columns:
      • deal_pipeline_stage_created_at: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[deal_pipeline_stage_created_at]
    • Direct The column is directly copied to the output
    • Output Columns:
      • deal_pipeline_stage_created_at: Directly copied
Column Lineage
%3 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp updated_at 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage deal_pipeline_stage_updated_at 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp:f0->52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages deal_pipeline_stage_updated_at 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
52. model.hubspot_source.stg_hubspot__deal_pipeline_stage
  • Input Column: 53. model.hubspot_source.stg_hubspot__deal_pipeline_stage_tmp[updated_at]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cleaned by casting it to a TIMESTAMP data type
    • Output Columns:
      • deal_pipeline_stage_updated_at: The 'updated_at' column is directly mapped to 'deal_pipeline_stage_updated_at' with a TIMESTAMP cast
7. model.hubspot.hubspot__deal_stages
  • Input Column: 52. model.hubspot_source.stg_hubspot__deal_pipeline_stage[deal_pipeline_stage_updated_at]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • deal_pipeline_stage_updated_at: It is directly copied to the output column with the same name
54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp

This SQL query selects all columns from the 'deal_pipeline' table in the 'hubspot' schema of the 'TEST' database. The query appears to be a placeholder or template, as indicated by the comment suggesting that no columns were returned, possibly because the relation doesn't exist yet or all columns were excluded. The asterisk (*) is used to keep SQLFluff (a SQL linter) happy during dbt compilation.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.deal_pipeline
%3 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp pipeline_id _fivetran_deleted _fivetran_synced active display_order label created_at updated_at 119. source.hubspot_source.hubspot.deal_pipeline 119. source.hubspot_source.hubspot.deal_pipeline
Name Type Comment
pipeline_id character varying(100) None
_fivetran_deleted boolean None
_fivetran_synced text None
active boolean None
display_order integer None
label text None
created_at text None
updated_at text None
Column Lineage
%3 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp pipeline_id 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline deal_pipeline_id 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_id 51. model.hubspot_source.stg_hubspot__deal_pipeline:f0->7. model.hubspot.hubspot__deal_stages:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[pipeline_id]
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • deal_pipeline_id: It is directly copied after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 51. model.hubspot_source.stg_hubspot__deal_pipeline[deal_pipeline_id]
    • Integration The column is used as a key to join with other tables
    • Output Columns:
      • pipeline_id: Mapped through joins and selection in the final subquery
Column Lineage
%3 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp _fivetran_deleted 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline is_deal_pipeline_deleted 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages is_deal_pipeline_deleted 51. model.hubspot_source.stg_hubspot__deal_pipeline:f0->7. model.hubspot.hubspot__deal_stages:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[_fivetran_deleted]
    • Cleaning The column is renamed
    • Output Columns:
      • is_deal_pipeline_deleted: It is directly copied and renamed
7. model.hubspot.hubspot__deal_stages
  • Input Column: 51. model.hubspot_source.stg_hubspot__deal_pipeline[is_deal_pipeline_deleted]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cleaned by applying a COALESCE function to handle NULL values
    • Output Columns:
      • is_deal_pipeline_deleted: Directly mapped after COALESCE
Column Lineage
%3 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp _fivetran_synced 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline _fivetran_synced 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: It is directly copied after casting
Column Lineage
%3 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp active 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline is_active 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages is_pipeline_active 51. model.hubspot_source.stg_hubspot__deal_pipeline:f0->7. model.hubspot.hubspot__deal_stages:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[active]
    • Cleaning The column is renamed
    • Output Columns:
      • is_active: It is directly copied and renamed
7. model.hubspot.hubspot__deal_stages
  • Input Column: 51. model.hubspot_source.stg_hubspot__deal_pipeline[is_active]
    • Direct The column is directly selected in the final subquery
    • Output Columns:
      • is_pipeline_active: Directly mapped in the final SELECT statement
Column Lineage
%3 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp display_order 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline display_order 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_display_order 51. model.hubspot_source.stg_hubspot__deal_pipeline:f0->7. model.hubspot.hubspot__deal_stages:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[display_order]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • display_order: It is directly copied
7. model.hubspot.hubspot__deal_stages
  • Input Column: 51. model.hubspot_source.stg_hubspot__deal_pipeline[display_order]
    • Direct The column is directly selected in the final subquery
    • Output Columns:
      • pipeline_display_order: Directly mapped in the final SELECT statement
Column Lineage
%3 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp label 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline pipeline_label 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_label 51. model.hubspot_source.stg_hubspot__deal_pipeline:f0->7. model.hubspot.hubspot__deal_stages:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[label]
    • Cleaning The column is renamed
    • Output Columns:
      • pipeline_label: It is directly copied and renamed
7. model.hubspot.hubspot__deal_stages
  • Input Column: 51. model.hubspot_source.stg_hubspot__deal_pipeline[pipeline_label]
    • Direct The column is directly selected in the final subquery
    • Output Columns:
      • pipeline_label: Directly mapped in the final SELECT statement
Column Lineage
%3 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp created_at 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline deal_pipeline_created_at 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[created_at]
    • Cleaning The column is renamed
    • Output Columns:
      • deal_pipeline_created_at: It is directly copied and renamed
Column Lineage
%3 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp updated_at 51. model.hubspot_source.stg_hubspot__deal_pipeline 51. model.hubspot_source.stg_hubspot__deal_pipeline deal_pipeline_updated_at 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp:f0->51. model.hubspot_source.stg_hubspot__deal_pipeline:f0
51. model.hubspot_source.stg_hubspot__deal_pipeline
  • Input Column: 54. model.hubspot_source.stg_hubspot__deal_pipeline_tmp[updated_at]
    • Cleaning The column is renamed
    • Output Columns:
      • deal_pipeline_updated_at: It is directly copied and renamed
55. model.hubspot_source.stg_hubspot__deal_property_history

This SQL query performs data type casting and column renaming for the Hubspot deal property history data. It starts with a base CTE that selects all columns from a temporary table. Then, it defines a macro CTE with null values and specific data types for each column. Finally, it casts the columns to the appropriate data types and renames some columns in the fields CTE before selecting all columns from it.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal_property_history_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS deal_id,
    CAST(NULL AS TEXT) AS name,
    CAST(NULL AS TEXT) AS source,
    CAST(NULL AS TEXT) AS source_id,
    CAST(NULL AS TIMESTAMP) AS change_timestamp,
    CAST(NULL AS TEXT) AS value
  FROM base
), fields AS (
  SELECT
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    deal_id,
    name AS field_name,
    source AS change_source,
    source_id AS change_source_id,
    CAST(change_timestamp AS TIMESTAMP) AS change_timestamp, /* source field name = timestamp ; alias declared in macros/get_deal_property_history_columns.sql */
    value AS new_value
  FROM macro
)
SELECT
  *
FROM fields
%3 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history _fivetran_synced change_source change_source_id change_timestamp deal_id field_name new_value 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp deal_id timestamp _fivetran_synced source name source_id value 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f4 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f1->55. model.hubspot_source.stg_hubspot__deal_property_history:f3 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f2->55. model.hubspot_source.stg_hubspot__deal_property_history:f0 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f3->55. model.hubspot_source.stg_hubspot__deal_property_history:f1 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f4->55. model.hubspot_source.stg_hubspot__deal_property_history:f5 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f5->55. model.hubspot_source.stg_hubspot__deal_property_history:f2 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f6->55. model.hubspot_source.stg_hubspot__deal_property_history:f6
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
change_source text The source (reason) of the change.
change_source_id text The ID of the object that caused the change, if applicable.
change_timestamp timestamp without time zone The timestamp the changed occurred.
deal_id bigint The ID of the related deal record.
field_name text The name of the field being changed.
new_value text The new value of the field.
Column Lineage
%3 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp _fivetran_synced 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history _fivetran_synced 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[_fivetran_synced]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Directly copied and cast to TIMESTAMP
Column Lineage
%3 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp source 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history change_source 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history change_source 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[source]
    • Other The column is renamed to 'change_source'
    • Output Columns:
      • change_source: Renamed from 'source'
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[change_source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source: Directly copied
Column Lineage
%3 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp source_id 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history change_source_id 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history change_source_id 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[source_id]
    • Other The column is renamed to 'change_source_id'
    • Output Columns:
      • change_source_id: Renamed from 'source_id'
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[change_source_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source_id: Directly copied
Column Lineage
%3 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp timestamp 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history change_timestamp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history id valid_from valid_to 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f1 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f2 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[timestamp]
    • Cleaning The column is cast to TIMESTAMP data type
    • Other The column is renamed to 'change_timestamp'
    • Output Columns:
      • change_timestamp: Renamed from 'timestamp' and cast to TIMESTAMP
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[change_timestamp]
    • Direct The column is directly copied as valid_from
    • Other Used in LEAD function to calculate valid_to
    • Featurization Used in MD5 function to create a unique id
    • Output Columns:
      • valid_from: Directly copied
      • valid_to: Used in LEAD function
      • id: Part of MD5 hash
Column Lineage
%3 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp deal_id 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history deal_id 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history deal_id id 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f1
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly copied and cast to INT
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[deal_id]
    • Direct The column is directly copied
    • Deduplication Used in PARTITION BY clause for windowing
    • Featurization Used in MD5 function to create a unique id
    • Output Columns:
      • deal_id: Directly copied
      • id: Part of MD5 hash
Column Lineage
%3 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp name 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history field_name 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history field_name id 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f1
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[name]
    • Other The column is renamed to 'field_name'
    • Output Columns:
      • field_name: Renamed from 'name'
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[field_name]
    • Direct The column is directly copied
    • Deduplication Used in PARTITION BY clause for windowing
    • Featurization Used in MD5 function to create a unique id
    • Output Columns:
      • field_name: Directly copied
      • id: Part of MD5 hash
Column Lineage
%3 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp value 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history new_value 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history new_value 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[value]
    • Other The column is renamed to 'new_value'
    • Output Columns:
      • new_value: Renamed from 'value'
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[new_value]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • new_value: Directly copied
56. model.hubspot_source.stg_hubspot__deal_property_history_tmp

This SQL query selects all columns from the 'deal_property_history' table in the 'hubspot' schema of the 'TEST' database. The query appears to be a staging step, likely used to create a temporary or intermediate table for further processing in a dbt model.

Integration
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.deal_property_history
%3 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp deal_id timestamp _fivetran_synced source name source_id value 121. source.hubspot_source.hubspot.deal_property_history 121. source.hubspot_source.hubspot.deal_property_history
Name Type Comment
deal_id bigint None
timestamp text None
_fivetran_synced text None
source text None
name text None
source_id text None
value text None
Column Lineage
%3 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp deal_id 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history deal_id 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history deal_id id 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f1
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly copied and cast to INT
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[deal_id]
    • Direct The column is directly copied
    • Deduplication Used in PARTITION BY clause for windowing
    • Featurization Used in MD5 function to create a unique id
    • Output Columns:
      • deal_id: Directly copied
      • id: Part of MD5 hash
Column Lineage
%3 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp timestamp 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history change_timestamp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history id valid_from valid_to 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f1 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f2 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[timestamp]
    • Cleaning The column is cast to TIMESTAMP data type
    • Other The column is renamed to 'change_timestamp'
    • Output Columns:
      • change_timestamp: Renamed from 'timestamp' and cast to TIMESTAMP
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[change_timestamp]
    • Direct The column is directly copied as valid_from
    • Other Used in LEAD function to calculate valid_to
    • Featurization Used in MD5 function to create a unique id
    • Output Columns:
      • valid_from: Directly copied
      • valid_to: Used in LEAD function
      • id: Part of MD5 hash
Column Lineage
%3 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp _fivetran_synced 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history _fivetran_synced 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[_fivetran_synced]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Directly copied and cast to TIMESTAMP
Column Lineage
%3 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp source 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history change_source 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history change_source 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[source]
    • Other The column is renamed to 'change_source'
    • Output Columns:
      • change_source: Renamed from 'source'
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[change_source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source: Directly copied
Column Lineage
%3 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp name 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history field_name 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history field_name id 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f1
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[name]
    • Other The column is renamed to 'field_name'
    • Output Columns:
      • field_name: Renamed from 'name'
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[field_name]
    • Direct The column is directly copied
    • Deduplication Used in PARTITION BY clause for windowing
    • Featurization Used in MD5 function to create a unique id
    • Output Columns:
      • field_name: Directly copied
      • id: Part of MD5 hash
Column Lineage
%3 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp source_id 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history change_source_id 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history change_source_id 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[source_id]
    • Other The column is renamed to 'change_source_id'
    • Output Columns:
      • change_source_id: Renamed from 'source_id'
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[change_source_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source_id: Directly copied
Column Lineage
%3 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp value 55. model.hubspot_source.stg_hubspot__deal_property_history 55. model.hubspot_source.stg_hubspot__deal_property_history new_value 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp:f0->55. model.hubspot_source.stg_hubspot__deal_property_history:f0 6. model.hubspot.hubspot__deal_history 6. model.hubspot.hubspot__deal_history new_value 55. model.hubspot_source.stg_hubspot__deal_property_history:f0->6. model.hubspot.hubspot__deal_history:f0
55. model.hubspot_source.stg_hubspot__deal_property_history
  • Input Column: 56. model.hubspot_source.stg_hubspot__deal_property_history_tmp[value]
    • Other The column is renamed to 'new_value'
    • Output Columns:
      • new_value: Renamed from 'value'
6. model.hubspot.hubspot__deal_history
  • Input Column: 55. model.hubspot_source.stg_hubspot__deal_property_history[new_value]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • new_value: Directly copied
57. model.hubspot_source.stg_hubspot__deal_stage

This SQL query performs data type casting and column renaming for the 'stg_hubspot__deal_stage' model. It starts by selecting all columns from a temporary table, then explicitly casts several columns to specific data types (mostly to handle NULL values), and finally renames the 'value' column to 'deal_stage_name' in the final output.

Cleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__deal_stage_tmp
), fields AS (
  SELECT
    CAST(NULL AS BOOLEAN) AS _fivetran_active,
    CAST(NULL AS TIMESTAMP) AS _fivetran_end,
    CAST(NULL AS TIMESTAMP) AS _fivetran_start,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TIMESTAMP) AS date_entered,
    CAST(NULL AS INT) AS deal_id,
    CAST(NULL AS TEXT) AS source,
    CAST(NULL AS TEXT) AS source_id,
    CAST(NULL AS TEXT) AS value
  FROM base
), final AS (
  SELECT
    CAST(date_entered AS TIMESTAMP) AS date_entered,
    deal_id,
    source,
    source_id,
    value AS deal_stage_name,
    _fivetran_active,
    CAST(_fivetran_end AS TIMESTAMP) AS _fivetran_end,
    CAST(_fivetran_start AS TIMESTAMP) AS _fivetran_start
  FROM fields
)
SELECT
  *
FROM final
%3 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage _fivetran_active _fivetran_end _fivetran_start _fivetran_synced date_entered deal_id source source_id deal_stage_name 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp _fivetran_start deal_id _fivetran_active _fivetran_end date_entered source source_id value 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f2 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f1->57. model.hubspot_source.stg_hubspot__deal_stage:f5 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f2->57. model.hubspot_source.stg_hubspot__deal_stage:f0 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f3->57. model.hubspot_source.stg_hubspot__deal_stage:f1 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f4->57. model.hubspot_source.stg_hubspot__deal_stage:f4 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f5->57. model.hubspot_source.stg_hubspot__deal_stage:f6 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f6->57. model.hubspot_source.stg_hubspot__deal_stage:f7 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f7->57. model.hubspot_source.stg_hubspot__deal_stage:f8
Name Type Comment
_fivetran_active boolean Boolean indicating whether the deal stage is active.
_fivetran_end timestamp without time zone The Fivetran calculated exist time of the deal stage.
_fivetran_start timestamp without time zone The date the deal stage was entered.
_fivetran_synced None Timestamp of when Fivetran synced a record.
date_entered timestamp without time zone The timestamp the deal stage was entered.
deal_id bigint Reference to the deal.
source text The relevant source of the deal stage.
source_id text Reference to the source.
deal_stage_name text The value of the deal stage. Typically the name of the stage.
Column Lineage
%3 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp _fivetran_active 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage _fivetran_active 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages is_stage_active 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[_fivetran_active]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • _fivetran_active: Directly mapped
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[_fivetran_active]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • is_stage_active: Directly mapped to this output column
Column Lineage
%3 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp _fivetran_end 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage _fivetran_end 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages date_stage_exited 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[_fivetran_end]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_end: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[_fivetran_end]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • date_stage_exited: Directly mapped to this output column
Column Lineage
%3 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp _fivetran_start 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage _fivetran_start 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages date_stage_entered 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[_fivetran_start]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_start: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[_fivetran_start]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • date_stage_entered: Directly mapped to this output column
Column Lineage
%3 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp date_entered 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage date_entered 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages deal_stage_id 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[date_entered]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • date_entered: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[date_entered]
    • Deduplication Used in the ROW_NUMBER() function to create a unique identifier
    • Output Columns:
      • deal_stage_id: Partially used in creating this unique identifier
Column Lineage
%3 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp deal_id 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage deal_id 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages deal_id deal_stage_id 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f1
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[deal_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • deal_id: Directly mapped
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[deal_id]
    • Direct Directly copied to the output
    • Integration Used to join with the deals_enhanced CTE
    • Deduplication Used in creating a unique identifier for deal_stage_id
    • Output Columns:
      • deal_id: Directly mapped to this output column
      • deal_stage_id: Partially used in creating this unique identifier
Column Lineage
%3 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp source 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage source 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages source 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[source]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • source: Directly mapped
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[source]
    • Direct Directly copied to the output
    • Output Columns:
      • source: Directly mapped to this output column
Column Lineage
%3 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp source_id 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage source_id 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages source_id 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[source_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • source_id: Directly mapped
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[source_id]
    • Direct Directly copied to the output
    • Output Columns:
      • source_id: Directly mapped to this output column
Column Lineage
%3 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp value 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage deal_stage_name 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_stage_id 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[value]
    • Other The column is renamed to 'deal_stage_name'
    • Output Columns:
      • deal_stage_name: Mapped with renaming
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[deal_stage_name]
    • Integration Used to join with the pipeline_stage CTE
    • Direct Directly copied to the output
    • Output Columns:
      • pipeline_stage_id: Directly mapped to this output column
58. model.hubspot_source.stg_hubspot__deal_stage_tmp

This SQL query selects all columns from the 'deal_stage' table in the 'hubspot' schema of the 'TEST' database. The query is designed as a staging step, likely to be used as an intermediate layer in a data transformation pipeline. The comment suggests that this query might be part of a dbt (data build tool) project and is possibly used as a placeholder or template for future development.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.deal_stage
%3 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp _fivetran_start deal_id _fivetran_active _fivetran_end _fivetran_synced date_entered source source_id value 122. source.hubspot_source.hubspot.deal_stage 122. source.hubspot_source.hubspot.deal_stage
Name Type Comment
_fivetran_start timestamp without time zone None
deal_id bigint None
_fivetran_active boolean None
_fivetran_end timestamp without time zone None
_fivetran_synced timestamp without time zone None
date_entered timestamp without time zone None
source text None
source_id text None
value text None
Column Lineage
%3 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp _fivetran_start 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage _fivetran_start 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages date_stage_entered 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[_fivetran_start]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_start: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[_fivetran_start]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • date_stage_entered: Directly mapped to this output column
Column Lineage
%3 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp deal_id 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage deal_id 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages deal_id deal_stage_id 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f1
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[deal_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • deal_id: Directly mapped
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[deal_id]
    • Direct Directly copied to the output
    • Integration Used to join with the deals_enhanced CTE
    • Deduplication Used in creating a unique identifier for deal_stage_id
    • Output Columns:
      • deal_id: Directly mapped to this output column
      • deal_stage_id: Partially used in creating this unique identifier
Column Lineage
%3 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp _fivetran_active 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage _fivetran_active 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages is_stage_active 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[_fivetran_active]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • _fivetran_active: Directly mapped
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[_fivetran_active]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • is_stage_active: Directly mapped to this output column
Column Lineage
%3 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp _fivetran_end 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage _fivetran_end 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages date_stage_exited 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[_fivetran_end]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_end: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[_fivetran_end]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • date_stage_exited: Directly mapped to this output column
Column Lineage
%3 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp date_entered 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage date_entered 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages deal_stage_id 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[date_entered]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • date_entered: Directly mapped after casting
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[date_entered]
    • Deduplication Used in the ROW_NUMBER() function to create a unique identifier
    • Output Columns:
      • deal_stage_id: Partially used in creating this unique identifier
Column Lineage
%3 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp source 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage source 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages source 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[source]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • source: Directly mapped
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[source]
    • Direct Directly copied to the output
    • Output Columns:
      • source: Directly mapped to this output column
Column Lineage
%3 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp source_id 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage source_id 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages source_id 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[source_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • source_id: Directly mapped
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[source_id]
    • Direct Directly copied to the output
    • Output Columns:
      • source_id: Directly mapped to this output column
Column Lineage
%3 58. model.hubspot_source.stg_hubspot__deal_stage_tmp 58. model.hubspot_source.stg_hubspot__deal_stage_tmp value 57. model.hubspot_source.stg_hubspot__deal_stage 57. model.hubspot_source.stg_hubspot__deal_stage deal_stage_name 58. model.hubspot_source.stg_hubspot__deal_stage_tmp:f0->57. model.hubspot_source.stg_hubspot__deal_stage:f0 7. model.hubspot.hubspot__deal_stages 7. model.hubspot.hubspot__deal_stages pipeline_stage_id 57. model.hubspot_source.stg_hubspot__deal_stage:f0->7. model.hubspot.hubspot__deal_stages:f0
57. model.hubspot_source.stg_hubspot__deal_stage
  • Input Column: 58. model.hubspot_source.stg_hubspot__deal_stage_tmp[value]
    • Other The column is renamed to 'deal_stage_name'
    • Output Columns:
      • deal_stage_name: Mapped with renaming
7. model.hubspot.hubspot__deal_stages
  • Input Column: 57. model.hubspot_source.stg_hubspot__deal_stage[deal_stage_name]
    • Integration Used to join with the pipeline_stage CTE
    • Direct Directly copied to the output
    • Output Columns:
      • pipeline_stage_id: Directly mapped to this output column
59. model.hubspot_source.stg_hubspot__deal_tmp

This SQL query is a simple select statement that retrieves all columns from the 'deal' table in the 'hubspot' schema of the 'TEST' database. The comment suggests that this query is part of a dbt (data build tool) project and is used as a staging step for Hubspot deal data. The asterisk (*) is used as a placeholder to ensure compatibility with SQLFluff, a SQL linting tool.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.deal
%3 59. model.hubspot_source.stg_hubspot__deal_tmp 59. model.hubspot_source.stg_hubspot__deal_tmp deal_id owner_id deal_pipeline_id deal_pipeline_stage_id is_deleted 116. source.hubspot_source.hubspot.deal 116. source.hubspot_source.hubspot.deal
Name Type Comment
deal_id bigint None
owner_id bigint None
deal_pipeline_id text None
deal_pipeline_stage_id text None
is_deleted boolean None
Column Lineage
%3 59. model.hubspot_source.stg_hubspot__deal_tmp 59. model.hubspot_source.stg_hubspot__deal_tmp deal_id 46. model.hubspot_source.stg_hubspot__deal 46. model.hubspot_source.stg_hubspot__deal deal_id 59. model.hubspot_source.stg_hubspot__deal_tmp:f0->46. model.hubspot_source.stg_hubspot__deal:f0
46. model.hubspot_source.stg_hubspot__deal
  • Input Column: 59. model.hubspot_source.stg_hubspot__deal_tmp[deal_id]
    • Direct The deal_id is directly copied without any transformation
    • Cleaning The deal_id is cast as INT
    • Output Columns:
      • deal_id: Directly mapped after casting to INT
Column Lineage
%3 59. model.hubspot_source.stg_hubspot__deal_tmp 59. model.hubspot_source.stg_hubspot__deal_tmp owner_id 46. model.hubspot_source.stg_hubspot__deal 46. model.hubspot_source.stg_hubspot__deal owner_id 59. model.hubspot_source.stg_hubspot__deal_tmp:f0->46. model.hubspot_source.stg_hubspot__deal:f0
46. model.hubspot_source.stg_hubspot__deal
  • Input Column: 59. model.hubspot_source.stg_hubspot__deal_tmp[owner_id]
    • Direct The owner_id is directly copied without any transformation
    • Cleaning The owner_id is cast as INT
    • Output Columns:
      • owner_id: Directly mapped after casting to INT
Column Lineage
%3 59. model.hubspot_source.stg_hubspot__deal_tmp 59. model.hubspot_source.stg_hubspot__deal_tmp deal_pipeline_id 46. model.hubspot_source.stg_hubspot__deal 46. model.hubspot_source.stg_hubspot__deal deal_pipeline_id 59. model.hubspot_source.stg_hubspot__deal_tmp:f0->46. model.hubspot_source.stg_hubspot__deal:f0
46. model.hubspot_source.stg_hubspot__deal
  • Input Column: 59. model.hubspot_source.stg_hubspot__deal_tmp[deal_pipeline_id]
    • Direct The deal_pipeline_id is directly copied without any transformation
    • Cleaning The deal_pipeline_id is cast as TEXT
    • Output Columns:
      • deal_pipeline_id: Directly mapped after casting to TEXT
Column Lineage
%3 59. model.hubspot_source.stg_hubspot__deal_tmp 59. model.hubspot_source.stg_hubspot__deal_tmp deal_pipeline_stage_id 46. model.hubspot_source.stg_hubspot__deal 46. model.hubspot_source.stg_hubspot__deal deal_pipeline_stage_id 59. model.hubspot_source.stg_hubspot__deal_tmp:f0->46. model.hubspot_source.stg_hubspot__deal:f0
46. model.hubspot_source.stg_hubspot__deal
  • Input Column: 59. model.hubspot_source.stg_hubspot__deal_tmp[deal_pipeline_stage_id]
    • Direct The deal_pipeline_stage_id is directly copied without any transformation
    • Cleaning The deal_pipeline_stage_id is cast as TEXT
    • Output Columns:
      • deal_pipeline_stage_id: Directly mapped after casting to TEXT
Column Lineage
%3 59. model.hubspot_source.stg_hubspot__deal_tmp 59. model.hubspot_source.stg_hubspot__deal_tmp is_deleted 46. model.hubspot_source.stg_hubspot__deal 46. model.hubspot_source.stg_hubspot__deal is_deal_deleted 59. model.hubspot_source.stg_hubspot__deal_tmp:f0->46. model.hubspot_source.stg_hubspot__deal:f0
46. model.hubspot_source.stg_hubspot__deal
  • Input Column: 59. model.hubspot_source.stg_hubspot__deal_tmp[is_deleted]
    • Direct The is_deleted column is directly copied
    • Cleaning The column is renamed to is_deal_deleted and cast as BOOLEAN
    • Output Columns:
      • is_deal_deleted: Mapped after renaming and casting to BOOLEAN
60. model.hubspot_source.stg_hubspot__email_campaign

This SQL query performs a series of transformations on data from the 'stg_hubspot__email_campaign_tmp' table. It first creates a CTE with NULL values for all expected columns, then casts and renames columns from the source table. The query primarily focuses on data type casting and column renaming to standardize the output format.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_campaign_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS app_id,
    CAST(NULL AS TEXT) AS app_name,
    CAST(NULL AS INT) AS content_id,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS TEXT) AS name,
    CAST(NULL AS INT) AS num_included,
    CAST(NULL AS INT) AS num_queued,
    CAST(NULL AS TEXT) AS sub_type,
    CAST(NULL AS TEXT) AS subject,
    CAST(NULL AS TEXT) AS type
  FROM base
), fields AS (
  SELECT
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    app_id,
    app_name,
    content_id,
    id AS email_campaign_id,
    name AS email_campaign_name,
    num_included,
    num_queued,
    sub_type AS email_campaign_sub_type,
    subject AS email_campaign_subject,
    type AS email_campaign_type
  FROM macro
)
SELECT
  *
FROM fields
%3 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign _fivetran_synced app_id app_name content_id email_campaign_id email_campaign_name email_campaign_sub_type email_campaign_subject email_campaign_type num_included num_queued 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp id _fivetran_synced app_id content_id num_included num_queued sub_type type app_name name subject 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f4 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f1->60. model.hubspot_source.stg_hubspot__email_campaign:f0 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f2->60. model.hubspot_source.stg_hubspot__email_campaign:f1 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f3->60. model.hubspot_source.stg_hubspot__email_campaign:f3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f4->60. model.hubspot_source.stg_hubspot__email_campaign:f9 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f5->60. model.hubspot_source.stg_hubspot__email_campaign:f10 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f6->60. model.hubspot_source.stg_hubspot__email_campaign:f6 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f7->60. model.hubspot_source.stg_hubspot__email_campaign:f8 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f8->60. model.hubspot_source.stg_hubspot__email_campaign:f2 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f9->60. model.hubspot_source.stg_hubspot__email_campaign:f5 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f10->60. model.hubspot_source.stg_hubspot__email_campaign:f7
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
app_id integer The app ID.
app_name text The app name.
content_id bigint The ID of the content.
email_campaign_id bigint The ID of the email campaign.
email_campaign_name text The name of the email campaign.
email_campaign_sub_type integer The email campaign sub-type.
email_campaign_subject text The subject of the email campaign.
email_campaign_type text The email campaign type.
num_included integer The number of messages included as part of the email campaign.
num_queued integer The number of messages queued as part of the email campaign.
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp _fivetran_synced 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign _fivetran_synced 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns _fivetran_synced 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[_fivetran_synced]
    • Cleaning The column is cast to TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp app_id 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign app_id 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns app_id 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[app_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • app_id: Directly mapped
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[app_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • app_id: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp app_name 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign app_name 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns app_name 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[app_name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • app_name: Directly mapped
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[app_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • app_name: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp content_id 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign content_id 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns content_id 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[content_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • content_id: Directly mapped
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[content_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • content_id: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp id 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign email_campaign_id 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_id 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[id]
    • Cleaning The column is cast to INT and renamed
    • Output Columns:
      • email_campaign_id: Directly mapped after casting and renaming
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as the key to join with the email_metrics CTE
    • Output Columns:
      • email_campaign_id: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp name 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign email_campaign_name 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_name 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[name]
    • Cleaning The column is renamed
    • Output Columns:
      • email_campaign_name: Directly mapped after renaming
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[email_campaign_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_name: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp sub_type 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign email_campaign_sub_type 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_sub_type 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[sub_type]
    • Cleaning The column is renamed
    • Output Columns:
      • email_campaign_sub_type: Directly mapped after renaming
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[email_campaign_sub_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_sub_type: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp subject 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign email_campaign_subject 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_subject 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[subject]
    • Cleaning The column is cast as TEXT and renamed to 'email_campaign_subject'
    • Output Columns:
      • email_campaign_subject: The 'subject' column is directly mapped to 'email_campaign_subject' after being cast as TEXT
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[email_campaign_subject]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_subject: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp type 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign email_campaign_type 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_type 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[type]
    • Cleaning The column is renamed
    • Output Columns:
      • email_campaign_type: Directly mapped after renaming
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[email_campaign_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_type: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp num_included 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign num_included 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns num_included 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[num_included]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • num_included: Directly mapped
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[num_included]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • num_included: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp num_queued 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign num_queued 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns num_queued 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[num_queued]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • num_queued: Directly mapped
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[num_queued]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • num_queued: The column is directly copied to the output 'num_queued' column
61. model.hubspot_source.stg_hubspot__email_campaign_tmp

This SQL query selects all columns from the 'email_campaign' table in the 'hubspot' schema of the 'TEST' database. The comment suggests that this query is part of a dbt model and is used as a placeholder or template, possibly for compilation purposes or to satisfy SQLFluff formatting requirements.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.email_campaign
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp id _fivetran_synced app_id content_id num_included num_queued sub_type type app_name name subject 123. source.hubspot_source.hubspot.email_campaign 123. source.hubspot_source.hubspot.email_campaign
Name Type Comment
id bigint None
_fivetran_synced text None
app_id integer None
content_id bigint None
num_included integer None
num_queued integer None
sub_type integer None
type text None
app_name text None
name text None
subject text None
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp id 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign email_campaign_id 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_id 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[id]
    • Cleaning The column is cast to INT and renamed
    • Output Columns:
      • email_campaign_id: Directly mapped after casting and renaming
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as the key to join with the email_metrics CTE
    • Output Columns:
      • email_campaign_id: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp _fivetran_synced 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign _fivetran_synced 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns _fivetran_synced 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[_fivetran_synced]
    • Cleaning The column is cast to TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp app_id 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign app_id 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns app_id 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[app_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • app_id: Directly mapped
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[app_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • app_id: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp content_id 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign content_id 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns content_id 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[content_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • content_id: Directly mapped
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[content_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • content_id: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp num_included 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign num_included 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns num_included 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[num_included]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • num_included: Directly mapped
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[num_included]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • num_included: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp num_queued 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign num_queued 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns num_queued 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[num_queued]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • num_queued: Directly mapped
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[num_queued]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • num_queued: The column is directly copied to the output 'num_queued' column
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp sub_type 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign email_campaign_sub_type 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_sub_type 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[sub_type]
    • Cleaning The column is renamed
    • Output Columns:
      • email_campaign_sub_type: Directly mapped after renaming
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[email_campaign_sub_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_sub_type: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp type 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign email_campaign_type 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_type 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[type]
    • Cleaning The column is renamed
    • Output Columns:
      • email_campaign_type: Directly mapped after renaming
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[email_campaign_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_type: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp app_name 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign app_name 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns app_name 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[app_name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • app_name: Directly mapped
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[app_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • app_name: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp name 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign email_campaign_name 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_name 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[name]
    • Cleaning The column is renamed
    • Output Columns:
      • email_campaign_name: Directly mapped after renaming
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[email_campaign_name]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_name: Directly copied to the output
Column Lineage
%3 61. model.hubspot_source.stg_hubspot__email_campaign_tmp 61. model.hubspot_source.stg_hubspot__email_campaign_tmp subject 60. model.hubspot_source.stg_hubspot__email_campaign 60. model.hubspot_source.stg_hubspot__email_campaign email_campaign_subject 61. model.hubspot_source.stg_hubspot__email_campaign_tmp:f0->60. model.hubspot_source.stg_hubspot__email_campaign:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_subject 60. model.hubspot_source.stg_hubspot__email_campaign:f0->9. model.hubspot.hubspot__email_campaigns:f0
60. model.hubspot_source.stg_hubspot__email_campaign
  • Input Column: 61. model.hubspot_source.stg_hubspot__email_campaign_tmp[subject]
    • Cleaning The column is cast as TEXT and renamed to 'email_campaign_subject'
    • Output Columns:
      • email_campaign_subject: The 'subject' column is directly mapped to 'email_campaign_subject' after being cast as TEXT
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 60. model.hubspot_source.stg_hubspot__email_campaign[email_campaign_subject]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_subject: Directly copied to the output
62. model.hubspot_source.stg_hubspot__email_event

This SQL query performs data cleaning and transformation on the 'stg_hubspot__email_event' table. It starts by selecting all columns from a temporary table, then defines a macro with null values for all expected columns. Finally, it casts and renames various columns to standardize data types and improve column naming conventions.

Cleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS app_id,
    CAST(NULL AS TIMESTAMP) AS caused_by_created,
    CAST(NULL AS TEXT) AS caused_by_id,
    CAST(NULL AS TIMESTAMP) AS created,
    CAST(NULL AS INT) AS email_campaign_id,
    CAST(NULL AS BOOLEAN) AS filtered_event,
    CAST(NULL AS TEXT) AS id,
    CAST(NULL AS TIMESTAMP) AS obsoleted_by_created,
    CAST(NULL AS TEXT) AS obsoleted_by_id,
    CAST(NULL AS INT) AS portal_id,
    CAST(NULL AS TEXT) AS recipient,
    CAST(NULL AS TIMESTAMP) AS sent_by_created,
    CAST(NULL AS TEXT) AS sent_by_id,
    CAST(NULL AS TEXT) AS type
  FROM base
), fields AS (
  SELECT
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    app_id,
    CAST(caused_by_created AS TIMESTAMP) AS caused_timestamp,
    caused_by_id AS caused_by_event_id,
    CAST(created AS TIMESTAMP) AS created_timestamp,
    email_campaign_id,
    filtered_event AS is_filtered_event,
    id AS event_id,
    CAST(obsoleted_by_created AS TIMESTAMP) AS obsoleted_timestamp,
    obsoleted_by_id AS obsoleted_by_event_id,
    portal_id,
    recipient AS recipient_email_address,
    CAST(sent_by_created AS TIMESTAMP) AS sent_timestamp,
    sent_by_id AS sent_by_event_id,
    type AS event_type
  FROM macro
)
SELECT
  *
FROM fields
%3 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced app_id caused_by_event_id caused_timestamp created_timestamp email_campaign_id event_id event_type is_filtered_event obsoleted_by_event_id obsoleted_timestamp portal_id recipient_email_address sent_by_event_id sent_timestamp 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp id _fivetran_synced app_id caused_by_created caused_by_id created email_campaign_id obsoleted_by_created obsoleted_by_id portal_id sent_by_created sent_by_id type filtered_event recipient 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f6 85. model.hubspot_source.stg_hubspot__email_event_tmp:f1->62. model.hubspot_source.stg_hubspot__email_event:f0 85. model.hubspot_source.stg_hubspot__email_event_tmp:f2->62. model.hubspot_source.stg_hubspot__email_event:f1 85. model.hubspot_source.stg_hubspot__email_event_tmp:f3->62. model.hubspot_source.stg_hubspot__email_event:f3 85. model.hubspot_source.stg_hubspot__email_event_tmp:f4->62. model.hubspot_source.stg_hubspot__email_event:f2 85. model.hubspot_source.stg_hubspot__email_event_tmp:f5->62. model.hubspot_source.stg_hubspot__email_event:f4 85. model.hubspot_source.stg_hubspot__email_event_tmp:f6->62. model.hubspot_source.stg_hubspot__email_event:f5 85. model.hubspot_source.stg_hubspot__email_event_tmp:f7->62. model.hubspot_source.stg_hubspot__email_event:f10 85. model.hubspot_source.stg_hubspot__email_event_tmp:f8->62. model.hubspot_source.stg_hubspot__email_event:f9 85. model.hubspot_source.stg_hubspot__email_event_tmp:f9->62. model.hubspot_source.stg_hubspot__email_event:f11 85. model.hubspot_source.stg_hubspot__email_event_tmp:f10->62. model.hubspot_source.stg_hubspot__email_event:f14 85. model.hubspot_source.stg_hubspot__email_event_tmp:f11->62. model.hubspot_source.stg_hubspot__email_event:f13 85. model.hubspot_source.stg_hubspot__email_event_tmp:f12->62. model.hubspot_source.stg_hubspot__email_event:f7 85. model.hubspot_source.stg_hubspot__email_event_tmp:f13->62. model.hubspot_source.stg_hubspot__email_event:f8 85. model.hubspot_source.stg_hubspot__email_event_tmp:f14->62. model.hubspot_source.stg_hubspot__email_event:f12
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
app_id integer The ID of the app that sent the email.
caused_by_event_id integer The event ID which uniquely identifies the event which directly caused this event. If not applicable, this property is omitted.
caused_timestamp timestamp without time zone The timestamp of the event that caused this event.
created_timestamp timestamp without time zone The created timestamp of the event.
email_campaign_id integer The ID of the related email campaign.
event_id text The ID of the event.
event_type text The type of event.
is_filtered_event boolean A boolean representing whether the event has been filtered out of reporting based on customer reports settings or not.
obsoleted_by_event_id integer The event ID which uniquely identifies the follow-on event which makes this current event obsolete. If not applicable, this property is omitted.
obsoleted_timestamp timestamp without time zone The timestamp of the event that made the current event obsolete.
portal_id integer The hub ID.
recipient_email_address text The email address of the contact related to the event.
sent_by_event_id text The event ID which uniquely identifies the email message's SENT event. If not applicable, this property is omitted.
sent_timestamp timestamp without time zone The timestamp of the SENT event related to this event.
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends _fivetran_synced 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Cast as TIMESTAMP
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly selected in the final output without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp app_id 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event app_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[app_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • app_id: Directly mapped
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp caused_by_id 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event caused_by_event_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[caused_by_id]
    • Cleaning The column is renamed
    • Output Columns:
      • caused_by_event_id: Directly mapped and renamed
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp caused_by_created 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event caused_timestamp 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[caused_by_created]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • caused_timestamp: Cast as TIMESTAMP and renamed
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp created 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event created_timestamp 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends created_timestamp 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[created]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • created_timestamp: Cast as TIMESTAMP and renamed
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly selected in the final output without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event email_campaign_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_campaign_id 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_id 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[email_campaign_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • email_campaign_id: Directly mapped
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly selected in the final output without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used to join with the email_aggregate_status_change CTE
    • Output Columns:
      • email_campaign_id: Directly copied
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[email_campaign_id]
    • Integration This column is used as the key to join the email_sends table with the campaigns table
    • Aggregation This column is used in the GROUP BY clause of the email_metrics CTE
    • Output Columns:
      • email_campaign_id: It is indirectly mapped to the output email_campaign_id through the join operation
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp id 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event event_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends event_id 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped and renamed
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join the base table with the events table
    • Output Columns:
      • event_id: Directly copied to the output
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join tables
    • Output Columns:
      • event_id: Directly copied
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration The column is used as the key to join with the base table
    • Output Columns:
      • event_id: Directly copied
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join tables
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • event_id: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join tables
    • Output Columns:
      • event_id: Directly copied to the output
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join with the base table
    • Output Columns:
      • event_id: Directly copied from the base table
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join with the base table
    • Output Columns:
      • event_id: Directly copied to the output
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join the base table with the events table
    • Output Columns:
      • event_id: Directly copied from the base table
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join with the base table
    • Output Columns:
      • event_id: Indirectly mapped, as it's used for joining but also exists in the base table
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Direct This column is directly selected in the final output without any transformation
    • Integration This column is used as the key to join the base table with the events table
    • Output Columns:
      • event_id: Directly copied to the output
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join with the base table
    • Output Columns:
      • event_id: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[event_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • event_id: Directly copied
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp type 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event event_type 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • event_type: Directly mapped without changes
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp filtered_event 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event is_filtered_event 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[filtered_event]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • is_filtered_event: Directly mapped without changes
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp obsoleted_by_id 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event obsoleted_by_event_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[obsoleted_by_id]
    • Cleaning The column is renamed
    • Output Columns:
      • obsoleted_by_event_id: Directly mapped and renamed
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp obsoleted_by_created 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event obsoleted_timestamp 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[obsoleted_by_created]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • obsoleted_timestamp: Cast as TIMESTAMP and renamed
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp portal_id 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event portal_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[portal_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • portal_id: Directly mapped
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp recipient 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event recipient_email_address 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends recipient_email_address 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:header
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[recipient]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • recipient_email_address: Directly mapped without changes
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct This column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly mapped
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • recipient_email_address: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[recipient_email_address]
    • Integration used as the key to join with contacts table
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 31. model.hubspot.int_hubspot__email_event_aggregates 31. model.hubspot.int_hubspot__email_event_aggregates email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->31. model.hubspot.int_hubspot__email_event_aggregates:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_id unsubscribes was_unsubcribed 31. model.hubspot.int_hubspot__email_event_aggregates:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change email_send_id 20. model.hubspot.hubspot__email_event_status_change:f0->30. model.hubspot.int_hubspot__email_aggregate_status_change:f0 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f2->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f2->5. model.hubspot.hubspot__contacts:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f2->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f2->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f2->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f2->9. model.hubspot.hubspot__email_campaigns:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f2->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f2->4. model.hubspot.hubspot__contact_lists:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed to 'email_send_id' in the output
    • Output Columns:
      • email_send_id: Renamed and directly copied to the output
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed for clarity
    • Output Columns:
      • email_send_id: Directly mapped and renamed
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied and renamed
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
31. model.hubspot.int_hubspot__email_event_aggregates
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Filtering This column is used to filter out null values
    • Integration It's used as the key to group events
    • Aggregation It's used as the grouping key for all aggregations
    • Output Columns:
      • email_send_id: This column is directly mapped to email_send_id in the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
30. model.hubspot.int_hubspot__email_aggregate_status_change
  • Input Column: 20. model.hubspot.hubspot__email_event_status_change[email_send_id]
    • Filtering The column is filtered to exclude null values (WHERE NOT email_send_id IS NULL)
    • Aggregation The column is used in the GROUP BY clause
    • Output Columns:
      • email_send_id: This column is directly copied to the output
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unsubscribes]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unsubscribes: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate the total number of unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Summed up for each contact
      • total_unique_unsubscribes: Counted as unique occurrences for each contact
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is used to count the total number of unsubscribe email events and unique unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribe events
      • total_unique_unsubscribes: Aggregated count of unique unsubscribe events
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate the total number of unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Summed up to get the total number of unsubscribe events.
      • total_unique_unsubscribes: Counted to get the number of unique email sends with unsubscribe events.
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is likely used to calculate the total_unsubscribes and total_unique_unsubscribes metrics in the output.
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribes
      • total_unique_unsubscribes: Aggregated count of unique unsubscribes
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate total unsubscribes and unique unsubscribes
    • Output Columns:
      • total_unsubscribes: Sum of all unsubscribes
      • total_unique_unsubscribes: Count of distinct unsubscribes
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is likely used to calculate the total_unsubscribes and total_unique_unsubscribes in the output
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribes
      • total_unique_unsubscribes: Aggregated count of unique unsubscribes
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_created 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_timestamp 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_timestamp 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_created]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • sent_timestamp: Directly mapped after casting to TIMESTAMP
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed to 'email_send_timestamp' in the output
    • Output Columns:
      • email_send_timestamp: Renamed and directly copied to the output
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed for clarity
    • Output Columns:
      • email_send_timestamp: Directly mapped and renamed
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied and renamed
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[email_send_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output
63. model.hubspot_source.stg_hubspot__email_event_bounce

This SQL query performs a data cleaning and transformation process on the 'stg_hubspot__email_event_bounce_tmp' table. It first creates a base CTE with all columns from the source table. Then, it defines a macro CTE that sets up the desired data types for each column. Finally, it renames and casts the columns in the fields CTE before selecting all columns from the final result.

Cleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_bounce_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TEXT) AS category,
    CAST(NULL AS TEXT) AS id,
    CAST(NULL AS TEXT) AS response,
    CAST(NULL AS TEXT) AS status
  FROM base
), fields AS (
  SELECT
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    category AS bounce_category,
    id AS event_id,
    response AS returned_response,
    status AS returned_status
  FROM macro
)
SELECT
  *
FROM fields
%3 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce _fivetran_synced bounce_category event_id returned_response returned_status 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp id _fivetran_synced category status response 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f0->63. model.hubspot_source.stg_hubspot__email_event_bounce:f2 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f1->63. model.hubspot_source.stg_hubspot__email_event_bounce:f0 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f2->63. model.hubspot_source.stg_hubspot__email_event_bounce:f1 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f3->63. model.hubspot_source.stg_hubspot__email_event_bounce:f4 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f4->63. model.hubspot_source.stg_hubspot__email_event_bounce:f3
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
bounce_category text The best-guess of the type of bounce encountered. If an appropriate category couldn't be determined, this property is omitted. See below for the possible values. Note that this is a derived value, and may be modified at any time to improve the accuracy of classification.
event_id text The ID of the event.
returned_response text The full response from the recipient's email server.
returned_status integer The status code returned from the recipient's email server.
Column Lineage
%3 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp _fivetran_synced 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce _fivetran_synced 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f0->63. model.hubspot_source.stg_hubspot__email_event_bounce:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce _fivetran_synced 63. model.hubspot_source.stg_hubspot__email_event_bounce:f0->10. model.hubspot.hubspot__email_event_bounce:f0
63. model.hubspot_source.stg_hubspot__email_event_bounce
  • Input Column: 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TIMESTAMP in both the macro and fields CTEs
    • Output Columns:
      • _fivetran_synced: It is directly mapped to _fivetran_synced after casting
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 63. model.hubspot_source.stg_hubspot__email_event_bounce[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp category 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce bounce_category 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f0->63. model.hubspot_source.stg_hubspot__email_event_bounce:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce bounce_category 63. model.hubspot_source.stg_hubspot__email_event_bounce:f0->10. model.hubspot.hubspot__email_event_bounce:f0
63. model.hubspot_source.stg_hubspot__email_event_bounce
  • Input Column: 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp[category]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • bounce_category: It is directly mapped to bounce_category after casting
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 63. model.hubspot_source.stg_hubspot__email_event_bounce[bounce_category]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • bounce_category: Directly copied to the output
Column Lineage
%3 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp id 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce event_id 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f0->63. model.hubspot_source.stg_hubspot__email_event_bounce:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce event_id 63. model.hubspot_source.stg_hubspot__email_event_bounce:f0->10. model.hubspot.hubspot__email_event_bounce:f0
63. model.hubspot_source.stg_hubspot__email_event_bounce
  • Input Column: 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp[id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • event_id: It is directly mapped to event_id after casting
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 63. model.hubspot_source.stg_hubspot__email_event_bounce[event_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as a key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp response 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce returned_response 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f0->63. model.hubspot_source.stg_hubspot__email_event_bounce:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce returned_response 63. model.hubspot_source.stg_hubspot__email_event_bounce:f0->10. model.hubspot.hubspot__email_event_bounce:f0
63. model.hubspot_source.stg_hubspot__email_event_bounce
  • Input Column: 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp[response]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • returned_response: It is directly mapped to returned_response after casting
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 63. model.hubspot_source.stg_hubspot__email_event_bounce[returned_response]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • returned_response: Directly copied to the output
Column Lineage
%3 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp status 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce returned_status 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f0->63. model.hubspot_source.stg_hubspot__email_event_bounce:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce returned_status 63. model.hubspot_source.stg_hubspot__email_event_bounce:f0->10. model.hubspot.hubspot__email_event_bounce:f0
63. model.hubspot_source.stg_hubspot__email_event_bounce
  • Input Column: 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp[status]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • returned_status: It is directly mapped to returned_status after casting
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 63. model.hubspot_source.stg_hubspot__email_event_bounce[returned_status]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • returned_status: Directly copied to the output
64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp

This SQL query selects all columns from the 'email_event_bounce' table in the 'hubspot' schema of the 'TEST' database. It appears to be a staging query that extracts raw data without any transformations or filters.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.email_event_bounce
%3 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp id _fivetran_synced category status response 125. source.hubspot_source.hubspot.email_event_bounce 125. source.hubspot_source.hubspot.email_event_bounce
Name Type Comment
id text None
_fivetran_synced text None
category text None
status integer None
response text None
Column Lineage
%3 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp id 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce event_id 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f0->63. model.hubspot_source.stg_hubspot__email_event_bounce:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce event_id 63. model.hubspot_source.stg_hubspot__email_event_bounce:f0->10. model.hubspot.hubspot__email_event_bounce:f0
63. model.hubspot_source.stg_hubspot__email_event_bounce
  • Input Column: 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp[id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • event_id: It is directly mapped to event_id after casting
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 63. model.hubspot_source.stg_hubspot__email_event_bounce[event_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as a key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp _fivetran_synced 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce _fivetran_synced 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f0->63. model.hubspot_source.stg_hubspot__email_event_bounce:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce _fivetran_synced 63. model.hubspot_source.stg_hubspot__email_event_bounce:f0->10. model.hubspot.hubspot__email_event_bounce:f0
63. model.hubspot_source.stg_hubspot__email_event_bounce
  • Input Column: 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TIMESTAMP in both the macro and fields CTEs
    • Output Columns:
      • _fivetran_synced: It is directly mapped to _fivetran_synced after casting
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 63. model.hubspot_source.stg_hubspot__email_event_bounce[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp category 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce bounce_category 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f0->63. model.hubspot_source.stg_hubspot__email_event_bounce:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce bounce_category 63. model.hubspot_source.stg_hubspot__email_event_bounce:f0->10. model.hubspot.hubspot__email_event_bounce:f0
63. model.hubspot_source.stg_hubspot__email_event_bounce
  • Input Column: 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp[category]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • bounce_category: It is directly mapped to bounce_category after casting
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 63. model.hubspot_source.stg_hubspot__email_event_bounce[bounce_category]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • bounce_category: Directly copied to the output
Column Lineage
%3 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp status 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce returned_status 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f0->63. model.hubspot_source.stg_hubspot__email_event_bounce:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce returned_status 63. model.hubspot_source.stg_hubspot__email_event_bounce:f0->10. model.hubspot.hubspot__email_event_bounce:f0
63. model.hubspot_source.stg_hubspot__email_event_bounce
  • Input Column: 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp[status]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • returned_status: It is directly mapped to returned_status after casting
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 63. model.hubspot_source.stg_hubspot__email_event_bounce[returned_status]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • returned_status: Directly copied to the output
Column Lineage
%3 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp response 63. model.hubspot_source.stg_hubspot__email_event_bounce 63. model.hubspot_source.stg_hubspot__email_event_bounce returned_response 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp:f0->63. model.hubspot_source.stg_hubspot__email_event_bounce:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce returned_response 63. model.hubspot_source.stg_hubspot__email_event_bounce:f0->10. model.hubspot.hubspot__email_event_bounce:f0
63. model.hubspot_source.stg_hubspot__email_event_bounce
  • Input Column: 64. model.hubspot_source.stg_hubspot__email_event_bounce_tmp[response]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • returned_response: It is directly mapped to returned_response after casting
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 63. model.hubspot_source.stg_hubspot__email_event_bounce[returned_response]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • returned_response: Directly copied to the output
65. model.hubspot_source.stg_hubspot__email_event_click

This SQL query performs a series of transformations on data from the 'stg_hubspot__email_event_click_tmp' table. It first creates a base CTE with all columns from the source table. Then, it defines a macro CTE that sets up a structure with NULL values for specific columns. Finally, it creates a fields CTE that casts and renames columns from the macro CTE. The main select statement then retrieves all columns from the fields CTE.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_click_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TEXT) AS browser,
    CAST(NULL AS TEXT) AS id,
    CAST(NULL AS TEXT) AS ip_address,
    CAST(NULL AS TEXT) AS location,
    CAST(NULL AS TEXT) AS referer,
    CAST(NULL AS TEXT) AS url,
    CAST(NULL AS TEXT) AS user_agent
  FROM base
), fields AS (
  SELECT
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    browser,
    id AS event_id,
    ip_address,
    location AS geo_location,
    referer AS referer_url,
    url AS click_url,
    user_agent
  FROM macro
)
SELECT
  *
FROM fields
%3 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click _fivetran_synced browser click_url event_id geo_location ip_address referer_url user_agent 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp id _fivetran_synced referer browser location ip_address url user_agent 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f3 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f1->65. model.hubspot_source.stg_hubspot__email_event_click:f0 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f2->65. model.hubspot_source.stg_hubspot__email_event_click:f6 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f3->65. model.hubspot_source.stg_hubspot__email_event_click:f1 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f4->65. model.hubspot_source.stg_hubspot__email_event_click:f4 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f5->65. model.hubspot_source.stg_hubspot__email_event_click:f5 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f6->65. model.hubspot_source.stg_hubspot__email_event_click:f2 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f7->65. model.hubspot_source.stg_hubspot__email_event_click:f7
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
browser text A JSON object representing the browser which serviced the event. Its comprised of the properties: 'name', 'family', 'producer', 'producer_url', 'type', 'url', 'version'.
click_url text The URL within the message that the recipient clicked.
event_id text The ID of the event.
geo_location text A JSON object representing the location where the event occurred. It's comprised of the properties: 'city', 'state', 'country'.
ip_address integer The contact's IP address when the event occurred.
referer_url integer The URL of the webpage that linked to the URL clicked. Whether this is provided, and what its value is, is determined by the recipient's email client.
user_agent text The user agent responsible for the event, e.g. “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36”
Column Lineage
%3 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp _fivetran_synced 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click _fivetran_synced 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks _fivetran_synced 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp browser 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click browser 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks browser 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[browser]
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • browser: Directly mapped after casting
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[browser]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • browser: Directly copied to the output
Column Lineage
%3 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp url 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click click_url 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks click_url 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[url]
    • Cleaning The column is cast as TEXT and renamed to 'click_url'
    • Output Columns:
      • click_url: Directly mapped after casting and renaming
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[click_url]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • click_url: Directly copied to the output
Column Lineage
%3 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp id 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click event_id 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks event_id 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[id]
    • Cleaning The column is cast as TEXT and renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped after casting and renaming
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[event_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp location 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click geo_location 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks geo_location 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[location]
    • Cleaning The column is cast as TEXT and renamed to 'geo_location'
    • Output Columns:
      • geo_location: Directly mapped after casting and renaming
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[geo_location]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • geo_location: Directly copied to the output
Column Lineage
%3 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp ip_address 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click ip_address 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks ip_address 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[ip_address]
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • ip_address: Directly mapped after casting
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[ip_address]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • ip_address: Directly copied to the output
Column Lineage
%3 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp referer 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click referer_url 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks referer_url 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[referer]
    • Cleaning The column is cast as TEXT and renamed to 'referer_url'
    • Output Columns:
      • referer_url: Directly mapped after casting and renaming
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[referer_url]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • referer_url: Directly copied to the output
Column Lineage
%3 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp user_agent 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click user_agent 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks user_agent 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[user_agent]
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • user_agent: Directly mapped after casting
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[user_agent]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • user_agent: Directly copied to the output
66. model.hubspot_source.stg_hubspot__email_event_click_tmp

This SQL query is a basic SELECT statement that retrieves all columns from the 'email_event_click' table in the 'hubspot' schema of the 'TEST' database. The query doesn't perform any filtering, transformation, or aggregation of the data. It's a straightforward extraction of all available data from the specified table.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.email_event_click
%3 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp id _fivetran_synced referer browser location ip_address url user_agent 126. source.hubspot_source.hubspot.email_event_click 126. source.hubspot_source.hubspot.email_event_click
Name Type Comment
id text None
_fivetran_synced text None
referer integer None
browser text None
location text None
ip_address integer None
url text None
user_agent text None
Column Lineage
%3 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp id 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click event_id 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks event_id 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[id]
    • Cleaning The column is cast as TEXT and renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped after casting and renaming
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[event_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp _fivetran_synced 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click _fivetran_synced 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks _fivetran_synced 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp referer 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click referer_url 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks referer_url 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[referer]
    • Cleaning The column is cast as TEXT and renamed to 'referer_url'
    • Output Columns:
      • referer_url: Directly mapped after casting and renaming
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[referer_url]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • referer_url: Directly copied to the output
Column Lineage
%3 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp browser 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click browser 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks browser 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[browser]
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • browser: Directly mapped after casting
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[browser]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • browser: Directly copied to the output
Column Lineage
%3 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp location 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click geo_location 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks geo_location 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[location]
    • Cleaning The column is cast as TEXT and renamed to 'geo_location'
    • Output Columns:
      • geo_location: Directly mapped after casting and renaming
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[geo_location]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • geo_location: Directly copied to the output
Column Lineage
%3 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp ip_address 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click ip_address 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks ip_address 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[ip_address]
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • ip_address: Directly mapped after casting
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[ip_address]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • ip_address: Directly copied to the output
Column Lineage
%3 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp url 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click click_url 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks click_url 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[url]
    • Cleaning The column is cast as TEXT and renamed to 'click_url'
    • Output Columns:
      • click_url: Directly mapped after casting and renaming
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[click_url]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • click_url: Directly copied to the output
Column Lineage
%3 66. model.hubspot_source.stg_hubspot__email_event_click_tmp 66. model.hubspot_source.stg_hubspot__email_event_click_tmp user_agent 65. model.hubspot_source.stg_hubspot__email_event_click 65. model.hubspot_source.stg_hubspot__email_event_click user_agent 66. model.hubspot_source.stg_hubspot__email_event_click_tmp:f0->65. model.hubspot_source.stg_hubspot__email_event_click:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks user_agent 65. model.hubspot_source.stg_hubspot__email_event_click:f0->11. model.hubspot.hubspot__email_event_clicks:f0
65. model.hubspot_source.stg_hubspot__email_event_click
  • Input Column: 66. model.hubspot_source.stg_hubspot__email_event_click_tmp[user_agent]
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • user_agent: Directly mapped after casting
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 65. model.hubspot_source.stg_hubspot__email_event_click[user_agent]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • user_agent: Directly copied to the output
67. model.hubspot_source.stg_hubspot__email_event_deferred

This SQL query performs a series of transformations on data from the 'stg_hubspot__email_event_deferred_tmp' table. It first creates a CTE with all columns from the source table, then defines a macro CTE with NULL values and specific data types for certain columns. Finally, it selects and renames columns from the macro CTE, casting the '_fivetran_synced' column to TIMESTAMP type. The query essentially creates a standardized structure for the email event deferred data.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_deferred_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS attempt,
    CAST(NULL AS TEXT) AS id,
    CAST(NULL AS TEXT) AS response
  FROM base
), fields AS (
  SELECT
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    attempt AS attempt_number,
    id AS event_id,
    response AS returned_response
  FROM macro
)
SELECT
  *
FROM fields
%3 67. model.hubspot_source.stg_hubspot__email_event_deferred 67. model.hubspot_source.stg_hubspot__email_event_deferred _fivetran_synced attempt_number event_id returned_response 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp id _fivetran_synced attempt response 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp:f0->67. model.hubspot_source.stg_hubspot__email_event_deferred:f2 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp:f1->67. model.hubspot_source.stg_hubspot__email_event_deferred:f0 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp:f2->67. model.hubspot_source.stg_hubspot__email_event_deferred:f1 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp:f3->67. model.hubspot_source.stg_hubspot__email_event_deferred:f3
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
attempt_number integer The delivery attempt number.
event_id text The ID of the event.
returned_response integer The full response from the recipient's email server.
Column Lineage
%3 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp _fivetran_synced 67. model.hubspot_source.stg_hubspot__email_event_deferred 67. model.hubspot_source.stg_hubspot__email_event_deferred _fivetran_synced 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp:f0->67. model.hubspot_source.stg_hubspot__email_event_deferred:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred _fivetran_synced 67. model.hubspot_source.stg_hubspot__email_event_deferred:f0->12. model.hubspot.hubspot__email_event_deferred:f0
67. model.hubspot_source.stg_hubspot__email_event_deferred
  • Input Column: 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TIMESTAMP in both the macro CTE and the final select statement
    • Output Columns:
      • _fivetran_synced: It is directly mapped to _fivetran_synced after being cast as TIMESTAMP
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 67. model.hubspot_source.stg_hubspot__email_event_deferred[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp attempt 67. model.hubspot_source.stg_hubspot__email_event_deferred 67. model.hubspot_source.stg_hubspot__email_event_deferred attempt_number 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp:f0->67. model.hubspot_source.stg_hubspot__email_event_deferred:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred attempt_number 67. model.hubspot_source.stg_hubspot__email_event_deferred:f0->12. model.hubspot.hubspot__email_event_deferred:f0
67. model.hubspot_source.stg_hubspot__email_event_deferred
  • Input Column: 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp[attempt]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT in the macro CTE
    • Output Columns:
      • attempt_number: It is directly mapped to attempt_number after being cast as INT
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 67. model.hubspot_source.stg_hubspot__email_event_deferred[attempt_number]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • attempt_number: Directly copied to the output
Column Lineage
%3 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp id 67. model.hubspot_source.stg_hubspot__email_event_deferred 67. model.hubspot_source.stg_hubspot__email_event_deferred event_id 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp:f0->67. model.hubspot_source.stg_hubspot__email_event_deferred:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred event_id 67. model.hubspot_source.stg_hubspot__email_event_deferred:f0->12. model.hubspot.hubspot__email_event_deferred:f0
67. model.hubspot_source.stg_hubspot__email_event_deferred
  • Input Column: 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp[id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • event_id: It is directly mapped to event_id after being cast as TEXT
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 67. model.hubspot_source.stg_hubspot__email_event_deferred[event_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp response 67. model.hubspot_source.stg_hubspot__email_event_deferred 67. model.hubspot_source.stg_hubspot__email_event_deferred returned_response 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp:f0->67. model.hubspot_source.stg_hubspot__email_event_deferred:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred returned_response 67. model.hubspot_source.stg_hubspot__email_event_deferred:f0->12. model.hubspot.hubspot__email_event_deferred:f0
67. model.hubspot_source.stg_hubspot__email_event_deferred
  • Input Column: 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp[response]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • returned_response: It is directly mapped to returned_response after being cast as TEXT
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 67. model.hubspot_source.stg_hubspot__email_event_deferred[returned_response]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • returned_response: Directly copied to the output
68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp

This SQL query selects all columns from the 'email_event_deferred' table in the 'hubspot' schema of the 'TEST' database. It appears to be a staging query that extracts raw data without any transformations or filters.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.email_event_deferred
%3 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp id _fivetran_synced attempt response 127. source.hubspot_source.hubspot.email_event_deferred 127. source.hubspot_source.hubspot.email_event_deferred
Name Type Comment
id text None
_fivetran_synced text None
attempt integer None
response integer None
Column Lineage
%3 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp id 67. model.hubspot_source.stg_hubspot__email_event_deferred 67. model.hubspot_source.stg_hubspot__email_event_deferred event_id 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp:f0->67. model.hubspot_source.stg_hubspot__email_event_deferred:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred event_id 67. model.hubspot_source.stg_hubspot__email_event_deferred:f0->12. model.hubspot.hubspot__email_event_deferred:f0
67. model.hubspot_source.stg_hubspot__email_event_deferred
  • Input Column: 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp[id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • event_id: It is directly mapped to event_id after being cast as TEXT
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 67. model.hubspot_source.stg_hubspot__email_event_deferred[event_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp _fivetran_synced 67. model.hubspot_source.stg_hubspot__email_event_deferred 67. model.hubspot_source.stg_hubspot__email_event_deferred _fivetran_synced 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp:f0->67. model.hubspot_source.stg_hubspot__email_event_deferred:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred _fivetran_synced 67. model.hubspot_source.stg_hubspot__email_event_deferred:f0->12. model.hubspot.hubspot__email_event_deferred:f0
67. model.hubspot_source.stg_hubspot__email_event_deferred
  • Input Column: 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TIMESTAMP in both the macro CTE and the final select statement
    • Output Columns:
      • _fivetran_synced: It is directly mapped to _fivetran_synced after being cast as TIMESTAMP
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 67. model.hubspot_source.stg_hubspot__email_event_deferred[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp attempt 67. model.hubspot_source.stg_hubspot__email_event_deferred 67. model.hubspot_source.stg_hubspot__email_event_deferred attempt_number 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp:f0->67. model.hubspot_source.stg_hubspot__email_event_deferred:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred attempt_number 67. model.hubspot_source.stg_hubspot__email_event_deferred:f0->12. model.hubspot.hubspot__email_event_deferred:f0
67. model.hubspot_source.stg_hubspot__email_event_deferred
  • Input Column: 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp[attempt]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT in the macro CTE
    • Output Columns:
      • attempt_number: It is directly mapped to attempt_number after being cast as INT
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 67. model.hubspot_source.stg_hubspot__email_event_deferred[attempt_number]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • attempt_number: Directly copied to the output
Column Lineage
%3 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp response 67. model.hubspot_source.stg_hubspot__email_event_deferred 67. model.hubspot_source.stg_hubspot__email_event_deferred returned_response 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp:f0->67. model.hubspot_source.stg_hubspot__email_event_deferred:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred returned_response 67. model.hubspot_source.stg_hubspot__email_event_deferred:f0->12. model.hubspot.hubspot__email_event_deferred:f0
67. model.hubspot_source.stg_hubspot__email_event_deferred
  • Input Column: 68. model.hubspot_source.stg_hubspot__email_event_deferred_tmp[response]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • returned_response: It is directly mapped to returned_response after being cast as TEXT
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 67. model.hubspot_source.stg_hubspot__email_event_deferred[returned_response]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • returned_response: Directly copied to the output
69. model.hubspot_source.stg_hubspot__email_event_delivered

This SQL query performs data type casting and column renaming for the Hubspot email event delivered data. It starts with a base CTE that selects all columns from a temporary staging table. Then, it creates a macro CTE that defines the expected data types for specific columns. Finally, it applies these data type casts and renames some columns in the fields CTE before selecting all resulting columns.

Cleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_delivered_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TEXT) AS id,
    CAST(NULL AS TEXT) AS response,
    CAST(NULL AS TEXT) AS smtp_id
  FROM base
), fields AS (
  SELECT
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    id AS event_id,
    response AS returned_response,
    smtp_id
  FROM macro
)
SELECT
  *
FROM fields
%3 69. model.hubspot_source.stg_hubspot__email_event_delivered 69. model.hubspot_source.stg_hubspot__email_event_delivered _fivetran_synced event_id returned_response smtp_id 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp id _fivetran_synced response smtp_id 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp:f0->69. model.hubspot_source.stg_hubspot__email_event_delivered:f1 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp:f1->69. model.hubspot_source.stg_hubspot__email_event_delivered:f0 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp:f2->69. model.hubspot_source.stg_hubspot__email_event_delivered:f2 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp:f3->69. model.hubspot_source.stg_hubspot__email_event_delivered:f3
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
event_id text The ID of the event.
returned_response text The full response from the recipient's email server.
smtp_id text An ID attached to the message by HubSpot.
Column Lineage
%3 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp _fivetran_synced 69. model.hubspot_source.stg_hubspot__email_event_delivered 69. model.hubspot_source.stg_hubspot__email_event_delivered _fivetran_synced 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp:f0->69. model.hubspot_source.stg_hubspot__email_event_delivered:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered _fivetran_synced 69. model.hubspot_source.stg_hubspot__email_event_delivered:f0->13. model.hubspot.hubspot__email_event_delivered:f0
69. model.hubspot_source.stg_hubspot__email_event_delivered
  • Input Column: 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TIMESTAMP in the macro CTE and then in the fields CTE
    • Output Columns:
      • _fivetran_synced: It is directly mapped to the '_fivetran_synced' column in the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 69. model.hubspot_source.stg_hubspot__email_event_delivered[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp id 69. model.hubspot_source.stg_hubspot__email_event_delivered 69. model.hubspot_source.stg_hubspot__email_event_delivered event_id 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp:f0->69. model.hubspot_source.stg_hubspot__email_event_delivered:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered event_id 69. model.hubspot_source.stg_hubspot__email_event_delivered:f0->13. model.hubspot.hubspot__email_event_delivered:f0
69. model.hubspot_source.stg_hubspot__email_event_delivered
  • Input Column: 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp[id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • event_id: It is directly mapped to the 'event_id' column in the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 69. model.hubspot_source.stg_hubspot__email_event_delivered[event_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as a key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp response 69. model.hubspot_source.stg_hubspot__email_event_delivered 69. model.hubspot_source.stg_hubspot__email_event_delivered returned_response 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp:f0->69. model.hubspot_source.stg_hubspot__email_event_delivered:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered returned_response 69. model.hubspot_source.stg_hubspot__email_event_delivered:f0->13. model.hubspot.hubspot__email_event_delivered:f0
69. model.hubspot_source.stg_hubspot__email_event_delivered
  • Input Column: 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp[response]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • returned_response: It is directly mapped to the 'returned_response' column in the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 69. model.hubspot_source.stg_hubspot__email_event_delivered[returned_response]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • returned_response: Directly copied to the output
Column Lineage
%3 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp smtp_id 69. model.hubspot_source.stg_hubspot__email_event_delivered 69. model.hubspot_source.stg_hubspot__email_event_delivered smtp_id 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp:f0->69. model.hubspot_source.stg_hubspot__email_event_delivered:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered smtp_id 69. model.hubspot_source.stg_hubspot__email_event_delivered:f0->13. model.hubspot.hubspot__email_event_delivered:f0
69. model.hubspot_source.stg_hubspot__email_event_delivered
  • Input Column: 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp[smtp_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • smtp_id: It is directly mapped to the 'smtp_id' column in the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 69. model.hubspot_source.stg_hubspot__email_event_delivered[smtp_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • smtp_id: Directly copied to the output
70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp

This SQL query selects all columns from the 'email_event_delivered' table in the 'hubspot' schema of the 'TEST' database. The comment suggests that no columns were returned, possibly because the relation doesn't exist yet or all columns were excluded. The query appears to be a placeholder or template, potentially used for dbt compilation and to satisfy SQLFluff requirements.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.email_event_delivered
%3 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp id _fivetran_synced response smtp_id 128. source.hubspot_source.hubspot.email_event_delivered 128. source.hubspot_source.hubspot.email_event_delivered
Name Type Comment
id text None
_fivetran_synced text None
response text None
smtp_id text None
Column Lineage
%3 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp id 69. model.hubspot_source.stg_hubspot__email_event_delivered 69. model.hubspot_source.stg_hubspot__email_event_delivered event_id 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp:f0->69. model.hubspot_source.stg_hubspot__email_event_delivered:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered event_id 69. model.hubspot_source.stg_hubspot__email_event_delivered:f0->13. model.hubspot.hubspot__email_event_delivered:f0
69. model.hubspot_source.stg_hubspot__email_event_delivered
  • Input Column: 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp[id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • event_id: It is directly mapped to the 'event_id' column in the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 69. model.hubspot_source.stg_hubspot__email_event_delivered[event_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as a key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp _fivetran_synced 69. model.hubspot_source.stg_hubspot__email_event_delivered 69. model.hubspot_source.stg_hubspot__email_event_delivered _fivetran_synced 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp:f0->69. model.hubspot_source.stg_hubspot__email_event_delivered:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered _fivetran_synced 69. model.hubspot_source.stg_hubspot__email_event_delivered:f0->13. model.hubspot.hubspot__email_event_delivered:f0
69. model.hubspot_source.stg_hubspot__email_event_delivered
  • Input Column: 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TIMESTAMP in the macro CTE and then in the fields CTE
    • Output Columns:
      • _fivetran_synced: It is directly mapped to the '_fivetran_synced' column in the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 69. model.hubspot_source.stg_hubspot__email_event_delivered[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp response 69. model.hubspot_source.stg_hubspot__email_event_delivered 69. model.hubspot_source.stg_hubspot__email_event_delivered returned_response 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp:f0->69. model.hubspot_source.stg_hubspot__email_event_delivered:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered returned_response 69. model.hubspot_source.stg_hubspot__email_event_delivered:f0->13. model.hubspot.hubspot__email_event_delivered:f0
69. model.hubspot_source.stg_hubspot__email_event_delivered
  • Input Column: 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp[response]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • returned_response: It is directly mapped to the 'returned_response' column in the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 69. model.hubspot_source.stg_hubspot__email_event_delivered[returned_response]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • returned_response: Directly copied to the output
Column Lineage
%3 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp smtp_id 69. model.hubspot_source.stg_hubspot__email_event_delivered 69. model.hubspot_source.stg_hubspot__email_event_delivered smtp_id 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp:f0->69. model.hubspot_source.stg_hubspot__email_event_delivered:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered smtp_id 69. model.hubspot_source.stg_hubspot__email_event_delivered:f0->13. model.hubspot.hubspot__email_event_delivered:f0
69. model.hubspot_source.stg_hubspot__email_event_delivered
  • Input Column: 70. model.hubspot_source.stg_hubspot__email_event_delivered_tmp[smtp_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the macro CTE
    • Output Columns:
      • smtp_id: It is directly mapped to the 'smtp_id' column in the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 69. model.hubspot_source.stg_hubspot__email_event_delivered[smtp_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • smtp_id: Directly copied to the output
71. model.hubspot_source.stg_hubspot__email_event_dropped

This SQL query performs data type casting and column renaming for the 'stg_hubspot__email_event_dropped' model. It starts by selecting all columns from a temporary table, then defines a structure with null values and specific data types. Finally, it casts and renames columns according to the defined structure, preparing the data for further use in the data pipeline.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_dropped_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TEXT) AS bcc,
    CAST(NULL AS TEXT) AS cc,
    CAST(NULL AS TEXT) AS drop_message,
    CAST(NULL AS TEXT) AS drop_reason,
    CAST(NULL AS TEXT) AS id,
    CAST(NULL AS TEXT) AS reply_to,
    CAST(NULL AS TEXT) AS subject,
    CAST(NULL AS TEXT) AS from_email
  FROM base
), fields AS (
  SELECT
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    bcc AS bcc_emails,
    cc AS cc_emails,
    drop_message,
    drop_reason,
    from_email, /* source field name = from ; alias declared in macros/get_email_event_dropped_columns.sql */
    id AS event_id,
    reply_to AS reply_to_email,
    subject AS email_subject
  FROM macro
)
SELECT
  *
FROM fields
%3 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped _fivetran_synced bcc_emails cc_emails drop_message drop_reason email_subject event_id from_email reply_to_email 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp id _fivetran_synced drop_reason bcc cc drop_message from reply_to subject 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f6 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f1->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f2->71. model.hubspot_source.stg_hubspot__email_event_dropped:f4 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f3->71. model.hubspot_source.stg_hubspot__email_event_dropped:f1 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f4->71. model.hubspot_source.stg_hubspot__email_event_dropped:f2 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f5->71. model.hubspot_source.stg_hubspot__email_event_dropped:f3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f6->71. model.hubspot_source.stg_hubspot__email_event_dropped:f7 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f7->71. model.hubspot_source.stg_hubspot__email_event_dropped:f8 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f8->71. model.hubspot_source.stg_hubspot__email_event_dropped:f5
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
bcc_emails text The 'bcc' field of the email message.
cc_emails text The 'cc' field of the email message.
drop_message text The raw message describing why the email message was dropped. This will usually provide additional details beyond 'dropReason'.
drop_reason text The reason why the email message was dropped. See below for the possible values.
email_subject text The subject line of the email message.
event_id text The ID of the event.
from_email text The 'from' field of the email message.
reply_to_email text The 'reply-to' field of the email message.
Column Lineage
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp _fivetran_synced 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped _fivetran_synced 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped _fivetran_synced 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP in both the macro and fields CTEs.
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp bcc 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped bcc_emails 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped bcc_emails 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[bcc]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed in the fields CTE.
    • Output Columns:
      • bcc_emails: Directly mapped after renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[bcc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • bcc_emails: Directly copied to the output
Column Lineage
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp cc 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped cc_emails 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped cc_emails 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[cc]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed in the fields CTE.
    • Output Columns:
      • cc_emails: Directly mapped after renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[cc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • cc_emails: Directly copied to the output
Column Lineage
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp drop_message 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped drop_message 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped drop_message 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[drop_message]
    • Cleaning The column is cast as TEXT in the macro CTE.
    • Output Columns:
      • drop_message: Directly mapped without renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[drop_message]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • drop_message: Directly copied to the output
Column Lineage
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp drop_reason 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped drop_reason 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped drop_reason 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[drop_reason]
    • Cleaning The column is cast as TEXT in the macro CTE.
    • Output Columns:
      • drop_reason: Directly mapped without renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[drop_reason]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • drop_reason: Directly copied to the output
Column Lineage
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp subject 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped email_subject 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped email_subject 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[subject]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed in the fields CTE.
    • Output Columns:
      • email_subject: Directly mapped after renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[email_subject]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_subject: Directly copied to the output
Column Lineage
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp id 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped event_id 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped event_id 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[id]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed in the fields CTE.
    • Output Columns:
      • event_id: Directly mapped after renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[event_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp from 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped from_email 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped from_email 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[from]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed in the fields CTE.
    • Output Columns:
      • from_email: Directly mapped after renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[from_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • from_email: Directly copied to the output
Column Lineage
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp reply_to 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped reply_to_email 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped reply_to_email 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[reply_to]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed in the fields CTE.
    • Output Columns:
      • reply_to_email: Directly mapped after renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[reply_to_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • reply_to_email: Directly copied to the output
72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp

This query selects all columns from the 'email_event_dropped' table in the 'hubspot' schema of the 'TEST' database. The comment suggests that this might be a placeholder query, possibly used during development or compilation of a dbt model, as it mentions that no columns were returned and the star selection is used to keep SQLFluff (a SQL linter) happy.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.email_event_dropped
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp id _fivetran_synced drop_reason bcc cc drop_message from reply_to subject 129. source.hubspot_source.hubspot.email_event_dropped 129. source.hubspot_source.hubspot.email_event_dropped
Name Type Comment
id text None
_fivetran_synced text None
drop_reason text None
bcc text None
cc text None
drop_message text None
from text None
reply_to text None
subject text None
Column Lineage
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp id 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped event_id 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped event_id 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[id]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed in the fields CTE.
    • Output Columns:
      • event_id: Directly mapped after renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[event_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp _fivetran_synced 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped _fivetran_synced 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped _fivetran_synced 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP in both the macro and fields CTEs.
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp drop_reason 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped drop_reason 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped drop_reason 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[drop_reason]
    • Cleaning The column is cast as TEXT in the macro CTE.
    • Output Columns:
      • drop_reason: Directly mapped without renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[drop_reason]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • drop_reason: Directly copied to the output
Column Lineage
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp bcc 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped bcc_emails 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped bcc_emails 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[bcc]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed in the fields CTE.
    • Output Columns:
      • bcc_emails: Directly mapped after renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[bcc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • bcc_emails: Directly copied to the output
Column Lineage
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp cc 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped cc_emails 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped cc_emails 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[cc]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed in the fields CTE.
    • Output Columns:
      • cc_emails: Directly mapped after renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[cc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • cc_emails: Directly copied to the output
Column Lineage
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp drop_message 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped drop_message 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped drop_message 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[drop_message]
    • Cleaning The column is cast as TEXT in the macro CTE.
    • Output Columns:
      • drop_message: Directly mapped without renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[drop_message]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • drop_message: Directly copied to the output
Column Lineage
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp from 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped from_email 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped from_email 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[from]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed in the fields CTE.
    • Output Columns:
      • from_email: Directly mapped after renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[from_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • from_email: Directly copied to the output
Column Lineage
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp reply_to 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped reply_to_email 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped reply_to_email 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[reply_to]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed in the fields CTE.
    • Output Columns:
      • reply_to_email: Directly mapped after renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[reply_to_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • reply_to_email: Directly copied to the output
Column Lineage
%3 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp subject 71. model.hubspot_source.stg_hubspot__email_event_dropped 71. model.hubspot_source.stg_hubspot__email_event_dropped email_subject 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp:f0->71. model.hubspot_source.stg_hubspot__email_event_dropped:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped email_subject 71. model.hubspot_source.stg_hubspot__email_event_dropped:f0->14. model.hubspot.hubspot__email_event_dropped:f0
71. model.hubspot_source.stg_hubspot__email_event_dropped
  • Input Column: 72. model.hubspot_source.stg_hubspot__email_event_dropped_tmp[subject]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed in the fields CTE.
    • Output Columns:
      • email_subject: Directly mapped after renaming
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 71. model.hubspot_source.stg_hubspot__email_event_dropped[email_subject]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_subject: Directly copied to the output
73. model.hubspot_source.stg_hubspot__email_event_forward

This SQL query performs data type casting and column renaming on the 'stg_hubspot__email_event_forward_tmp' table. It creates a base CTE from the source table, then a macro CTE that defines the structure with NULL values, and finally a fields CTE that casts and renames columns. The query then selects all columns from the fields CTE.

Cleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_forward_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TEXT) AS browser,
    CAST(NULL AS TEXT) AS id,
    CAST(NULL AS TEXT) AS ip_address,
    CAST(NULL AS TEXT) AS location,
    CAST(NULL AS TEXT) AS user_agent
  FROM base
), fields AS (
  SELECT
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    browser,
    id AS event_id,
    ip_address,
    location AS geo_location,
    user_agent
  FROM macro
)
SELECT
  *
FROM fields
%3 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward _fivetran_synced browser event_id geo_location ip_address user_agent 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp id _fivetran_synced browser ip_address location user_agent 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f2 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f1->73. model.hubspot_source.stg_hubspot__email_event_forward:f0 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f2->73. model.hubspot_source.stg_hubspot__email_event_forward:f1 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f3->73. model.hubspot_source.stg_hubspot__email_event_forward:f4 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f4->73. model.hubspot_source.stg_hubspot__email_event_forward:f3 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f5->73. model.hubspot_source.stg_hubspot__email_event_forward:f5
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
browser text A JSON object representing the browser which serviced the event. Its comprised of the properties: 'name', 'family', 'producer', 'producer_url', 'type', 'url', 'version'.
event_id text The ID of the event.
geo_location text A JSON object representing the location where the event occurred. It's comprised of the properties: 'city', 'state', 'country'.
ip_address integer The contact's IP address when the event occurred.
user_agent text The user agent responsible for the event, e.g. “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36”
Column Lineage
%3 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp _fivetran_synced 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward _fivetran_synced 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward _fivetran_synced 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0
73. model.hubspot_source.stg_hubspot__email_event_forward
  • Input Column: 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 73. model.hubspot_source.stg_hubspot__email_event_forward[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp browser 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward browser 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward browser 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0
73. model.hubspot_source.stg_hubspot__email_event_forward
  • Input Column: 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp[browser]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • browser: Directly mapped without changes
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 73. model.hubspot_source.stg_hubspot__email_event_forward[browser]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • browser: Directly copied to the output
Column Lineage
%3 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp id 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward event_id 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward event_id 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0
73. model.hubspot_source.stg_hubspot__email_event_forward
  • Input Column: 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp[id]
    • Cleaning The column is cast as TEXT and renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped after casting and renaming
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 73. model.hubspot_source.stg_hubspot__email_event_forward[event_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp location 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward geo_location 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward geo_location 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0
73. model.hubspot_source.stg_hubspot__email_event_forward
  • Input Column: 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp[location]
    • Cleaning The column is renamed to 'geo_location'
    • Output Columns:
      • geo_location: Directly mapped after renaming
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 73. model.hubspot_source.stg_hubspot__email_event_forward[geo_location]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • geo_location: Directly copied to the output
Column Lineage
%3 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp ip_address 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward ip_address 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward ip_address 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0
73. model.hubspot_source.stg_hubspot__email_event_forward
  • Input Column: 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp[ip_address]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • ip_address: Directly mapped without changes
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 73. model.hubspot_source.stg_hubspot__email_event_forward[ip_address]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • ip_address: Directly copied to the output
Column Lineage
%3 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp user_agent 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward user_agent 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward user_agent 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0
73. model.hubspot_source.stg_hubspot__email_event_forward
  • Input Column: 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp[user_agent]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • user_agent: Directly mapped without changes
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 73. model.hubspot_source.stg_hubspot__email_event_forward[user_agent]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • user_agent: Directly copied to the output
74. model.hubspot_source.stg_hubspot__email_event_forward_tmp

This SQL query selects all columns from the 'email_event_forward' table in the 'hubspot' schema of the 'TEST' database. The query is likely used as a staging step to prepare data for further processing or analysis in a dbt (data build tool) pipeline.

Integration
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.email_event_forward
%3 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp id _fivetran_synced browser ip_address location user_agent 130. source.hubspot_source.hubspot.email_event_forward 130. source.hubspot_source.hubspot.email_event_forward
Name Type Comment
id text None
_fivetran_synced text None
browser text None
ip_address integer None
location text None
user_agent text None
Column Lineage
%3 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp id 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward event_id 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward event_id 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0
73. model.hubspot_source.stg_hubspot__email_event_forward
  • Input Column: 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp[id]
    • Cleaning The column is cast as TEXT and renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped after casting and renaming
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 73. model.hubspot_source.stg_hubspot__email_event_forward[event_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp _fivetran_synced 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward _fivetran_synced 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward _fivetran_synced 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0
73. model.hubspot_source.stg_hubspot__email_event_forward
  • Input Column: 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 73. model.hubspot_source.stg_hubspot__email_event_forward[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp browser 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward browser 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward browser 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0
73. model.hubspot_source.stg_hubspot__email_event_forward
  • Input Column: 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp[browser]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • browser: Directly mapped without changes
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 73. model.hubspot_source.stg_hubspot__email_event_forward[browser]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • browser: Directly copied to the output
Column Lineage
%3 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp ip_address 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward ip_address 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward ip_address 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0
73. model.hubspot_source.stg_hubspot__email_event_forward
  • Input Column: 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp[ip_address]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • ip_address: Directly mapped without changes
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 73. model.hubspot_source.stg_hubspot__email_event_forward[ip_address]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • ip_address: Directly copied to the output
Column Lineage
%3 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp location 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward geo_location 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward geo_location 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0
73. model.hubspot_source.stg_hubspot__email_event_forward
  • Input Column: 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp[location]
    • Cleaning The column is renamed to 'geo_location'
    • Output Columns:
      • geo_location: Directly mapped after renaming
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 73. model.hubspot_source.stg_hubspot__email_event_forward[geo_location]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • geo_location: Directly copied to the output
Column Lineage
%3 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp user_agent 73. model.hubspot_source.stg_hubspot__email_event_forward 73. model.hubspot_source.stg_hubspot__email_event_forward user_agent 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp:f0->73. model.hubspot_source.stg_hubspot__email_event_forward:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward user_agent 73. model.hubspot_source.stg_hubspot__email_event_forward:f0->15. model.hubspot.hubspot__email_event_forward:f0
73. model.hubspot_source.stg_hubspot__email_event_forward
  • Input Column: 74. model.hubspot_source.stg_hubspot__email_event_forward_tmp[user_agent]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • user_agent: Directly mapped without changes
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 73. model.hubspot_source.stg_hubspot__email_event_forward[user_agent]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • user_agent: Directly copied to the output
75. model.hubspot_source.stg_hubspot__email_event_open

This SQL query performs data type casting and column renaming for the Hubspot email event open data. It starts with a base table, creates a macro with null values and specific data types, then applies the actual data type conversions and column renamings in the fields CTE. The query doesn't filter, deduplicate, or aggregate data, but focuses on cleaning and standardizing the data structure.

Cleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_open_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TEXT) AS browser,
    CAST(NULL AS TEXT) AS duration,
    CAST(NULL AS TEXT) AS id,
    CAST(NULL AS TEXT) AS ip_address,
    CAST(NULL AS TEXT) AS location,
    CAST(NULL AS TEXT) AS user_agent
  FROM base
), fields AS (
  SELECT
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    browser,
    duration AS duration_open,
    id AS event_id,
    ip_address,
    location AS geo_location,
    user_agent
  FROM macro
)
SELECT
  *
FROM fields
%3 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open _fivetran_synced browser duration_open event_id geo_location ip_address user_agent 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp id _fivetran_synced duration browser ip_address location user_agent 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f3 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f1->75. model.hubspot_source.stg_hubspot__email_event_open:f0 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f2->75. model.hubspot_source.stg_hubspot__email_event_open:f2 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f3->75. model.hubspot_source.stg_hubspot__email_event_open:f1 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f4->75. model.hubspot_source.stg_hubspot__email_event_open:f5 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f5->75. model.hubspot_source.stg_hubspot__email_event_open:f4 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f6->75. model.hubspot_source.stg_hubspot__email_event_open:f6
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
browser text A JSON object representing the browser which serviced the event. Its comprised of the properties: 'name', 'family', 'producer', 'producer_url', 'type', 'url', 'version'.
duration_open integer If provided and nonzero, the approximate number of milliseconds the user had opened the email.
event_id text The ID of the event.
geo_location text A JSON object representing the location where the event occurred. It's comprised of the properties: 'city', 'state', 'country'.
ip_address integer The contact's IP address when the event occurred.
user_agent text The user agent responsible for the event, e.g. “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36”
Column Lineage
%3 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp _fivetran_synced 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open _fivetran_synced 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens _fivetran_synced 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp browser 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open browser 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens browser 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[browser]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • browser: Directly mapped without changes
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[browser]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • browser: Directly copied
Column Lineage
%3 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp duration 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open duration_open 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens duration_open 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[duration]
    • Cleaning The column is renamed to 'duration_open'
    • Output Columns:
      • duration_open: Directly mapped after renaming
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[duration_open]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • duration_open: Directly copied
Column Lineage
%3 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp id 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open event_id 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens event_id 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[id]
    • Cleaning The column is cast as TEXT and renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped after casting and renaming
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[event_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied
Column Lineage
%3 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp location 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open geo_location 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens geo_location 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[location]
    • Cleaning The column is renamed to 'geo_location'
    • Output Columns:
      • geo_location: Directly mapped after renaming
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[geo_location]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • geo_location: Directly copied
Column Lineage
%3 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp ip_address 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open ip_address 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens ip_address 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[ip_address]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • ip_address: Directly mapped without changes
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[ip_address]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • ip_address: Directly copied
Column Lineage
%3 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp user_agent 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open user_agent 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens user_agent 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[user_agent]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • user_agent: Directly mapped without changes
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[user_agent]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • user_agent: Directly copied
76. model.hubspot_source.stg_hubspot__email_event_open_tmp

This SQL query selects all columns from the 'email_event_open' table in the 'hubspot' schema of the 'TEST' database. It appears to be a staging query that extracts raw data without any transformations or filtering.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.email_event_open
%3 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp id _fivetran_synced duration browser ip_address location user_agent 131. source.hubspot_source.hubspot.email_event_open 131. source.hubspot_source.hubspot.email_event_open
Name Type Comment
id text None
_fivetran_synced text None
duration integer None
browser text None
ip_address integer None
location text None
user_agent text None
Column Lineage
%3 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp id 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open event_id 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens event_id 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[id]
    • Cleaning The column is cast as TEXT and renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped after casting and renaming
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[event_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied
Column Lineage
%3 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp _fivetran_synced 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open _fivetran_synced 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens _fivetran_synced 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp duration 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open duration_open 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens duration_open 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[duration]
    • Cleaning The column is renamed to 'duration_open'
    • Output Columns:
      • duration_open: Directly mapped after renaming
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[duration_open]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • duration_open: Directly copied
Column Lineage
%3 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp browser 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open browser 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens browser 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[browser]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • browser: Directly mapped without changes
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[browser]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • browser: Directly copied
Column Lineage
%3 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp ip_address 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open ip_address 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens ip_address 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[ip_address]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • ip_address: Directly mapped without changes
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[ip_address]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • ip_address: Directly copied
Column Lineage
%3 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp location 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open geo_location 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens geo_location 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[location]
    • Cleaning The column is renamed to 'geo_location'
    • Output Columns:
      • geo_location: Directly mapped after renaming
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[geo_location]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • geo_location: Directly copied
Column Lineage
%3 76. model.hubspot_source.stg_hubspot__email_event_open_tmp 76. model.hubspot_source.stg_hubspot__email_event_open_tmp user_agent 75. model.hubspot_source.stg_hubspot__email_event_open 75. model.hubspot_source.stg_hubspot__email_event_open user_agent 76. model.hubspot_source.stg_hubspot__email_event_open_tmp:f0->75. model.hubspot_source.stg_hubspot__email_event_open:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens user_agent 75. model.hubspot_source.stg_hubspot__email_event_open:f0->16. model.hubspot.hubspot__email_event_opens:f0
75. model.hubspot_source.stg_hubspot__email_event_open
  • Input Column: 76. model.hubspot_source.stg_hubspot__email_event_open_tmp[user_agent]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • user_agent: Directly mapped without changes
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 75. model.hubspot_source.stg_hubspot__email_event_open[user_agent]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • user_agent: Directly copied
77. model.hubspot_source.stg_hubspot__email_event_print

This SQL query performs a series of data transformations on the 'stg_hubspot__email_event_print_tmp' table. It first creates a CTE named 'base' to select all columns from the source table. Then, it defines a 'macro' CTE that establishes the structure and data types for the output. Finally, it creates a 'fields' CTE that casts and renames columns from the 'macro' CTE. The main SELECT statement then retrieves all columns from the 'fields' CTE.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_print_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TEXT) AS browser,
    CAST(NULL AS TEXT) AS id,
    CAST(NULL AS TEXT) AS ip_address,
    CAST(NULL AS TEXT) AS location,
    CAST(NULL AS TEXT) AS user_agent
  FROM base
), fields AS (
  SELECT
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    browser,
    id AS event_id,
    ip_address,
    location AS geo_location,
    user_agent
  FROM macro
)
SELECT
  *
FROM fields
%3 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print _fivetran_synced browser event_id geo_location ip_address user_agent 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp id _fivetran_synced browser ip_address location user_agent 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f2 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f1->77. model.hubspot_source.stg_hubspot__email_event_print:f0 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f2->77. model.hubspot_source.stg_hubspot__email_event_print:f1 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f3->77. model.hubspot_source.stg_hubspot__email_event_print:f4 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f4->77. model.hubspot_source.stg_hubspot__email_event_print:f3 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f5->77. model.hubspot_source.stg_hubspot__email_event_print:f5
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
browser text A JSON object representing the browser which serviced the event. Its comprised of the properties: 'name', 'family', 'producer', 'producer_url', 'type', 'url', 'version'.
event_id text The ID of the event.
geo_location text A JSON object representing the location where the event occurred. It's comprised of the properties: 'city', 'state', 'country'.
ip_address integer The contact's IP address when the event occurred.
user_agent text The user agent responsible for the event, e.g. “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36”
Column Lineage
%3 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp _fivetran_synced 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print _fivetran_synced 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print _fivetran_synced 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0
77. model.hubspot_source.stg_hubspot__email_event_print
  • Input Column: 78. model.hubspot_source.stg_hubspot__email_event_print_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP in both the macro and fields CTEs.
    • Output Columns:
      • _fivetran_synced: Directly mapped after being cast.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 77. model.hubspot_source.stg_hubspot__email_event_print[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp browser 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print browser 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print browser 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0
77. model.hubspot_source.stg_hubspot__email_event_print
  • Input Column: 78. model.hubspot_source.stg_hubspot__email_event_print_tmp[browser]
    • Direct The column is directly copied without any transformation.
    • Output Columns:
      • browser: Directly copied to the output.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 77. model.hubspot_source.stg_hubspot__email_event_print[browser]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • browser: Directly copied to the output
Column Lineage
%3 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp id 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print event_id 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print event_id 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0
77. model.hubspot_source.stg_hubspot__email_event_print
  • Input Column: 78. model.hubspot_source.stg_hubspot__email_event_print_tmp[id]
    • Cleaning The column is cast as TEXT in the macro CTE and renamed to 'event_id' in the fields CTE.
    • Output Columns:
      • event_id: Directly mapped after being cast and renamed.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 77. model.hubspot_source.stg_hubspot__email_event_print[event_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp location 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print geo_location 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print geo_location 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0
77. model.hubspot_source.stg_hubspot__email_event_print
  • Input Column: 78. model.hubspot_source.stg_hubspot__email_event_print_tmp[location]
    • Cleaning The column is renamed to 'geo_location' in the fields CTE.
    • Output Columns:
      • geo_location: Directly mapped after being renamed.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 77. model.hubspot_source.stg_hubspot__email_event_print[geo_location]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • geo_location: Directly copied to the output
Column Lineage
%3 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp ip_address 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print ip_address 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print ip_address 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0
77. model.hubspot_source.stg_hubspot__email_event_print
  • Input Column: 78. model.hubspot_source.stg_hubspot__email_event_print_tmp[ip_address]
    • Direct The column is directly copied without any transformation.
    • Output Columns:
      • ip_address: Directly copied to the output.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 77. model.hubspot_source.stg_hubspot__email_event_print[ip_address]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • ip_address: Directly copied to the output
Column Lineage
%3 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp user_agent 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print user_agent 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print user_agent 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0
77. model.hubspot_source.stg_hubspot__email_event_print
  • Input Column: 78. model.hubspot_source.stg_hubspot__email_event_print_tmp[user_agent]
    • Direct The column is directly copied without any transformation.
    • Output Columns:
      • user_agent: Directly copied to the output.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 77. model.hubspot_source.stg_hubspot__email_event_print[user_agent]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • user_agent: Directly copied to the output
78. model.hubspot_source.stg_hubspot__email_event_print_tmp

This SQL query selects all columns from the 'email_event_print' table in the 'hubspot' schema of the 'TEST' database. The comment suggests that no columns were returned, possibly because the relation doesn't exist yet or all columns were excluded. The query is likely a placeholder or template for staging Hubspot email print event data.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.email_event_print
%3 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp id _fivetran_synced browser ip_address location user_agent 132. source.hubspot_source.hubspot.email_event_print 132. source.hubspot_source.hubspot.email_event_print
Name Type Comment
id text None
_fivetran_synced text None
browser text None
ip_address integer None
location text None
user_agent text None
Column Lineage
%3 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp id 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print event_id 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print event_id 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0
77. model.hubspot_source.stg_hubspot__email_event_print
  • Input Column: 78. model.hubspot_source.stg_hubspot__email_event_print_tmp[id]
    • Cleaning The column is cast as TEXT in the macro CTE and renamed to 'event_id' in the fields CTE.
    • Output Columns:
      • event_id: Directly mapped after being cast and renamed.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 77. model.hubspot_source.stg_hubspot__email_event_print[event_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp _fivetran_synced 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print _fivetran_synced 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print _fivetran_synced 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0
77. model.hubspot_source.stg_hubspot__email_event_print
  • Input Column: 78. model.hubspot_source.stg_hubspot__email_event_print_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP in both the macro and fields CTEs.
    • Output Columns:
      • _fivetran_synced: Directly mapped after being cast.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 77. model.hubspot_source.stg_hubspot__email_event_print[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp browser 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print browser 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print browser 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0
77. model.hubspot_source.stg_hubspot__email_event_print
  • Input Column: 78. model.hubspot_source.stg_hubspot__email_event_print_tmp[browser]
    • Direct The column is directly copied without any transformation.
    • Output Columns:
      • browser: Directly copied to the output.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 77. model.hubspot_source.stg_hubspot__email_event_print[browser]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • browser: Directly copied to the output
Column Lineage
%3 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp ip_address 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print ip_address 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print ip_address 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0
77. model.hubspot_source.stg_hubspot__email_event_print
  • Input Column: 78. model.hubspot_source.stg_hubspot__email_event_print_tmp[ip_address]
    • Direct The column is directly copied without any transformation.
    • Output Columns:
      • ip_address: Directly copied to the output.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 77. model.hubspot_source.stg_hubspot__email_event_print[ip_address]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • ip_address: Directly copied to the output
Column Lineage
%3 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp location 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print geo_location 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print geo_location 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0
77. model.hubspot_source.stg_hubspot__email_event_print
  • Input Column: 78. model.hubspot_source.stg_hubspot__email_event_print_tmp[location]
    • Cleaning The column is renamed to 'geo_location' in the fields CTE.
    • Output Columns:
      • geo_location: Directly mapped after being renamed.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 77. model.hubspot_source.stg_hubspot__email_event_print[geo_location]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • geo_location: Directly copied to the output
Column Lineage
%3 78. model.hubspot_source.stg_hubspot__email_event_print_tmp 78. model.hubspot_source.stg_hubspot__email_event_print_tmp user_agent 77. model.hubspot_source.stg_hubspot__email_event_print 77. model.hubspot_source.stg_hubspot__email_event_print user_agent 78. model.hubspot_source.stg_hubspot__email_event_print_tmp:f0->77. model.hubspot_source.stg_hubspot__email_event_print:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print user_agent 77. model.hubspot_source.stg_hubspot__email_event_print:f0->17. model.hubspot.hubspot__email_event_print:f0
77. model.hubspot_source.stg_hubspot__email_event_print
  • Input Column: 78. model.hubspot_source.stg_hubspot__email_event_print_tmp[user_agent]
    • Direct The column is directly copied without any transformation.
    • Output Columns:
      • user_agent: Directly copied to the output.
17. model.hubspot.hubspot__email_event_print
  • Input Column: 77. model.hubspot_source.stg_hubspot__email_event_print[user_agent]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • user_agent: Directly copied to the output
79. model.hubspot_source.stg_hubspot__email_event_sent

This SQL query performs data cleaning and transformation on the 'stg_hubspot__email_event_sent' model. It starts with a base CTE that selects all columns from a temporary table. Then, it defines a macro CTE that sets up the structure with NULL values and specific data types. Finally, it applies field transformations, including casting, renaming, and aliasing of columns to prepare the data for further use.

CleaningFeaturization
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_sent_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TEXT) AS bcc,
    CAST(NULL AS TEXT) AS cc,
    CAST(NULL AS TEXT) AS id,
    CAST(NULL AS TEXT) AS reply_to,
    CAST(NULL AS TEXT) AS subject,
    CAST(NULL AS TEXT) AS from_email
  FROM base
), fields AS (
  SELECT
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    bcc AS bcc_emails,
    cc AS cc_emails,
    from_email, /* source field name = from ; alias declared in macros/get_email_event_sent_columns.sql */
    id AS event_id,
    reply_to AS reply_to_email,
    subject AS email_subject
  FROM macro
)
SELECT
  *
FROM fields
%3 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent _fivetran_synced bcc_emails cc_emails email_subject event_id from_email reply_to_email 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp id _fivetran_synced bcc cc from reply_to subject 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f4 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f1->79. model.hubspot_source.stg_hubspot__email_event_sent:f0 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f2->79. model.hubspot_source.stg_hubspot__email_event_sent:f1 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f3->79. model.hubspot_source.stg_hubspot__email_event_sent:f2 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f4->79. model.hubspot_source.stg_hubspot__email_event_sent:f5 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f5->79. model.hubspot_source.stg_hubspot__email_event_sent:f6 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f6->79. model.hubspot_source.stg_hubspot__email_event_sent:f3
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
bcc_emails text The 'cc' field of the email message.
cc_emails text The 'bcc' field of the email message.
email_subject text The subject line of the email message.
event_id text The ID of the event.
from_email text The 'from' field of the email message.
reply_to_email text The 'reply-to' field of the email message.
Column Lineage
%3 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp _fivetran_synced 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent _fivetran_synced 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent _fivetran_synced 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends _fivetran_synced 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP in both the macro and fields CTEs.
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp bcc 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent bcc_emails 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent bcc_emails 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends bcc_emails 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[bcc]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to bcc_emails in the fields CTE.
    • Output Columns:
      • bcc_emails: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[bcc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • bcc_emails: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[bcc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • bcc_emails: Directly copied
Column Lineage
%3 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp cc 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent cc_emails 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent cc_emails 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends cc_emails 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[cc]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to cc_emails in the fields CTE.
    • Output Columns:
      • cc_emails: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[cc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • cc_emails: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[cc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • cc_emails: Directly copied
Column Lineage
%3 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp subject 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent email_subject 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent email_subject 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_subject 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[subject]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to email_subject in the fields CTE.
    • Output Columns:
      • email_subject: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[email_subject]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_subject: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[email_subject]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_subject: Directly copied
Column Lineage
%3 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp id 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent event_id 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent event_id 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends event_id 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[id]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to event_id in the fields CTE.
    • Output Columns:
      • event_id: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[event_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[event_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • event_id: Directly copied
Column Lineage
%3 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp from 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent from_email 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent from_email 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends from_email 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[from]
    • Cleaning The column is cast as TEXT and renamed to from_email in the macro CTE, then directly selected in the fields CTE.
    • Output Columns:
      • from_email: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[from_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • from_email: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[from_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • from_email: Directly copied
Column Lineage
%3 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp reply_to 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent reply_to_email 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent reply_to_email 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends reply_to_email 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[reply_to]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to reply_to_email in the fields CTE.
    • Output Columns:
      • reply_to_email: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[reply_to_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • reply_to_email: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[reply_to_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • reply_to_email: Directly copied
80. model.hubspot_source.stg_hubspot__email_event_sent_tmp

This SQL query selects all columns from the 'email_event_sent' table in the 'hubspot' schema of the 'TEST' database. The comment suggests that no columns were returned, possibly because the relation doesn't exist yet or all columns were excluded. The query appears to be a template or placeholder, potentially used for staging data from HubSpot's email event sent information.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.email_event_sent
%3 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp id _fivetran_synced bcc cc from reply_to subject 133. source.hubspot_source.hubspot.email_event_sent 133. source.hubspot_source.hubspot.email_event_sent
Name Type Comment
id text None
_fivetran_synced text None
bcc text None
cc text None
from text None
reply_to text None
subject text None
Column Lineage
%3 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp id 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent event_id 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent event_id 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends event_id 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[id]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to event_id in the fields CTE.
    • Output Columns:
      • event_id: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[event_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[event_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • event_id: Directly copied
Column Lineage
%3 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp _fivetran_synced 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent _fivetran_synced 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent _fivetran_synced 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends _fivetran_synced 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP in both the macro and fields CTEs.
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp bcc 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent bcc_emails 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent bcc_emails 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends bcc_emails 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[bcc]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to bcc_emails in the fields CTE.
    • Output Columns:
      • bcc_emails: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[bcc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • bcc_emails: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[bcc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • bcc_emails: Directly copied
Column Lineage
%3 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp cc 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent cc_emails 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent cc_emails 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends cc_emails 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[cc]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to cc_emails in the fields CTE.
    • Output Columns:
      • cc_emails: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[cc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • cc_emails: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[cc_emails]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • cc_emails: Directly copied
Column Lineage
%3 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp from 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent from_email 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent from_email 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends from_email 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[from]
    • Cleaning The column is cast as TEXT and renamed to from_email in the macro CTE, then directly selected in the fields CTE.
    • Output Columns:
      • from_email: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[from_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • from_email: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[from_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • from_email: Directly copied
Column Lineage
%3 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp reply_to 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent reply_to_email 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent reply_to_email 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends reply_to_email 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[reply_to]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to reply_to_email in the fields CTE.
    • Output Columns:
      • reply_to_email: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[reply_to_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • reply_to_email: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[reply_to_email]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • reply_to_email: Directly copied
Column Lineage
%3 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp subject 79. model.hubspot_source.stg_hubspot__email_event_sent 79. model.hubspot_source.stg_hubspot__email_event_sent email_subject 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp:f0->79. model.hubspot_source.stg_hubspot__email_event_sent:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent email_subject 79. model.hubspot_source.stg_hubspot__email_event_sent:f0->18. model.hubspot.hubspot__email_event_sent:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_subject 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
79. model.hubspot_source.stg_hubspot__email_event_sent
  • Input Column: 80. model.hubspot_source.stg_hubspot__email_event_sent_tmp[subject]
    • Cleaning The column is cast as TEXT in the macro CTE and then renamed to email_subject in the fields CTE.
    • Output Columns:
      • email_subject: Directly mapped after casting and renaming
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 79. model.hubspot_source.stg_hubspot__email_event_sent[email_subject]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_subject: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[email_subject]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_subject: Directly copied
81. model.hubspot_source.stg_hubspot__email_event_spam_report

This SQL query performs a data transformation on the 'stg_hubspot__email_event_spam_report_tmp' table. It casts specific columns to appropriate data types and renames the 'id' column to 'event_id'. The query uses a series of CTEs (Common Table Expressions) to structure the transformation process, starting with the raw data, applying a macro for type casting, and then finalizing the field selection and renaming.

Cleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_spam_report_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TEXT) AS id,
    CAST(NULL AS TEXT) AS ip_address,
    CAST(NULL AS TEXT) AS user_agent
  FROM base
), fields AS (
  SELECT
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    id AS event_id,
    ip_address,
    user_agent
  FROM macro
)
SELECT
  *
FROM fields
%3 81. model.hubspot_source.stg_hubspot__email_event_spam_report 81. model.hubspot_source.stg_hubspot__email_event_spam_report _fivetran_synced event_id ip_address user_agent 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp id _fivetran_synced ip_address user_agent 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp:f0->81. model.hubspot_source.stg_hubspot__email_event_spam_report:f1 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp:f1->81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp:f2->81. model.hubspot_source.stg_hubspot__email_event_spam_report:f2 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp:f3->81. model.hubspot_source.stg_hubspot__email_event_spam_report:f3
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
event_id text The ID of the event.
ip_address integer The contact's IP address when the event occurred.
user_agent integer The user agent responsible for the event, e.g. “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36”
Column Lineage
%3 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp _fivetran_synced 81. model.hubspot_source.stg_hubspot__email_event_spam_report 81. model.hubspot_source.stg_hubspot__email_event_spam_report _fivetran_synced 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp:f0->81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report _fivetran_synced 81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0->19. model.hubspot.hubspot__email_event_spam_report:f0
81. model.hubspot_source.stg_hubspot__email_event_spam_report
  • Input Column: 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp[_fivetran_synced]
    • Cleaning The column is cast to TIMESTAMP type in the macro CTE and again in the fields CTE
    • Output Columns:
      • _fivetran_synced: The column is directly mapped to the output after casting
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 81. model.hubspot_source.stg_hubspot__email_event_spam_report[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp id 81. model.hubspot_source.stg_hubspot__email_event_spam_report 81. model.hubspot_source.stg_hubspot__email_event_spam_report event_id 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp:f0->81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report event_id 81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0->19. model.hubspot.hubspot__email_event_spam_report:f0
81. model.hubspot_source.stg_hubspot__email_event_spam_report
  • Input Column: 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp[id]
    • Cleaning The column is cast to TEXT type in the macro CTE
    • Direct The column is directly copied in the fields CTE
    • Output Columns:
      • event_id: The 'id' column is renamed to 'event_id' in the final output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 81. model.hubspot_source.stg_hubspot__email_event_spam_report[event_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp ip_address 81. model.hubspot_source.stg_hubspot__email_event_spam_report 81. model.hubspot_source.stg_hubspot__email_event_spam_report ip_address 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp:f0->81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report ip_address 81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0->19. model.hubspot.hubspot__email_event_spam_report:f0
81. model.hubspot_source.stg_hubspot__email_event_spam_report
  • Input Column: 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp[ip_address]
    • Cleaning The column is cast to TEXT type in the macro CTE
    • Direct The column is directly copied in the fields CTE
    • Output Columns:
      • ip_address: The column is directly mapped to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 81. model.hubspot_source.stg_hubspot__email_event_spam_report[ip_address]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • ip_address: Directly copied to the output
Column Lineage
%3 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp user_agent 81. model.hubspot_source.stg_hubspot__email_event_spam_report 81. model.hubspot_source.stg_hubspot__email_event_spam_report user_agent 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp:f0->81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report user_agent 81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0->19. model.hubspot.hubspot__email_event_spam_report:f0
81. model.hubspot_source.stg_hubspot__email_event_spam_report
  • Input Column: 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp[user_agent]
    • Cleaning The column is cast to TEXT type in the macro CTE
    • Direct The column is directly copied in the fields CTE
    • Output Columns:
      • user_agent: The column is directly mapped to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 81. model.hubspot_source.stg_hubspot__email_event_spam_report[user_agent]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • user_agent: Directly copied to the output
82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp

This SQL query selects all columns from the 'email_event_spam_report' table in the 'hubspot' schema of the 'TEST' database. It appears to be a staging query that extracts raw data from the source table without any transformations.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.email_event_spam_report
%3 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp id _fivetran_synced ip_address user_agent 134. source.hubspot_source.hubspot.email_event_spam_report 134. source.hubspot_source.hubspot.email_event_spam_report
Name Type Comment
id text None
_fivetran_synced text None
ip_address integer None
user_agent integer None
Column Lineage
%3 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp id 81. model.hubspot_source.stg_hubspot__email_event_spam_report 81. model.hubspot_source.stg_hubspot__email_event_spam_report event_id 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp:f0->81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report event_id 81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0->19. model.hubspot.hubspot__email_event_spam_report:f0
81. model.hubspot_source.stg_hubspot__email_event_spam_report
  • Input Column: 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp[id]
    • Cleaning The column is cast to TEXT type in the macro CTE
    • Direct The column is directly copied in the fields CTE
    • Output Columns:
      • event_id: The 'id' column is renamed to 'event_id' in the final output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 81. model.hubspot_source.stg_hubspot__email_event_spam_report[event_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp _fivetran_synced 81. model.hubspot_source.stg_hubspot__email_event_spam_report 81. model.hubspot_source.stg_hubspot__email_event_spam_report _fivetran_synced 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp:f0->81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report _fivetran_synced 81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0->19. model.hubspot.hubspot__email_event_spam_report:f0
81. model.hubspot_source.stg_hubspot__email_event_spam_report
  • Input Column: 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp[_fivetran_synced]
    • Cleaning The column is cast to TIMESTAMP type in the macro CTE and again in the fields CTE
    • Output Columns:
      • _fivetran_synced: The column is directly mapped to the output after casting
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 81. model.hubspot_source.stg_hubspot__email_event_spam_report[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp ip_address 81. model.hubspot_source.stg_hubspot__email_event_spam_report 81. model.hubspot_source.stg_hubspot__email_event_spam_report ip_address 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp:f0->81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report ip_address 81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0->19. model.hubspot.hubspot__email_event_spam_report:f0
81. model.hubspot_source.stg_hubspot__email_event_spam_report
  • Input Column: 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp[ip_address]
    • Cleaning The column is cast to TEXT type in the macro CTE
    • Direct The column is directly copied in the fields CTE
    • Output Columns:
      • ip_address: The column is directly mapped to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 81. model.hubspot_source.stg_hubspot__email_event_spam_report[ip_address]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • ip_address: Directly copied to the output
Column Lineage
%3 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp user_agent 81. model.hubspot_source.stg_hubspot__email_event_spam_report 81. model.hubspot_source.stg_hubspot__email_event_spam_report user_agent 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp:f0->81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report user_agent 81. model.hubspot_source.stg_hubspot__email_event_spam_report:f0->19. model.hubspot.hubspot__email_event_spam_report:f0
81. model.hubspot_source.stg_hubspot__email_event_spam_report
  • Input Column: 82. model.hubspot_source.stg_hubspot__email_event_spam_report_tmp[user_agent]
    • Cleaning The column is cast to TEXT type in the macro CTE
    • Direct The column is directly copied in the fields CTE
    • Output Columns:
      • user_agent: The column is directly mapped to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 81. model.hubspot_source.stg_hubspot__email_event_spam_report[user_agent]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • user_agent: Directly copied to the output
83. model.hubspot_source.stg_hubspot__email_event_status_change

This SQL query performs data type casting and column renaming for the Hubspot email event status change data. It starts with a base CTE that selects all columns from a temporary table, then defines a macro CTE with null values and specific data types for each column. Finally, it casts and renames the columns in the fields CTE before selecting all columns from it.

Cleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__email_event_status_change_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS BOOLEAN) AS bounced,
    CAST(NULL AS TEXT) AS id,
    CAST(NULL AS TEXT) AS portal_subscription_status,
    CAST(NULL AS TEXT) AS requested_by,
    CAST(NULL AS TEXT) AS source,
    CAST(NULL AS TEXT) AS subscriptions
  FROM base
), fields AS (
  SELECT
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    bounced AS is_bounced,
    id AS event_id,
    portal_subscription_status AS subscription_status,
    requested_by AS requested_by_email,
    source AS change_source,
    subscriptions
  FROM macro
)
SELECT
  *
FROM fields
%3 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change _fivetran_synced change_source event_id is_bounced requested_by_email subscription_status subscriptions 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp id _fivetran_synced bounced portal_subscription_status requested_by source subscriptions 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f2 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f1->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f2->83. model.hubspot_source.stg_hubspot__email_event_status_change:f3 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f3->83. model.hubspot_source.stg_hubspot__email_event_status_change:f5 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f4->83. model.hubspot_source.stg_hubspot__email_event_status_change:f4 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f5->83. model.hubspot_source.stg_hubspot__email_event_status_change:f1 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f6->83. model.hubspot_source.stg_hubspot__email_event_status_change:f6
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
change_source text The source of the subscription change.
event_id text The ID of the event.
is_bounced integer A HubSpot employee explicitly initiated the status change to block messages to the recipient. (Note this usage has been deprecated in favor of dropping messages with a 'dropReason' of BLOCKED_ADDRESS.)
requested_by_email integer The email address of the person requesting the change on behalf of the recipient. If not applicable, this property is omitted.
subscription_status text The recipient's portal subscription status. Note that if this is 'UNSUBSCRIBED', the property 'subscriptions' is not necessarily an empty array, nor are all subscriptions contained in it necessarily going to have their statuses set to 'UNSUBSCRIBED'.)
subscriptions text An array of JSON objects representing the status of subscriptions for the recipient. Each JSON subscription object is comprised of the properties: 'id', 'status'.
Column Lineage
%3 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp _fivetran_synced 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change _fivetran_synced 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change _fivetran_synced 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp source 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change change_source 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change change_source 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[source]
    • Cleaning The column is cast as TEXT and renamed
    • Output Columns:
      • change_source: Directly mapped after casting and renaming
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[change_source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source: Directly copied to the output
Column Lineage
%3 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp id 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change event_id 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change event_id 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[id]
    • Cleaning The column is cast as TEXT and renamed
    • Output Columns:
      • event_id: Directly mapped after casting and renaming
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[event_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp bounced 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change is_bounced 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change is_bounced 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[bounced]
    • Cleaning The column is cast as BOOLEAN and renamed
    • Output Columns:
      • is_bounced: Directly mapped after casting and renaming
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[is_bounced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_bounced: Directly copied to the output
Column Lineage
%3 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp requested_by 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change requested_by_email 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change requested_by_email 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[requested_by]
    • Cleaning The column is cast as TEXT and renamed
    • Output Columns:
      • requested_by_email: Directly mapped after casting and renaming
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[requested_by_email]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • requested_by_email: Directly copied to the output
Column Lineage
%3 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp portal_subscription_status 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change subscription_status 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change subscription_status 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[portal_subscription_status]
    • Cleaning The column is cast as TEXT and renamed
    • Output Columns:
      • subscription_status: Directly mapped after casting and renaming
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[subscription_status]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • subscription_status: Directly copied to the output
Column Lineage
%3 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp subscriptions 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change subscriptions 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change subscriptions 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[subscriptions]
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • subscriptions: Directly mapped after casting
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[subscriptions]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • subscriptions: Directly copied to the output
84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp

This SQL query selects all columns from the 'email_event_status_change' table in the 'hubspot' schema of the 'TEST' database. It appears to be a staging query that's part of a dbt (data build tool) model. The comment suggests that this query might be a placeholder or template, possibly used during compilation or for linting purposes with SQLFluff.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.email_event_status_change
%3 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp id _fivetran_synced bounced portal_subscription_status requested_by source subscriptions 135. source.hubspot_source.hubspot.email_event_status_change 135. source.hubspot_source.hubspot.email_event_status_change
Name Type Comment
id text None
_fivetran_synced text None
bounced integer None
portal_subscription_status text None
requested_by integer None
source text None
subscriptions text None
Column Lineage
%3 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp id 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change event_id 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change event_id 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[id]
    • Cleaning The column is cast as TEXT and renamed
    • Output Columns:
      • event_id: Directly mapped after casting and renaming
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[event_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as the key to join with the events table
    • Output Columns:
      • event_id: Directly copied to the output
Column Lineage
%3 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp _fivetran_synced 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change _fivetran_synced 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change _fivetran_synced 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp bounced 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change is_bounced 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change is_bounced 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[bounced]
    • Cleaning The column is cast as BOOLEAN and renamed
    • Output Columns:
      • is_bounced: Directly mapped after casting and renaming
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[is_bounced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • is_bounced: Directly copied to the output
Column Lineage
%3 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp portal_subscription_status 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change subscription_status 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change subscription_status 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[portal_subscription_status]
    • Cleaning The column is cast as TEXT and renamed
    • Output Columns:
      • subscription_status: Directly mapped after casting and renaming
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[subscription_status]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • subscription_status: Directly copied to the output
Column Lineage
%3 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp requested_by 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change requested_by_email 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change requested_by_email 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[requested_by]
    • Cleaning The column is cast as TEXT and renamed
    • Output Columns:
      • requested_by_email: Directly mapped after casting and renaming
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[requested_by_email]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • requested_by_email: Directly copied to the output
Column Lineage
%3 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp source 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change change_source 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change change_source 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[source]
    • Cleaning The column is cast as TEXT and renamed
    • Output Columns:
      • change_source: Directly mapped after casting and renaming
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[change_source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • change_source: Directly copied to the output
Column Lineage
%3 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp subscriptions 83. model.hubspot_source.stg_hubspot__email_event_status_change 83. model.hubspot_source.stg_hubspot__email_event_status_change subscriptions 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp:f0->83. model.hubspot_source.stg_hubspot__email_event_status_change:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change subscriptions 83. model.hubspot_source.stg_hubspot__email_event_status_change:f0->20. model.hubspot.hubspot__email_event_status_change:f0
83. model.hubspot_source.stg_hubspot__email_event_status_change
  • Input Column: 84. model.hubspot_source.stg_hubspot__email_event_status_change_tmp[subscriptions]
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • subscriptions: Directly mapped after casting
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 83. model.hubspot_source.stg_hubspot__email_event_status_change[subscriptions]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • subscriptions: Directly copied to the output
85. model.hubspot_source.stg_hubspot__email_event_tmp

This SQL query is a simple SELECT statement that retrieves all columns from the TEST.hubspot.email_event table. The comment suggests that no columns were returned, possibly because the relation doesn't exist yet or all columns were excluded. The query appears to be a placeholder or template, potentially used for dbt compilation purposes or to satisfy SQLFluff requirements.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.email_event
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp id _fivetran_synced app_id caused_by_created caused_by_id created email_campaign_id obsoleted_by_created obsoleted_by_id portal_id sent_by_created sent_by_id type filtered_event recipient 124. source.hubspot_source.hubspot.email_event 124. source.hubspot_source.hubspot.email_event
Name Type Comment
id text None
_fivetran_synced timestamp without time zone None
app_id integer None
caused_by_created timestamp without time zone None
caused_by_id integer None
created timestamp without time zone None
email_campaign_id integer None
obsoleted_by_created timestamp without time zone None
obsoleted_by_id integer None
portal_id integer None
sent_by_created timestamp without time zone None
sent_by_id text None
type text None
filtered_event boolean None
recipient text None
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp id 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event event_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report event_id 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends event_id 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is renamed to 'event_id'
    • Output Columns:
      • event_id: Directly mapped and renamed
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join the base table with the events table
    • Output Columns:
      • event_id: Directly copied to the output
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join tables
    • Output Columns:
      • event_id: Directly copied
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration The column is used as the key to join with the base table
    • Output Columns:
      • event_id: Directly copied
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join tables
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • event_id: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join tables
    • Output Columns:
      • event_id: Directly copied to the output
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join with the base table
    • Output Columns:
      • event_id: Directly copied from the base table
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join with the base table
    • Output Columns:
      • event_id: Directly copied to the output
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join the base table with the events table
    • Output Columns:
      • event_id: Directly copied from the base table
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join with the base table
    • Output Columns:
      • event_id: Indirectly mapped, as it's used for joining but also exists in the base table
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Direct This column is directly selected in the final output without any transformation
    • Integration This column is used as the key to join the base table with the events table
    • Output Columns:
      • event_id: Directly copied to the output
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[event_id]
    • Integration This column is used as the key to join with the base table
    • Output Columns:
      • event_id: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[event_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • event_id: Directly copied
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event _fivetran_synced 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report _fivetran_synced 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends _fivetran_synced 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Output Columns:
      • _fivetran_synced: Cast as TIMESTAMP
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly selected in the final output without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp app_id 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event app_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[app_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • app_id: Directly mapped
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp caused_by_created 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event caused_timestamp 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[caused_by_created]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • caused_timestamp: Cast as TIMESTAMP and renamed
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp caused_by_id 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event caused_by_event_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[caused_by_id]
    • Cleaning The column is renamed
    • Output Columns:
      • caused_by_event_id: Directly mapped and renamed
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp created 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event created_timestamp 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report created_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends created_timestamp 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[created]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • created_timestamp: Cast as TIMESTAMP and renamed
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly selected in the final output without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event email_campaign_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report email_campaign_id 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_campaign_id 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns email_campaign_id 21. model.hubspot.hubspot__email_sends:f0->9. model.hubspot.hubspot__email_campaigns:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[email_campaign_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • email_campaign_id: Directly mapped
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly selected in the final output without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_campaign_id: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[email_campaign_id]
    • Direct This column is directly copied without any transformation
    • Integration This column is used to join with the email_aggregate_status_change CTE
    • Output Columns:
      • email_campaign_id: Directly copied
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[email_campaign_id]
    • Integration This column is used as the key to join the email_sends table with the campaigns table
    • Aggregation This column is used in the GROUP BY clause of the email_metrics CTE
    • Output Columns:
      • email_campaign_id: It is indirectly mapped to the output email_campaign_id through the join operation
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp obsoleted_by_created 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event obsoleted_timestamp 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[obsoleted_by_created]
    • Cleaning The column is cast as TIMESTAMP and renamed
    • Output Columns:
      • obsoleted_timestamp: Cast as TIMESTAMP and renamed
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp obsoleted_by_id 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event obsoleted_by_event_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[obsoleted_by_id]
    • Cleaning The column is renamed
    • Output Columns:
      • obsoleted_by_event_id: Directly mapped and renamed
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp portal_id 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event portal_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[portal_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • portal_id: Directly mapped
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_created 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_timestamp 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report email_send_timestamp 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_timestamp 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_created]
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • sent_timestamp: Directly mapped after casting to TIMESTAMP
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed to 'email_send_timestamp' in the output
    • Output Columns:
      • email_send_timestamp: Renamed and directly copied to the output
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed for clarity
    • Output Columns:
      • email_send_timestamp: Directly mapped and renamed
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied and renamed
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output and renamed
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[email_send_timestamp]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_timestamp: Directly copied to the output
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp sent_by_id 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event sent_by_event_id 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 31. model.hubspot.int_hubspot__email_event_aggregates 31. model.hubspot.int_hubspot__email_event_aggregates email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->31. model.hubspot.int_hubspot__email_event_aggregates:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report email_send_id 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends email_send_id unsubscribes was_unsubcribed 31. model.hubspot.int_hubspot__email_event_aggregates:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change 30. model.hubspot.int_hubspot__email_aggregate_status_change email_send_id 20. model.hubspot.hubspot__email_event_status_change:f0->30. model.hubspot.int_hubspot__email_aggregate_status_change:f0 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f1->5. model.hubspot.hubspot__contacts:f0 21. model.hubspot.hubspot__email_sends:f2->5. model.hubspot.hubspot__contacts:f1 21. model.hubspot.hubspot__email_sends:f2->5. model.hubspot.hubspot__contacts:f0 32. model.hubspot.int_hubspot__email_metrics__by_contact_list 32. model.hubspot.int_hubspot__email_metrics__by_contact_list total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f1->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 21. model.hubspot.hubspot__email_sends:f2->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1 21. model.hubspot.hubspot__email_sends:f2->32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f0 9. model.hubspot.hubspot__email_campaigns 9. model.hubspot.hubspot__email_campaigns total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f1->9. model.hubspot.hubspot__email_campaigns:f0 21. model.hubspot.hubspot__email_sends:f2->9. model.hubspot.hubspot__email_campaigns:f1 21. model.hubspot.hubspot__email_sends:f2->9. model.hubspot.hubspot__email_campaigns:f0 4. model.hubspot.hubspot__contact_lists 4. model.hubspot.hubspot__contact_lists total_unique_unsubscribes total_unsubscribes 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f1->4. model.hubspot.hubspot__contact_lists:f0 21. model.hubspot.hubspot__email_sends:f2->4. model.hubspot.hubspot__contact_lists:f1 21. model.hubspot.hubspot__email_sends:f2->4. model.hubspot.hubspot__contact_lists:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f0 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f1 30. model.hubspot.int_hubspot__email_aggregate_status_change:f0->21. model.hubspot.hubspot__email_sends:f2 32. model.hubspot.int_hubspot__email_metrics__by_contact_list:f1->4. model.hubspot.hubspot__contact_lists:f1
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[sent_by_id]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • sent_by_event_id: Directly mapped without changes
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed to 'email_send_id' in the output
    • Output Columns:
      • email_send_id: Renamed and directly copied to the output
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed for clarity
    • Output Columns:
      • email_send_id: Directly mapped and renamed
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied and renamed
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_send_id: Directly copied to the output and renamed
31. model.hubspot.int_hubspot__email_event_aggregates
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[sent_by_event_id]
    • Filtering This column is used to filter out null values
    • Integration It's used as the key to group events
    • Aggregation It's used as the grouping key for all aggregations
    • Output Columns:
      • email_send_id: This column is directly mapped to email_send_id in the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 30. model.hubspot.int_hubspot__email_aggregate_status_change[email_send_id]
    • Integration This column is used as the key to join the aggregated status change data with the main email event data
    • Direct The column is directly copied to the output without transformation
    • Output Columns:
      • email_send_id: It is directly copied to the output column of the same name
      • unsubscribes: It is used to join and bring in the unsubscribe count
      • was_unsubcribed: It is used to join and bring in the unsubscribe information, which is then used to calculate this boolean flag
30. model.hubspot.int_hubspot__email_aggregate_status_change
  • Input Column: 20. model.hubspot.hubspot__email_event_status_change[email_send_id]
    • Filtering The column is filtered to exclude null values (WHERE NOT email_send_id IS NULL)
    • Aggregation The column is used in the GROUP BY clause
    • Output Columns:
      • email_send_id: This column is directly copied to the output
4. model.hubspot.hubspot__contact_lists
  • Input Column: 32. model.hubspot.int_hubspot__email_metrics__by_contact_list[total_unsubscribes]
    • Direct This column is directly copied from the input to the output without any transformation.
    • Output Columns:
      • total_unsubscribes: Directly copied
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate the total number of unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Summed up for each contact
      • total_unique_unsubscribes: Counted as unique occurrences for each contact
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is used to count the total number of unsubscribe email events and unique unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribe events
      • total_unique_unsubscribes: Aggregated count of unique unsubscribe events
9. model.hubspot.hubspot__email_campaigns
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate the total number of unsubscribe email events.
    • Output Columns:
      • total_unsubscribes: Summed up to get the total number of unsubscribe events.
      • total_unique_unsubscribes: Counted to get the number of unique email sends with unsubscribe events.
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is likely used to calculate the total_unsubscribes and total_unique_unsubscribes metrics in the output.
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribes
      • total_unique_unsubscribes: Aggregated count of unique unsubscribes
32. model.hubspot.int_hubspot__email_metrics__by_contact_list
  • Input Column: 21. model.hubspot.hubspot__email_sends[unsubscribes]
    • Aggregation This column is aggregated to calculate total unsubscribes and unique unsubscribes
    • Output Columns:
      • total_unsubscribes: Sum of all unsubscribes
      • total_unique_unsubscribes: Count of distinct unsubscribes
  • Input Column: 21. model.hubspot.hubspot__email_sends[was_unsubcribed]
    • Aggregation This column is likely used to calculate the total_unsubscribes and total_unique_unsubscribes in the output
    • Output Columns:
      • total_unsubscribes: Aggregated count of all unsubscribes
      • total_unique_unsubscribes: Aggregated count of unique unsubscribes
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp type 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event event_type 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • event_type: Directly mapped without changes
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp filtered_event 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event is_filtered_event 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[filtered_event]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • is_filtered_event: Directly mapped without changes
Column Lineage
%3 85. model.hubspot_source.stg_hubspot__email_event_tmp 85. model.hubspot_source.stg_hubspot__email_event_tmp recipient 62. model.hubspot_source.stg_hubspot__email_event 62. model.hubspot_source.stg_hubspot__email_event recipient_email_address 85. model.hubspot_source.stg_hubspot__email_event_tmp:f0->62. model.hubspot_source.stg_hubspot__email_event:f0 20. model.hubspot.hubspot__email_event_status_change 20. model.hubspot.hubspot__email_event_status_change recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->20. model.hubspot.hubspot__email_event_status_change:f0 13. model.hubspot.hubspot__email_event_delivered 13. model.hubspot.hubspot__email_event_delivered recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->13. model.hubspot.hubspot__email_event_delivered:f0 15. model.hubspot.hubspot__email_event_forward 15. model.hubspot.hubspot__email_event_forward recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->15. model.hubspot.hubspot__email_event_forward:f0 18. model.hubspot.hubspot__email_event_sent 18. model.hubspot.hubspot__email_event_sent recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->18. model.hubspot.hubspot__email_event_sent:f0 12. model.hubspot.hubspot__email_event_deferred 12. model.hubspot.hubspot__email_event_deferred recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->12. model.hubspot.hubspot__email_event_deferred:f0 14. model.hubspot.hubspot__email_event_dropped 14. model.hubspot.hubspot__email_event_dropped recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->14. model.hubspot.hubspot__email_event_dropped:f0 16. model.hubspot.hubspot__email_event_opens 16. model.hubspot.hubspot__email_event_opens recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->16. model.hubspot.hubspot__email_event_opens:f0 11. model.hubspot.hubspot__email_event_clicks 11. model.hubspot.hubspot__email_event_clicks recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->11. model.hubspot.hubspot__email_event_clicks:f0 10. model.hubspot.hubspot__email_event_bounce 10. model.hubspot.hubspot__email_event_bounce recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->10. model.hubspot.hubspot__email_event_bounce:f0 17. model.hubspot.hubspot__email_event_print 17. model.hubspot.hubspot__email_event_print recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->17. model.hubspot.hubspot__email_event_print:f0 19. model.hubspot.hubspot__email_event_spam_report 19. model.hubspot.hubspot__email_event_spam_report recipient_email_address 62. model.hubspot_source.stg_hubspot__email_event:f0->19. model.hubspot.hubspot__email_event_spam_report:f0 21. model.hubspot.hubspot__email_sends 21. model.hubspot.hubspot__email_sends recipient_email_address 18. model.hubspot.hubspot__email_event_sent:f0->21. model.hubspot.hubspot__email_sends:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts 21. model.hubspot.hubspot__email_sends:f0->5. model.hubspot.hubspot__contacts:header
62. model.hubspot_source.stg_hubspot__email_event
  • Input Column: 85. model.hubspot_source.stg_hubspot__email_event_tmp[recipient]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • recipient_email_address: Directly mapped without changes
10. model.hubspot.hubspot__email_event_bounce
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct This column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
11. model.hubspot.hubspot__email_event_clicks
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
12. model.hubspot.hubspot__email_event_deferred
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
13. model.hubspot.hubspot__email_event_delivered
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
14. model.hubspot.hubspot__email_event_dropped
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly mapped
15. model.hubspot.hubspot__email_event_forward
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
16. model.hubspot.hubspot__email_event_opens
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
17. model.hubspot.hubspot__email_event_print
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied
18. model.hubspot.hubspot__email_event_sent
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
19. model.hubspot.hubspot__email_event_spam_report
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
20. model.hubspot.hubspot__email_event_status_change
  • Input Column: 62. model.hubspot_source.stg_hubspot__email_event[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the contacts table
    • Output Columns:
      • recipient_email_address: Directly copied to the output
21. model.hubspot.hubspot__email_sends
  • Input Column: 18. model.hubspot.hubspot__email_event_sent[recipient_email_address]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • recipient_email_address: Directly copied to the output
5. model.hubspot.hubspot__contacts
  • Input Column: 21. model.hubspot.hubspot__email_sends[recipient_email_address]
    • Integration used as the key to join with contacts table
86. model.hubspot_source.stg_hubspot__engagement

This SQL query performs type casting and column renaming on the 'stg_hubspot__engagement' model. It starts by selecting all columns from a temporary table, then defines a set of columns with specific data types using a CTE named 'macro'. Finally, it selects and renames specific columns from the 'macro' CTE, casting them to the appropriate data types.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS BOOLEAN) AS is_active,
    CAST(NULL AS TIMESTAMP) AS created_timestamp,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS INT) AS owner_id,
    CAST(NULL AS INT) AS portal_id,
    CAST(NULL AS TIMESTAMP) AS occurred_timestamp,
    CAST(NULL AS TEXT) AS engagement_type
  FROM base
), fields AS (
  SELECT
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    id AS engagement_id,
    created_timestamp,
    owner_id,
    occurred_timestamp,
    portal_id,
    engagement_type,
    is_active
  FROM macro
)
SELECT
  *
FROM fields
%3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement _fivetran_synced engagement_id engagement_type is_active occurred_timestamp created_timestamp owner_id portal_id 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp id type _fivetran_synced portal_id 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f1 103. model.hubspot_source.stg_hubspot__engagement_tmp:f1->86. model.hubspot_source.stg_hubspot__engagement:f2 103. model.hubspot_source.stg_hubspot__engagement_tmp:f2->86. model.hubspot_source.stg_hubspot__engagement:f0 103. model.hubspot_source.stg_hubspot__engagement_tmp:f3->86. model.hubspot_source.stg_hubspot__engagement:f7
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
engagement_id bigint The ID of the engagement.
engagement_type text One of NOTE, EMAIL, TASK, MEETING, or CALL, the type of the engagement.
is_active boolean Whether the engagement is currently being shown in the UI. PLEASE NOTE - This field will only be populated for pre HubSpot v3 API versions. This field is only included to allow for backwards compatibility between HubSpot API versions. This field will be deprecated in the near future.
occurred_timestamp timestamp without time zone A timestamp in representing the time that the engagement should appear in the timeline. PLEASE NOTE - This field will only be populated for pre HubSpot v3 API versions. This field is only included to allow for backwards compatibility between HubSpot API versions. This field will be deprecated in the near future.
created_timestamp timestamp without time zone This field marks the call's time of creation and determines where the call sits on the record timeline. You can use either a Unix timestamp in milliseconds or UTC format. PLEASE NOTE: This field will only be populated for pre HubSpot v3 API versions. This field is only included to allow for backwards compatibility between HubSpot API versions. This field will be deprecated in the near future.
owner_id integer The ID of the engagement's owner. PLEASE NOTE - This field will only be populated for pre HubSpot v3 API versions. This field is only included to allow for backwards compatibility between HubSpot API versions. This field will be deprecated in the near future.
portal_id integer The hub ID.
Column Lineage
%3 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp _fivetran_synced 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement _fivetran_synced 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements _fivetran_synced 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails _fivetran_synced 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks _fivetran_synced 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls _fivetran_synced 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes _fivetran_synced 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[_fivetran_synced]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Directly mapped without renaming
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[_fivetran_synced]
    • Direct This column is directly included in the final output without transformation.
    • Output Columns:
      • _fivetran_synced: Directly copied to the output.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[_fivetran_synced]
    • Direct This column is directly copied from the input to the output
    • Output Columns:
      • _fivetran_synced: Directly copied
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[_fivetran_synced]
    • Direct This column is directly selected in the final output without transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp id 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_id 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_id 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:header 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:header 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:header 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_id 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:header 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls engagement_id 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes engagement_id 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • engagement_id: Directly mapped and renamed
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as the key to join with other tables (contacts_agg, deals_agg, companies_agg)
    • Output Columns:
      • engagement_id: Directly copied to the output
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used to join the engagements table with the engagement_companies table
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used to join engagements with engagement_deals table
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables.
    • Direct Included in the final output.
    • Output Columns:
      • engagement_id: Directly copied to the output.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the engagements table with the base table
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join with the base table
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied after join
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied to the output
Column Lineage
%3 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f0 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f3 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f2 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f2 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails engagement_type 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_type 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls engagement_type 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes engagement_type 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Featurization Used to create separate counts for each engagement type
    • Output Columns:
      • count_engagement_notes: Counted when engagement_type = 'NOTE'
      • count_engagement_tasks: Counted when engagement_type = 'TASK'
      • count_engagement_calls: Counted when engagement_type = 'CALL'
      • count_engagement_meetings: Counted when engagement_type = 'MEETING'
      • count_engagement_emails: Counted when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Counted when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Counted when engagement_type = 'FORWARDED_EMAIL'
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Output Columns:
      • count_engagement_notes: Aggregated into this output column
      • count_engagement_tasks: Aggregated into this output column
      • count_engagement_calls: Aggregated into this output column
      • count_engagement_meetings: Aggregated into this output column
      • count_engagement_emails: Aggregated into this output column
      • count_engagement_incoming_emails: Aggregated into this output column
      • count_engagement_forwarded_emails: Aggregated into this output column
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Direct This column is directly included in the final output without transformation.
    • Output Columns:
      • engagement_type: Directly copied to the output.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Direct This column is directly copied from the input to the output
    • Output Columns:
      • engagement_type: Directly copied
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Direct This column is directly selected in the final output without transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
Column Lineage
%3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement is_active 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements is_active 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails is_active 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks is_active 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings is_active 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls is_active 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes is_active 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[is_active]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • is_active: Directly copied to the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[is_active]
    • Cleaning Used in a COALESCE function with NOT base._fivetran_deleted to determine the final is_active status.
    • Output Columns:
      • is_active: Coalesced with NOT base._fivetran_deleted.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[is_active]
    • Integration This column is used in a COALESCE function to determine the final is_active status
    • Output Columns:
      • is_active: Used in COALESCE with NOT base._fivetran_deleted
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[is_active]
    • Cleaning Used in a COALESCE function with the negation of base._fivetran_deleted
    • Output Columns:
      • is_active: Coalesced with NOT base._fivetran_deleted
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[is_active]
    • Cleaning This column is used in a COALESCE function with a derived value from the base table
    • Output Columns:
      • is_active: Coalesced with NOT base._fivetran_deleted
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[is_active]
    • Cleaning Used in a COALESCE function with NOT base._fivetran_deleted to determine the final is_active status
    • Output Columns:
      • is_active: Mapped after COALESCE with NOT base._fivetran_deleted
Column Lineage
%3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement occurred_timestamp 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements occurred_timestamp 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails occurred_timestamp 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks occurred_timestamp 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings occurred_timestamp 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls occurred_timestamp 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes occurred_timestamp 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[occurred_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • occurred_timestamp: Directly copied to the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[occurred_timestamp]
    • Cleaning Used in a COALESCE function to handle potential null values.
    • Output Columns:
      • occurred_timestamp: Coalesced with base.occurred_timestamp.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[occurred_timestamp]
    • Integration This column is used in a COALESCE function to determine the final occurred_timestamp
    • Output Columns:
      • occurred_timestamp: Used in COALESCE with base.occurred_timestamp
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[occurred_timestamp]
    • Cleaning The column is used in a COALESCE function to ensure a value is present
    • Output Columns:
      • occurred_timestamp: Coalesced with base.occurred_timestamp
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[occurred_timestamp]
    • Cleaning This column is used in a COALESCE function to prioritize its value over the base table's value
    • Output Columns:
      • occurred_timestamp: Coalesced with base.occurred_timestamp
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[occurred_timestamp]
    • Cleaning Used in a COALESCE function to handle potential null values
    • Output Columns:
      • occurred_timestamp: Mapped after COALESCE with base.occurred_timestamp
Column Lineage
%3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement created_timestamp 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements created_timestamp 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails created_timestamp 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks created_timestamp 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings created_timestamp 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls created_timestamp 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes created_timestamp 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[created_timestamp]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • created_timestamp: Directly copied to the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[created_timestamp]
    • Cleaning Used in a COALESCE function to handle potential null values.
    • Output Columns:
      • created_timestamp: Coalesced with base.created_timestamp.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[created_timestamp]
    • Integration This column is used in a COALESCE function to determine the final created_timestamp
    • Output Columns:
      • created_timestamp: Used in COALESCE with base.created_timestamp
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[created_timestamp]
    • Cleaning The column is used in a COALESCE function to ensure a value is present
    • Output Columns:
      • created_timestamp: Coalesced with base.created_timestamp
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[created_timestamp]
    • Cleaning This column is used in a COALESCE function to prioritize its value over the base table's value
    • Output Columns:
      • created_timestamp: Coalesced with base.created_timestamp
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[created_timestamp]
    • Cleaning Used in a COALESCE function to handle potential null values
    • Output Columns:
      • created_timestamp: Mapped after COALESCE with base.created_timestamp
Column Lineage
%3 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement owner_id 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements owner_id 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails owner_id 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks owner_id 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings owner_id 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls owner_id 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes owner_id 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[owner_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • owner_id: Directly copied to the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[owner_id]
    • Cleaning Used in a COALESCE function to handle potential null values.
    • Output Columns:
      • owner_id: Coalesced with base.owner_id.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[owner_id]
    • Integration This column is used in a COALESCE function to determine the final owner_id
    • Output Columns:
      • owner_id: Used in COALESCE with base.owner_id
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[owner_id]
    • Cleaning The column is used in a COALESCE function to ensure a value is present
    • Output Columns:
      • owner_id: Coalesced with base.owner_id
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[owner_id]
    • Cleaning This column is used in a COALESCE function to prioritize its value over the base table's value
    • Output Columns:
      • owner_id: Coalesced with base.owner_id
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[owner_id]
    • Cleaning Used in a COALESCE function to handle potential null values
    • Output Columns:
      • owner_id: Mapped after COALESCE with base.owner_id
Column Lineage
%3 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp portal_id 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement portal_id 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements portal_id 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[portal_id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • portal_id: Directly mapped without renaming
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[portal_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • portal_id: Directly copied to the output
87. model.hubspot_source.stg_hubspot__engagement_call

This SQL query creates a staging table for Hubspot engagement call data. It starts by selecting all columns from a temporary table, then creates a new structure with specific data types for each column, casting all values to NULL. This serves as a template or schema definition for the staging table, ensuring consistent data types and structure.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_call_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
    CAST(NULL AS INT) AS engagement_id,
    CAST(NULL AS TEXT) AS engagement_type,
    CAST(NULL AS TIMESTAMP) AS created_timestamp,
    CAST(NULL AS TIMESTAMP) AS occurred_timestamp,
    CAST(NULL AS INT) AS owner_id,
    CAST(NULL AS INT) AS team_id
  FROM base
)
SELECT
  *
FROM macro
%3 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call _fivetran_synced engagement_id _fivetran_deleted engagement_type created_timestamp occurred_timestamp owner_id team_id 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp engagement_id _fivetran_deleted _fivetran_synced property_hs_createdate property_hs_timestamp type 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f1 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f1->87. model.hubspot_source.stg_hubspot__engagement_call:f2 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f2->87. model.hubspot_source.stg_hubspot__engagement_call:f0 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f3->87. model.hubspot_source.stg_hubspot__engagement_call:f4 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f4->87. model.hubspot_source.stg_hubspot__engagement_call:f5 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f5->87. model.hubspot_source.stg_hubspot__engagement_call:f3
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
engagement_id bigint The ID of the engagement.
_fivetran_deleted boolean Boolean to mark rows that were deleted in the source database.
engagement_type text The type of the engagement.
created_timestamp timestamp without time zone This field marks the call's time of creation and determines where the call sits on the record timeline. You can use either a Unix timestamp in milliseconds or UTC format. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version. For the pre HubSpot v3 versions, this value may be found within the parent `engagement` table.
occurred_timestamp timestamp without time zone This field marks the call's time of occurrence and determines where the call sits on the record timeline. You can use either a Unix timestamp in milliseconds or UTC format. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version. For the pre HubSpot v3 versions, this value may be found within the parent `engagement` table.
owner_id integer The ID of the owner associated with the call. This field determines the user listed as the call creator on the record timeline. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version. For the pre HubSpot v3 versions, this value may be found within the parent `engagement` table.
team_id integer The ID of the team associated with the call. This field determines the team listed as the call creator on the record timeline. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version.
Column Lineage
%3 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp _fivetran_synced 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call _fivetran_synced 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls _fivetran_synced 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0
87. model.hubspot_source.stg_hubspot__engagement_call
  • Input Column: 88. model.hubspot_source.stg_hubspot__engagement_call_tmp[_fivetran_synced]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • _fivetran_synced: Directly mapped to the output _fivetran_synced column
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp engagement_id 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call engagement_id 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls engagement_id 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0
87. model.hubspot_source.stg_hubspot__engagement_call
  • Input Column: 88. model.hubspot_source.stg_hubspot__engagement_call_tmp[engagement_id]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • engagement_id: Directly mapped to the output engagement_id column
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[engagement_id]
    • Integration This column is used as the key to join with the engagements table
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_id: Directly copied to the output
Column Lineage
%3 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp _fivetran_deleted 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call _fivetran_deleted 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls is_active 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0
87. model.hubspot_source.stg_hubspot__engagement_call
  • Input Column: 88. model.hubspot_source.stg_hubspot__engagement_call_tmp[_fivetran_deleted]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • _fivetran_deleted: Directly mapped to the output _fivetran_deleted column
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[_fivetran_deleted]
    • Cleaning This column is used in a COALESCE function to determine the is_active status
    • Output Columns:
      • is_active: Used in COALESCE(engagements.is_active, NOT base._fivetran_deleted)
Column Lineage
%3 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp type 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call engagement_type 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls engagement_type 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0
87. model.hubspot_source.stg_hubspot__engagement_call
  • Input Column: 88. model.hubspot_source.stg_hubspot__engagement_call_tmp[type]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • engagement_type: Mapped to the output engagement_type column
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
Column Lineage
%3 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp property_hs_createdate 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call created_timestamp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls created_timestamp 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0
87. model.hubspot_source.stg_hubspot__engagement_call
  • Input Column: 88. model.hubspot_source.stg_hubspot__engagement_call_tmp[property_hs_createdate]
    • Cleaning This column is likely cleaned and cast as a TIMESTAMP
    • Output Columns:
      • created_timestamp: Mapped to the output created_timestamp column after casting
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[created_timestamp]
    • Cleaning This column is used in a COALESCE function to determine the final created_timestamp
    • Output Columns:
      • created_timestamp: Used in COALESCE(engagements.created_timestamp, base.created_timestamp)
Column Lineage
%3 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp property_hs_timestamp 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call occurred_timestamp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls occurred_timestamp 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0
87. model.hubspot_source.stg_hubspot__engagement_call
  • Input Column: 88. model.hubspot_source.stg_hubspot__engagement_call_tmp[property_hs_timestamp]
    • Cleaning This column is likely cleaned and cast as a TIMESTAMP
    • Output Columns:
      • occurred_timestamp: Mapped to the output occurred_timestamp column after casting
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[occurred_timestamp]
    • Cleaning This column is used in a COALESCE function to determine the final occurred_timestamp
    • Output Columns:
      • occurred_timestamp: Used in COALESCE(engagements.occurred_timestamp, base.occurred_timestamp)
Column Lineage
%3 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call owner_id 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls owner_id 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[owner_id]
    • Cleaning This column is used in a COALESCE function to determine the final owner_id
    • Output Columns:
      • owner_id: Used in COALESCE(engagements.owner_id, base.owner_id)
Column Lineage
%3 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call team_id 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls team_id 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[team_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • team_id: Directly copied to the output
88. model.hubspot_source.stg_hubspot__engagement_call_tmp

This SQL query is a simple SELECT statement that retrieves all columns from the 'engagement_call' table in the 'hubspot' schema of the 'TEST' database. The query doesn't perform any specific data manipulation or filtering. The comment suggests that this might be a placeholder or template query, possibly used during compilation or to satisfy a linter (SQLFluff).

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.engagement_call
%3 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp engagement_id _fivetran_deleted _fivetran_synced property_hs_createdate property_hs_timestamp type 137. source.hubspot_source.hubspot.engagement_call 137. source.hubspot_source.hubspot.engagement_call
Name Type Comment
engagement_id bigint None
_fivetran_deleted boolean None
_fivetran_synced timestamp without time zone None
property_hs_createdate timestamp without time zone None
property_hs_timestamp timestamp without time zone None
type text None
Column Lineage
%3 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp engagement_id 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call engagement_id 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls engagement_id 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0
87. model.hubspot_source.stg_hubspot__engagement_call
  • Input Column: 88. model.hubspot_source.stg_hubspot__engagement_call_tmp[engagement_id]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • engagement_id: Directly mapped to the output engagement_id column
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[engagement_id]
    • Integration This column is used as the key to join with the engagements table
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_id: Directly copied to the output
Column Lineage
%3 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp _fivetran_deleted 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call _fivetran_deleted 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls is_active 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0
87. model.hubspot_source.stg_hubspot__engagement_call
  • Input Column: 88. model.hubspot_source.stg_hubspot__engagement_call_tmp[_fivetran_deleted]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • _fivetran_deleted: Directly mapped to the output _fivetran_deleted column
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[_fivetran_deleted]
    • Cleaning This column is used in a COALESCE function to determine the is_active status
    • Output Columns:
      • is_active: Used in COALESCE(engagements.is_active, NOT base._fivetran_deleted)
Column Lineage
%3 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp _fivetran_synced 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call _fivetran_synced 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls _fivetran_synced 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0
87. model.hubspot_source.stg_hubspot__engagement_call
  • Input Column: 88. model.hubspot_source.stg_hubspot__engagement_call_tmp[_fivetran_synced]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • _fivetran_synced: Directly mapped to the output _fivetran_synced column
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp property_hs_createdate 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call created_timestamp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls created_timestamp 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0
87. model.hubspot_source.stg_hubspot__engagement_call
  • Input Column: 88. model.hubspot_source.stg_hubspot__engagement_call_tmp[property_hs_createdate]
    • Cleaning This column is likely cleaned and cast as a TIMESTAMP
    • Output Columns:
      • created_timestamp: Mapped to the output created_timestamp column after casting
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[created_timestamp]
    • Cleaning This column is used in a COALESCE function to determine the final created_timestamp
    • Output Columns:
      • created_timestamp: Used in COALESCE(engagements.created_timestamp, base.created_timestamp)
Column Lineage
%3 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp property_hs_timestamp 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call occurred_timestamp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls occurred_timestamp 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0
87. model.hubspot_source.stg_hubspot__engagement_call
  • Input Column: 88. model.hubspot_source.stg_hubspot__engagement_call_tmp[property_hs_timestamp]
    • Cleaning This column is likely cleaned and cast as a TIMESTAMP
    • Output Columns:
      • occurred_timestamp: Mapped to the output occurred_timestamp column after casting
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[occurred_timestamp]
    • Cleaning This column is used in a COALESCE function to determine the final occurred_timestamp
    • Output Columns:
      • occurred_timestamp: Used in COALESCE(engagements.occurred_timestamp, base.occurred_timestamp)
Column Lineage
%3 88. model.hubspot_source.stg_hubspot__engagement_call_tmp 88. model.hubspot_source.stg_hubspot__engagement_call_tmp type 87. model.hubspot_source.stg_hubspot__engagement_call 87. model.hubspot_source.stg_hubspot__engagement_call engagement_type 88. model.hubspot_source.stg_hubspot__engagement_call_tmp:f0->87. model.hubspot_source.stg_hubspot__engagement_call:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls engagement_type 87. model.hubspot_source.stg_hubspot__engagement_call:f0->22. model.hubspot.hubspot__engagement_calls:f0
87. model.hubspot_source.stg_hubspot__engagement_call
  • Input Column: 88. model.hubspot_source.stg_hubspot__engagement_call_tmp[type]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • engagement_type: Mapped to the output engagement_type column
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 87. model.hubspot_source.stg_hubspot__engagement_call[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
89. model.hubspot_source.stg_hubspot__engagement_company

This SQL query creates a template or skeleton for the 'stg_hubspot__engagement_company' model. It selects all columns from a temporary table and then creates a CTE named 'macro' that defines the structure of the final output with three nullable columns: _fivetran_synced (TIMESTAMP), company_id (INT), and engagement_id (INT). The final SELECT statement returns all columns from the 'macro' CTE.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_company_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS company_id,
    CAST(NULL AS INT) AS engagement_id
  FROM base
)
SELECT
  *
FROM macro
%3 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company _fivetran_synced company_id engagement_id engagement_type type_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp company_id engagement_id _fivetran_synced 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f1 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f1->89. model.hubspot_source.stg_hubspot__engagement_company:f2 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f2->89. model.hubspot_source.stg_hubspot__engagement_company:f0
Name Type Comment
_fivetran_synced text Timestamp of when Fivetran synced a record.
company_id bigint The ID of the related company.
engagement_id bigint The ID of the related engagement.
engagement_type text None
type_id integer None
Column Lineage
%3 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp _fivetran_synced 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company _fivetran_synced 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output column
Column Lineage
%3 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp company_id 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company company_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies company_id count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 89. model.hubspot_source.stg_hubspot__engagement_company:f0->1. model.hubspot.hubspot__companies:f0 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements company_ids 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f0 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f2 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f3 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails company_ids 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks company_ids 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings company_ids 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls company_ids 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes company_ids 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly copied to the output column
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Integration This column is indirectly used through the join between engagements and engagement_companies tables using the engagement_id.
    • Aggregation The company_id (derived from this list) is used to group engagements by company.
    • Output Columns:
      • company_id: The company_id is used to link engagements to companies and is ultimately mapped to the company_id in the final output.
      • count_engagement_notes: Aggregated count based on this column and engagement_type.
      • count_engagement_tasks: Aggregated count based on this column and engagement_type.
      • count_engagement_calls: Aggregated count based on this column and engagement_type.
      • count_engagement_meetings: Aggregated count based on this column and engagement_type.
      • count_engagement_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_incoming_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_forwarded_emails: Aggregated count based on this column and engagement_type.
27. model.hubspot.hubspot__engagements
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[company_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • company_ids: The company_id is aggregated into the company_ids array in the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation
    • Output Columns:
      • company_ids: Directly copied from engagements.company_ids to the output
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_ids: Directly copied to the output
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied from the engagements table to the output
    • Output Columns:
      • company_ids: Directly copied from the engagements table
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the LEFT JOIN operation to combine data from the base and engagements tables
    • Output Columns:
      • company_ids: Directly copied to the output
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation.
    • Output Columns:
      • company_ids: Directly copied from the engagements table.
Column Lineage
%3 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp engagement_id 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company engagement_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies 89. model.hubspot_source.stg_hubspot__engagement_company:f0->1. model.hubspot.hubspot__companies:header 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_id 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:header 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:header 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:header 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_id 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:header 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls engagement_id 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes engagement_id 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • engagement_id: Directly copied to the output column
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used to join the engagements table with the engagement_companies table
27. model.hubspot.hubspot__engagements
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[engagement_id]
    • Integration This column is used as the key to join with other tables
    • Aggregation This column is used as the grouping key for aggregating company_ids
    • Output Columns:
      • engagement_id: This column is indirectly mapped to the engagement_id in the final output through joins
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used to join engagements with engagement_deals table
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables.
    • Direct Included in the final output.
    • Output Columns:
      • engagement_id: Directly copied to the output.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the engagements table with the base table
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join with the base table
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied after join
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied to the output
Column Lineage
%3 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company engagement_type 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 89. model.hubspot_source.stg_hubspot__engagement_company:f0->1. model.hubspot.hubspot__companies:f5 89. model.hubspot_source.stg_hubspot__engagement_company:f0->1. model.hubspot.hubspot__companies:f6 89. model.hubspot_source.stg_hubspot__engagement_company:f0->1. model.hubspot.hubspot__companies:f0 89. model.hubspot_source.stg_hubspot__engagement_company:f0->1. model.hubspot.hubspot__companies:f4 89. model.hubspot_source.stg_hubspot__engagement_company:f0->1. model.hubspot.hubspot__companies:f1 89. model.hubspot_source.stg_hubspot__engagement_company:f0->1. model.hubspot.hubspot__companies:f3 89. model.hubspot_source.stg_hubspot__engagement_company:f0->1. model.hubspot.hubspot__companies:f2
1. model.hubspot.hubspot__companies
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[engagement_type]
    • Featurization Used to categorize different types of engagements
    • Aggregation Used in CASE statements to count different engagement types
    • Output Columns:
      • count_engagement_notes: Aggregated count when engagement_type = 'NOTE'
      • count_engagement_tasks: Aggregated count when engagement_type = 'TASK'
      • count_engagement_calls: Aggregated count when engagement_type = 'CALL'
      • count_engagement_meetings: Aggregated count when engagement_type = 'MEETING'
      • count_engagement_emails: Aggregated count when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count when engagement_type = 'FORWARDED_EMAIL'
90. model.hubspot_source.stg_hubspot__engagement_company_tmp

This SQL query selects all columns from the 'engagement_company' table in the 'hubspot' schema of the 'TEST' database. The query is designed to be a staging step, likely used in a dbt (data build tool) project. The comment suggests that the table might not exist yet or all columns were excluded, and the star (*) is used as a placeholder to keep SQLFluff (a SQL linter) happy during dbt compilation.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.engagement_company
%3 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp company_id engagement_id engagement_type type_id _fivetran_synced 138. source.hubspot_source.hubspot.engagement_company 138. source.hubspot_source.hubspot.engagement_company
Name Type Comment
company_id bigint None
engagement_id bigint None
engagement_type text None
type_id integer None
_fivetran_synced text None
Column Lineage
%3 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp company_id 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company company_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies company_id count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 89. model.hubspot_source.stg_hubspot__engagement_company:f0->1. model.hubspot.hubspot__companies:f0 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements company_ids 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f0 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f7 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f2 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f3 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails company_ids 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks company_ids 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings company_ids 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls company_ids 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes company_ids 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[company_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_id: Directly copied to the output column
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Integration This column is indirectly used through the join between engagements and engagement_companies tables using the engagement_id.
    • Aggregation The company_id (derived from this list) is used to group engagements by company.
    • Output Columns:
      • company_id: The company_id is used to link engagements to companies and is ultimately mapped to the company_id in the final output.
      • count_engagement_notes: Aggregated count based on this column and engagement_type.
      • count_engagement_tasks: Aggregated count based on this column and engagement_type.
      • count_engagement_calls: Aggregated count based on this column and engagement_type.
      • count_engagement_meetings: Aggregated count based on this column and engagement_type.
      • count_engagement_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_incoming_emails: Aggregated count based on this column and engagement_type.
      • count_engagement_forwarded_emails: Aggregated count based on this column and engagement_type.
27. model.hubspot.hubspot__engagements
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[company_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • company_ids: The company_id is aggregated into the company_ids array in the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation
    • Output Columns:
      • company_ids: Directly copied from engagements.company_ids to the output
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • company_ids: Directly copied to the output
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied from the engagements table to the output
    • Output Columns:
      • company_ids: Directly copied from the engagements table
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the LEFT JOIN operation to combine data from the base and engagements tables
    • Output Columns:
      • company_ids: Directly copied to the output
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[company_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation.
    • Output Columns:
      • company_ids: Directly copied from the engagements table.
Column Lineage
%3 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp engagement_id 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company engagement_id 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies 89. model.hubspot_source.stg_hubspot__engagement_company:f0->1. model.hubspot.hubspot__companies:header 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_id 89. model.hubspot_source.stg_hubspot__engagement_company:f0->27. model.hubspot.hubspot__engagements:f0 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:header 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:header 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:header 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_id 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:header 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls engagement_id 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes engagement_id 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • engagement_id: Directly copied to the output column
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used to join the engagements table with the engagement_companies table
27. model.hubspot.hubspot__engagements
  • Input Column: 89. model.hubspot_source.stg_hubspot__engagement_company[engagement_id]
    • Integration This column is used as the key to join with other tables
    • Aggregation This column is used as the grouping key for aggregating company_ids
    • Output Columns:
      • engagement_id: This column is indirectly mapped to the engagement_id in the final output through joins
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used to join engagements with engagement_deals table
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables.
    • Direct Included in the final output.
    • Output Columns:
      • engagement_id: Directly copied to the output.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the engagements table with the base table
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join with the base table
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied after join
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied to the output
Column Lineage
%3 90. model.hubspot_source.stg_hubspot__engagement_company_tmp 90. model.hubspot_source.stg_hubspot__engagement_company_tmp _fivetran_synced 89. model.hubspot_source.stg_hubspot__engagement_company 89. model.hubspot_source.stg_hubspot__engagement_company _fivetran_synced 90. model.hubspot_source.stg_hubspot__engagement_company_tmp:f0->89. model.hubspot_source.stg_hubspot__engagement_company:f0
89. model.hubspot_source.stg_hubspot__engagement_company
  • Input Column: 90. model.hubspot_source.stg_hubspot__engagement_company_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output column
91. model.hubspot_source.stg_hubspot__engagement_contact

This SQL query creates a template structure for the 'model.hubspot_source.stg_hubspot__engagement_contact' model. It selects all columns from a temporary table and then defines a macro that casts null values to specific data types for three columns: _fivetran_synced, contact_id, and engagement_id. The final output combines these two CTEs, effectively creating a structure with the desired column types, potentially to be used as a base for further data manipulation or as a placeholder for actual data.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_contact_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS contact_id,
    CAST(NULL AS INT) AS engagement_id
  FROM base
)
SELECT
  *
FROM macro
%3 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact _fivetran_synced contact_id engagement_id engagement_type type_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp contact_id engagement_id engagement_type type_id _fivetran_synced 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f1 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f1->91. model.hubspot_source.stg_hubspot__engagement_contact:f2 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f2->91. model.hubspot_source.stg_hubspot__engagement_contact:f3 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f3->91. model.hubspot_source.stg_hubspot__engagement_contact:f4 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f4->91. model.hubspot_source.stg_hubspot__engagement_contact:f0
Name Type Comment
_fivetran_synced text Timestamp of when Fivetran synced a record.
contact_id bigint The ID of the related contact.
engagement_id bigint The ID of the related engagement.
engagement_type text None
type_id integer None
Column Lineage
%3 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp _fivetran_synced 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact _fivetran_synced 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[_fivetran_synced]
    • Cleaning The column is cast to TIMESTAMP data type in the macro CTE
    • Output Columns:
      • _fivetran_synced: It is directly mapped after casting
Column Lineage
%3 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp contact_id 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact contact_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements contact_ids 91. model.hubspot_source.stg_hubspot__engagement_contact:f0->27. model.hubspot.hubspot__engagements:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails contact_ids 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 33. model.hubspot.int_hubspot__engagement_metrics__by_contact 33. model.hubspot.int_hubspot__engagement_metrics__by_contact contact_id 27. model.hubspot.hubspot__engagements:f0->33. model.hubspot.int_hubspot__engagement_metrics__by_contact:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks contact_ids 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings contact_ids 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls contact_ids 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes contact_ids 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts contact_id 33. model.hubspot.int_hubspot__engagement_metrics__by_contact:f0->5. model.hubspot.hubspot__contacts:f0
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[contact_id]
    • Cleaning The column is cast to INT data type in the macro CTE
    • Output Columns:
      • contact_id: It is directly mapped after casting
27. model.hubspot.hubspot__engagements
  • Input Column: 91. model.hubspot_source.stg_hubspot__engagement_contact[contact_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Integration It's used in the GROUP BY clause to create the aggregated array
    • Output Columns:
      • contact_ids: The contact_id values are aggregated into the contact_ids array in the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation
    • Output Columns:
      • contact_ids: Directly copied from engagements.contact_ids to the output
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_ids: Directly copied to the output
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied from the engagements table to the output
    • Output Columns:
      • contact_ids: Directly copied from the engagements table
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the LEFT JOIN operation to combine data from the base and engagements tables
    • Output Columns:
      • contact_ids: Directly copied to the output
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation.
    • Output Columns:
      • contact_ids: Directly copied from the engagements table.
33. model.hubspot.int_hubspot__engagement_metrics__by_contact
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Integration This column is indirectly used through the join with the engagement_contacts table, which likely contains the individual contact IDs derived from this list.
    • Aggregation The contact IDs are used in the GROUP BY clause to aggregate engagement counts per contact.
    • Output Columns:
      • contact_id: The individual contact IDs from this list are mapped to the output 'contact_id' column.
5. model.hubspot.hubspot__contacts
  • Input Column: 33. model.hubspot.int_hubspot__engagement_metrics__by_contact[contact_id]
    • Integration This column is used as the key to join the engagement metrics with the main contact data in the LEFT JOIN operation.
    • Direct The column is directly copied to the output without transformation.
    • Output Columns:
      • contact_id: Directly copied to the output column with the same name.
Column Lineage
%3 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp engagement_id 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact engagement_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_id 91. model.hubspot_source.stg_hubspot__engagement_contact:f0->27. model.hubspot.hubspot__engagements:f0 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:header 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:header 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:header 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_id 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:header 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls engagement_id 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes engagement_id 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[engagement_id]
    • Cleaning The column is cast to INT data type in the macro CTE
    • Output Columns:
      • engagement_id: It is directly mapped after casting
27. model.hubspot.hubspot__engagements
  • Input Column: 91. model.hubspot_source.stg_hubspot__engagement_contact[engagement_id]
    • Integration This column is used as the key to join the aggregated contacts with the main engagements table
    • Aggregation It's used in the GROUP BY clause to create the aggregated array of contact_ids
    • Output Columns:
      • engagement_id: It's indirectly mapped to the engagement_id in the final output through the JOIN operation
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used to join the engagements table with the engagement_companies table
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used to join engagements with engagement_deals table
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables.
    • Direct Included in the final output.
    • Output Columns:
      • engagement_id: Directly copied to the output.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the engagements table with the base table
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join with the base table
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied after join
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied to the output
Column Lineage
%3 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp engagement_type 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact engagement_type 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[engagement_type]
    • Direct The column is directly selected from the base CTE without transformation
    • Output Columns:
      • engagement_type: It is directly copied
Column Lineage
%3 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp type_id 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact type_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[type_id]
    • Direct The column is directly selected from the base CTE without transformation
    • Output Columns:
      • type_id: It is directly copied
92. model.hubspot_source.stg_hubspot__engagement_contact_tmp

This SQL query selects all columns from the TEST.hubspot.engagement_contact table. The comment suggests that no columns were returned, possibly because the relation doesn't exist yet or all columns were excluded. The query is likely a placeholder or template for future use.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.engagement_contact
%3 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp contact_id engagement_id engagement_type type_id _fivetran_synced 139. source.hubspot_source.hubspot.engagement_contact 139. source.hubspot_source.hubspot.engagement_contact
Name Type Comment
contact_id bigint None
engagement_id bigint None
engagement_type text None
type_id integer None
_fivetran_synced text None
Column Lineage
%3 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp contact_id 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact contact_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements contact_ids 91. model.hubspot_source.stg_hubspot__engagement_contact:f0->27. model.hubspot.hubspot__engagements:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails contact_ids 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 33. model.hubspot.int_hubspot__engagement_metrics__by_contact 33. model.hubspot.int_hubspot__engagement_metrics__by_contact contact_id 27. model.hubspot.hubspot__engagements:f0->33. model.hubspot.int_hubspot__engagement_metrics__by_contact:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks contact_ids 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings contact_ids 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls contact_ids 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes contact_ids 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0 5. model.hubspot.hubspot__contacts 5. model.hubspot.hubspot__contacts contact_id 33. model.hubspot.int_hubspot__engagement_metrics__by_contact:f0->5. model.hubspot.hubspot__contacts:f0
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[contact_id]
    • Cleaning The column is cast to INT data type in the macro CTE
    • Output Columns:
      • contact_id: It is directly mapped after casting
27. model.hubspot.hubspot__engagements
  • Input Column: 91. model.hubspot_source.stg_hubspot__engagement_contact[contact_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Integration It's used in the GROUP BY clause to create the aggregated array
    • Output Columns:
      • contact_ids: The contact_id values are aggregated into the contact_ids array in the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation
    • Output Columns:
      • contact_ids: Directly copied from engagements.contact_ids to the output
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • contact_ids: Directly copied to the output
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied from the engagements table to the output
    • Output Columns:
      • contact_ids: Directly copied from the engagements table
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the LEFT JOIN operation to combine data from the base and engagements tables
    • Output Columns:
      • contact_ids: Directly copied to the output
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation.
    • Output Columns:
      • contact_ids: Directly copied from the engagements table.
33. model.hubspot.int_hubspot__engagement_metrics__by_contact
  • Input Column: 27. model.hubspot.hubspot__engagements[contact_ids]
    • Integration This column is indirectly used through the join with the engagement_contacts table, which likely contains the individual contact IDs derived from this list.
    • Aggregation The contact IDs are used in the GROUP BY clause to aggregate engagement counts per contact.
    • Output Columns:
      • contact_id: The individual contact IDs from this list are mapped to the output 'contact_id' column.
5. model.hubspot.hubspot__contacts
  • Input Column: 33. model.hubspot.int_hubspot__engagement_metrics__by_contact[contact_id]
    • Integration This column is used as the key to join the engagement metrics with the main contact data in the LEFT JOIN operation.
    • Direct The column is directly copied to the output without transformation.
    • Output Columns:
      • contact_id: Directly copied to the output column with the same name.
Column Lineage
%3 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp engagement_id 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact engagement_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_id 91. model.hubspot_source.stg_hubspot__engagement_contact:f0->27. model.hubspot.hubspot__engagements:f0 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:header 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:header 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:header 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_id 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:header 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls engagement_id 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes engagement_id 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[engagement_id]
    • Cleaning The column is cast to INT data type in the macro CTE
    • Output Columns:
      • engagement_id: It is directly mapped after casting
27. model.hubspot.hubspot__engagements
  • Input Column: 91. model.hubspot_source.stg_hubspot__engagement_contact[engagement_id]
    • Integration This column is used as the key to join the aggregated contacts with the main engagements table
    • Aggregation It's used in the GROUP BY clause to create the aggregated array of contact_ids
    • Output Columns:
      • engagement_id: It's indirectly mapped to the engagement_id in the final output through the JOIN operation
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used to join the engagements table with the engagement_companies table
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used to join engagements with engagement_deals table
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables.
    • Direct Included in the final output.
    • Output Columns:
      • engagement_id: Directly copied to the output.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the engagements table with the base table
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join with the base table
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied after join
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied to the output
Column Lineage
%3 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp engagement_type 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact engagement_type 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[engagement_type]
    • Direct The column is directly selected from the base CTE without transformation
    • Output Columns:
      • engagement_type: It is directly copied
Column Lineage
%3 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp type_id 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact type_id 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[type_id]
    • Direct The column is directly selected from the base CTE without transformation
    • Output Columns:
      • type_id: It is directly copied
Column Lineage
%3 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp _fivetran_synced 91. model.hubspot_source.stg_hubspot__engagement_contact 91. model.hubspot_source.stg_hubspot__engagement_contact _fivetran_synced 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp:f0->91. model.hubspot_source.stg_hubspot__engagement_contact:f0
91. model.hubspot_source.stg_hubspot__engagement_contact
  • Input Column: 92. model.hubspot_source.stg_hubspot__engagement_contact_tmp[_fivetran_synced]
    • Cleaning The column is cast to TIMESTAMP data type in the macro CTE
    • Output Columns:
      • _fivetran_synced: It is directly mapped after casting
93. model.hubspot_source.stg_hubspot__engagement_deal

This SQL query creates a base structure for the 'model.hubspot_source.stg_hubspot__engagement_deal' model. It selects all columns from a temporary table and then creates a macro that defines the structure of the final output with three specific columns (_fivetran_synced, deal_id, and engagement_id) cast to their respective data types. The query then selects all columns from this macro.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_deal_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS deal_id,
    CAST(NULL AS INT) AS engagement_id
  FROM base
)
SELECT
  *
FROM macro
%3 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal _fivetran_synced deal_id engagement_id engagement_type type_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp deal_id engagement_id _fivetran_synced 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f1 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f1->93. model.hubspot_source.stg_hubspot__engagement_deal:f2 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f2->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
Name Type Comment
_fivetran_synced text Timestamp of when Fivetran synced a record.
deal_id bigint The ID of the related contact.
engagement_id bigint The ID of the related engagement.
engagement_type text None
type_id integer None
Column Lineage
%3 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp _fivetran_synced 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal _fivetran_synced 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting to TIMESTAMP
Column Lineage
%3 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp deal_id 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal deal_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks deal_id 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->8. model.hubspot.hubspot__deals:f7 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements deal_ids 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f2 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails deal_ids 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks deal_ids 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings deal_ids 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls deal_ids 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes deal_ids 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly mapped after casting to INT
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Integration This column is used to join the engagements table with the engagement_deals table
    • Aggregation It's indirectly used for aggregation after joining with engagement_deals
    • Output Columns:
      • count_engagement_notes: Aggregated count of engagements where type is 'NOTE'
      • count_engagement_tasks: Aggregated count of engagements where type is 'TASK'
      • count_engagement_calls: Aggregated count of engagements where type is 'CALL'
      • count_engagement_meetings: Aggregated count of engagements where type is 'MEETING'
      • count_engagement_emails: Aggregated count of engagements where type is 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count of engagements where type is 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count of engagements where type is 'FORWARDED_EMAIL'
27. model.hubspot.hubspot__engagements
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[deal_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • deal_ids: The deal_id is aggregated into the deal_ids array in the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation
    • Output Columns:
      • deal_ids: Directly copied from engagements.deal_ids to the output
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • deal_ids: Directly copied to the output
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied from the engagements table to the output
    • Output Columns:
      • deal_ids: Directly copied from the engagements table
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the LEFT JOIN operation to combine data from the base and engagements tables
    • Output Columns:
      • deal_ids: Directly copied to the output
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation.
    • Output Columns:
      • deal_ids: Directly copied from the engagements table.
Column Lineage
%3 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp engagement_id 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal engagement_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->8. model.hubspot.hubspot__deals:header 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_id 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:header 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:header 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:header 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_id 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:header 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls engagement_id 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes engagement_id 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • engagement_id: Directly mapped after casting to INT
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used to join engagements with engagement_deals table
27. model.hubspot.hubspot__engagements
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[engagement_id]
    • Integration This column is used as the key to join with other tables
    • Aggregation This column is used as the grouping key for aggregating deal_ids
    • Output Columns:
      • engagement_id: The engagement_id is directly copied to the output engagement_id column
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used to join the engagements table with the engagement_companies table
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables.
    • Direct Included in the final output.
    • Output Columns:
      • engagement_id: Directly copied to the output.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the engagements table with the base table
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join with the base table
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied after join
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied to the output
Column Lineage
%3 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal engagement_type 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->8. model.hubspot.hubspot__deals:f5 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->8. model.hubspot.hubspot__deals:f6 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->8. model.hubspot.hubspot__deals:f0 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->8. model.hubspot.hubspot__deals:f4 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->8. model.hubspot.hubspot__deals:f1 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->8. model.hubspot.hubspot__deals:f3 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->8. model.hubspot.hubspot__deals:f2
8. model.hubspot.hubspot__deals
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[engagement_type]
    • Featurization Used to create separate count features for different engagement types
    • Aggregation Aggregated to create count features
    • Output Columns:
      • count_engagement_notes: Aggregated count when engagement_type = 'NOTE'
      • count_engagement_tasks: Aggregated count when engagement_type = 'TASK'
      • count_engagement_calls: Aggregated count when engagement_type = 'CALL'
      • count_engagement_meetings: Aggregated count when engagement_type = 'MEETING'
      • count_engagement_emails: Aggregated count when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count when engagement_type = 'FORWARDED_EMAIL'
94. model.hubspot_source.stg_hubspot__engagement_deal_tmp

This SQL query selects all columns from the engagement_deal table in the TEST.hubspot schema. The comment suggests that this is a placeholder query, possibly used during dbt compilation, and that the actual table or columns might not exist yet.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.engagement_deal
%3 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp deal_id engagement_id engagement_type type_id _fivetran_synced 140. source.hubspot_source.hubspot.engagement_deal 140. source.hubspot_source.hubspot.engagement_deal
Name Type Comment
deal_id bigint None
engagement_id bigint None
engagement_type text None
type_id integer None
_fivetran_synced text None
Column Lineage
%3 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp deal_id 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal deal_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks deal_id 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->8. model.hubspot.hubspot__deals:f7 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements deal_ids 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f2 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails deal_ids 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks deal_ids 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings deal_ids 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls deal_ids 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes deal_ids 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[deal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • deal_id: Directly mapped after casting to INT
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Integration This column is used to join the engagements table with the engagement_deals table
    • Aggregation It's indirectly used for aggregation after joining with engagement_deals
    • Output Columns:
      • count_engagement_notes: Aggregated count of engagements where type is 'NOTE'
      • count_engagement_tasks: Aggregated count of engagements where type is 'TASK'
      • count_engagement_calls: Aggregated count of engagements where type is 'CALL'
      • count_engagement_meetings: Aggregated count of engagements where type is 'MEETING'
      • count_engagement_emails: Aggregated count of engagements where type is 'EMAIL'
      • count_engagement_incoming_emails: Aggregated count of engagements where type is 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Aggregated count of engagements where type is 'FORWARDED_EMAIL'
27. model.hubspot.hubspot__engagements
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[deal_id]
    • Aggregation This column is aggregated into an array for each engagement_id
    • Output Columns:
      • deal_ids: The deal_id is aggregated into the deal_ids array in the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation
    • Output Columns:
      • deal_ids: Directly copied from engagements.deal_ids to the output
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • deal_ids: Directly copied to the output
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied from the engagements table to the output
    • Output Columns:
      • deal_ids: Directly copied from the engagements table
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied without any transformation
    • Integration The column is used in the LEFT JOIN operation to combine data from the base and engagements tables
    • Output Columns:
      • deal_ids: Directly copied to the output
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[deal_ids]
    • Direct The column is directly copied from the engagements table to the output without any transformation.
    • Output Columns:
      • deal_ids: Directly copied from the engagements table.
Column Lineage
%3 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp engagement_id 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal engagement_id 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->8. model.hubspot.hubspot__deals:header 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_id 93. model.hubspot_source.stg_hubspot__engagement_deal:f0->27. model.hubspot.hubspot__engagements:f0 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:header 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:header 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:header 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_id 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:header 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls engagement_id 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes engagement_id 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • engagement_id: Directly mapped after casting to INT
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used to join engagements with engagement_deals table
27. model.hubspot.hubspot__engagements
  • Input Column: 93. model.hubspot_source.stg_hubspot__engagement_deal[engagement_id]
    • Integration This column is used as the key to join with other tables
    • Aggregation This column is used as the grouping key for aggregating deal_ids
    • Output Columns:
      • engagement_id: The engagement_id is directly copied to the output engagement_id column
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used to join the engagements table with the engagement_companies table
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables.
    • Direct Included in the final output.
    • Output Columns:
      • engagement_id: Directly copied to the output.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the engagements table with the base table
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join with the base table
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied after join
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied to the output
Column Lineage
%3 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp _fivetran_synced 93. model.hubspot_source.stg_hubspot__engagement_deal 93. model.hubspot_source.stg_hubspot__engagement_deal _fivetran_synced 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp:f0->93. model.hubspot_source.stg_hubspot__engagement_deal:f0
93. model.hubspot_source.stg_hubspot__engagement_deal
  • Input Column: 94. model.hubspot_source.stg_hubspot__engagement_deal_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting to TIMESTAMP
95. model.hubspot_source.stg_hubspot__engagement_email

This SQL query creates a temporary structure with null values for specified columns, casting them to appropriate data types. It appears to be setting up a schema or template for the 'stg_hubspot__engagement_email' model, potentially for testing or as a placeholder for future data.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_email_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
    CAST(NULL AS TEXT) AS engagement_type,
    CAST(NULL AS INT) AS engagement_id,
    CAST(NULL AS TIMESTAMP) AS created_timestamp,
    CAST(NULL AS TIMESTAMP) AS occurred_timestamp,
    CAST(NULL AS INT) AS owner_id,
    CAST(NULL AS INT) AS team_id
  FROM base
)
SELECT
  *
FROM macro
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email _fivetran_synced _fivetran_deleted engagement_id engagement_type created_timestamp occurred_timestamp owner_id team_id all_owner_ids all_team_ids email_subject email_text lastmodifieddate modified_by 96. model.hubspot_source.stg_hubspot__engagement_email_tmp 96. model.hubspot_source.stg_hubspot__engagement_email_tmp engagement_id _fivetran_deleted _fivetran_synced 96. model.hubspot_source.stg_hubspot__engagement_email_tmp:f0->95. model.hubspot_source.stg_hubspot__engagement_email:f2 96. model.hubspot_source.stg_hubspot__engagement_email_tmp:f1->95. model.hubspot_source.stg_hubspot__engagement_email:f1 96. model.hubspot_source.stg_hubspot__engagement_email_tmp:f2->95. model.hubspot_source.stg_hubspot__engagement_email:f0
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
_fivetran_deleted boolean Boolean to mark rows that were deleted in the source database.
engagement_id bigint The ID of the engagement.
engagement_type text The type of the engagement.
created_timestamp timestamp without time zone This field marks the email's time of creation and determines where the email sits on the record timeline. You can use either a Unix timestamp in milliseconds or UTC format. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version. For the pre HubSpot v3 versions, this value may be found within the parent `engagement` table.
occurred_timestamp timestamp without time zone This field marks the email's time of occurrence and determines where the email sits on the record timeline. You can use either a Unix timestamp in milliseconds or UTC format. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version. For the pre HubSpot v3 versions, this value may be found within the parent `engagement` table.
owner_id integer The ID of the owner associated with the email. This field determines the user listed as the email creator on the record timeline. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version. For the pre HubSpot v3 versions, this value may be found within the parent `engagement` table.
team_id integer The ID of the team associated with the email. This field determines the team listed as the email creator on the record timeline. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version.
all_owner_ids integer None
all_team_ids integer None
email_subject text None
email_text text None
lastmodifieddate text None
modified_by integer None
Column Lineage
%3 96. model.hubspot_source.stg_hubspot__engagement_email_tmp 96. model.hubspot_source.stg_hubspot__engagement_email_tmp _fivetran_synced 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email _fivetran_synced 96. model.hubspot_source.stg_hubspot__engagement_email_tmp:f0->95. model.hubspot_source.stg_hubspot__engagement_email:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails _fivetran_synced 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
95. model.hubspot_source.stg_hubspot__engagement_email
  • Input Column: 96. model.hubspot_source.stg_hubspot__engagement_email_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly mapped
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 96. model.hubspot_source.stg_hubspot__engagement_email_tmp 96. model.hubspot_source.stg_hubspot__engagement_email_tmp _fivetran_deleted 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email _fivetran_deleted 96. model.hubspot_source.stg_hubspot__engagement_email_tmp:f0->95. model.hubspot_source.stg_hubspot__engagement_email:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails is_active 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
95. model.hubspot_source.stg_hubspot__engagement_email
  • Input Column: 96. model.hubspot_source.stg_hubspot__engagement_email_tmp[_fivetran_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_deleted: Directly mapped
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[_fivetran_deleted]
    • Cleaning This column is used in a COALESCE function to determine the 'is_active' status
    • Output Columns:
      • is_active: Used in COALESCE(engagements.is_active, NOT base._fivetran_deleted)
Column Lineage
%3 96. model.hubspot_source.stg_hubspot__engagement_email_tmp 96. model.hubspot_source.stg_hubspot__engagement_email_tmp engagement_id 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email engagement_id 96. model.hubspot_source.stg_hubspot__engagement_email_tmp:f0->95. model.hubspot_source.stg_hubspot__engagement_email:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails engagement_id 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
95. model.hubspot_source.stg_hubspot__engagement_email
  • Input Column: 96. model.hubspot_source.stg_hubspot__engagement_email_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • engagement_id: Directly mapped
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[engagement_id]
    • Integration This column is used as the key to join the base table with the engagements table
    • Output Columns:
      • engagement_id: Directly copied
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email engagement_type 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails engagement_type 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email created_timestamp 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails created_timestamp 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[created_timestamp]
    • Cleaning This column is used in a COALESCE function to determine the final created_timestamp
    • Output Columns:
      • created_timestamp: Used in COALESCE(engagements.created_timestamp, base.created_timestamp)
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email occurred_timestamp 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails occurred_timestamp 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[occurred_timestamp]
    • Cleaning This column is used in a COALESCE function to determine the final occurred_timestamp
    • Output Columns:
      • occurred_timestamp: Used in COALESCE(engagements.occurred_timestamp, base.occurred_timestamp)
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email owner_id 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails owner_id 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[owner_id]
    • Cleaning This column is used in a COALESCE function to determine the final owner_id
    • Output Columns:
      • owner_id: Used in COALESCE(engagements.owner_id, base.owner_id)
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email team_id 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails team_id 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[team_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • team_id: Directly copied
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email all_owner_ids 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails all_owner_ids 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[all_owner_ids]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • all_owner_ids: Directly copied
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email all_team_ids 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails all_team_ids 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[all_team_ids]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • all_team_ids: Directly copied
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email email_subject 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails email_subject 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[email_subject]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_subject: Directly copied to the output
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email email_text 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails email_text 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[email_text]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • email_text: Directly copied to the output
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email lastmodifieddate 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails lastmodifieddate 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[lastmodifieddate]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • lastmodifieddate: Directly copied to the output
Column Lineage
%3 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email modified_by 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails modified_by 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[modified_by]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • modified_by: Directly copied to the output
96. model.hubspot_source.stg_hubspot__engagement_email_tmp

This SQL query selects all columns from the 'engagement_email' table in the 'hubspot' schema of the 'TEST' database. The query is designed as a staging step, likely to be used as an intermediate table in a larger data transformation process. The comment suggests that this query might be a placeholder or template, possibly used during compilation or linting processes.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.engagement_email
%3 96. model.hubspot_source.stg_hubspot__engagement_email_tmp 96. model.hubspot_source.stg_hubspot__engagement_email_tmp engagement_id _fivetran_deleted _fivetran_synced property_hs_all_owner_ids property_hs_all_team_ids property_hs_createdate property_hs_email_subject property_hs_email_text property_hs_lastmodifieddate property_hs_modified_by property_hs_timestamp property_hubspot_owner_id property_hubspot_team_id type 141. source.hubspot_source.hubspot.engagement_email 141. source.hubspot_source.hubspot.engagement_email
Name Type Comment
engagement_id bigint None
_fivetran_deleted boolean None
_fivetran_synced timestamp without time zone None
property_hs_all_owner_ids integer None
property_hs_all_team_ids integer None
property_hs_createdate timestamp without time zone None
property_hs_email_subject text None
property_hs_email_text text None
property_hs_lastmodifieddate text None
property_hs_modified_by integer None
property_hs_timestamp timestamp without time zone None
property_hubspot_owner_id integer None
property_hubspot_team_id integer None
type text None
Column Lineage
%3 96. model.hubspot_source.stg_hubspot__engagement_email_tmp 96. model.hubspot_source.stg_hubspot__engagement_email_tmp engagement_id 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email engagement_id 96. model.hubspot_source.stg_hubspot__engagement_email_tmp:f0->95. model.hubspot_source.stg_hubspot__engagement_email:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails engagement_id 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
95. model.hubspot_source.stg_hubspot__engagement_email
  • Input Column: 96. model.hubspot_source.stg_hubspot__engagement_email_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • engagement_id: Directly mapped
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[engagement_id]
    • Integration This column is used as the key to join the base table with the engagements table
    • Output Columns:
      • engagement_id: Directly copied
Column Lineage
%3 96. model.hubspot_source.stg_hubspot__engagement_email_tmp 96. model.hubspot_source.stg_hubspot__engagement_email_tmp _fivetran_deleted 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email _fivetran_deleted 96. model.hubspot_source.stg_hubspot__engagement_email_tmp:f0->95. model.hubspot_source.stg_hubspot__engagement_email:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails is_active 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
95. model.hubspot_source.stg_hubspot__engagement_email
  • Input Column: 96. model.hubspot_source.stg_hubspot__engagement_email_tmp[_fivetran_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_deleted: Directly mapped
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[_fivetran_deleted]
    • Cleaning This column is used in a COALESCE function to determine the 'is_active' status
    • Output Columns:
      • is_active: Used in COALESCE(engagements.is_active, NOT base._fivetran_deleted)
Column Lineage
%3 96. model.hubspot_source.stg_hubspot__engagement_email_tmp 96. model.hubspot_source.stg_hubspot__engagement_email_tmp _fivetran_synced 95. model.hubspot_source.stg_hubspot__engagement_email 95. model.hubspot_source.stg_hubspot__engagement_email _fivetran_synced 96. model.hubspot_source.stg_hubspot__engagement_email_tmp:f0->95. model.hubspot_source.stg_hubspot__engagement_email:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails _fivetran_synced 95. model.hubspot_source.stg_hubspot__engagement_email:f0->23. model.hubspot.hubspot__engagement_emails:f0
95. model.hubspot_source.stg_hubspot__engagement_email
  • Input Column: 96. model.hubspot_source.stg_hubspot__engagement_email_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly mapped
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 95. model.hubspot_source.stg_hubspot__engagement_email[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
97. model.hubspot_source.stg_hubspot__engagement_meeting

This SQL query creates a CTE named 'base' that selects all columns from a temporary staging table. It then creates another CTE named 'macro' that defines a structure with null values for specific columns, casting them to appropriate data types. The final SELECT statement returns all columns from the 'macro' CTE. This query appears to be setting up a standardized structure for the 'stg_hubspot__engagement_meeting' model, possibly for further processing or as a template.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_meeting_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
    CAST(NULL AS TEXT) AS engagement_type,
    CAST(NULL AS INT) AS engagement_id,
    CAST(NULL AS TIMESTAMP) AS created_timestamp,
    CAST(NULL AS TIMESTAMP) AS occurred_timestamp,
    CAST(NULL AS INT) AS owner_id,
    CAST(NULL AS INT) AS team_id
  FROM base
)
SELECT
  *
FROM macro
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting _fivetran_synced _fivetran_deleted engagement_id engagement_type created_timestamp occurred_timestamp owner_id team_id created_from_link_id end_time pre_meeting_prospect_reminders source source_id start_time web_conference_meeting_id meeting_outcome body external_url title 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp engagement_id _fivetran_synced body external_url title 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f0->97. model.hubspot_source.stg_hubspot__engagement_meeting:f2 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f1->97. model.hubspot_source.stg_hubspot__engagement_meeting:f0 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f2->97. model.hubspot_source.stg_hubspot__engagement_meeting:f16 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f3->97. model.hubspot_source.stg_hubspot__engagement_meeting:f17 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f4->97. model.hubspot_source.stg_hubspot__engagement_meeting:f18
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
_fivetran_deleted boolean Boolean to mark rows that were deleted in the source database.
engagement_id bigint The ID of the engagement.
engagement_type text The type of the engagement.
created_timestamp timestamp without time zone This field marks the meeting's time of creation and determines where the meeting sits on the record timeline. You can use either a Unix timestamp in milliseconds or UTC format. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version. For the pre HubSpot v3 versions, this value may be found within the parent `engagement` table.
occurred_timestamp timestamp without time zone This field marks the meeting's time of occurrence and determines where the meeting sits on the record timeline. You can use either a Unix timestamp in milliseconds or UTC format. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version. For the pre HubSpot v3 versions, this value may be found within the parent `engagement` table.
owner_id integer The ID of the owner associated with the meeting. This field determines the user listed as the meeting creator on the record timeline. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version. For the pre HubSpot v3 versions, this value may be found within the parent `engagement` table.
team_id integer The ID of the team associated with the meeting. This field determines the team listed as the meeting creator on the record timeline. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version.
created_from_link_id integer None
end_time text None
pre_meeting_prospect_reminders text None
source text None
source_id text None
start_time text None
web_conference_meeting_id integer None
meeting_outcome integer None
body text None
external_url text None
title text None
Column Lineage
%3 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp _fivetran_synced 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting _fivetran_synced 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f0->97. model.hubspot_source.stg_hubspot__engagement_meeting:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings _fivetran_synced 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
97. model.hubspot_source.stg_hubspot__engagement_meeting
  • Input Column: 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TIMESTAMP in the macro CTE
    • Output Columns:
      • _fivetran_synced: Directly mapped and cast as TIMESTAMP
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[_fivetran_synced]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting _fivetran_deleted 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings is_active 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[_fivetran_deleted]
    • Cleaning This column is used to determine the is_active status
    • Output Columns:
      • is_active: Used in COALESCE function to determine active status
Column Lineage
%3 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp engagement_id 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting engagement_id 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f0->97. model.hubspot_source.stg_hubspot__engagement_meeting:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings engagement_id 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
97. model.hubspot_source.stg_hubspot__engagement_meeting
  • Input Column: 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT in the macro CTE
    • Output Columns:
      • engagement_id: Directly mapped and cast as INT
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[engagement_id]
    • Integration This column is used as the key to join with the engagements table
    • Output Columns:
      • engagement_id: Directly copied
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting engagement_type 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings engagement_type 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[engagement_type]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • engagement_type: Directly copied
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting created_timestamp 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings created_timestamp 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[created_timestamp]
    • Cleaning This column is used in a COALESCE function to determine the final created_timestamp
    • Output Columns:
      • created_timestamp: Used in COALESCE function
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting occurred_timestamp 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings occurred_timestamp 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[occurred_timestamp]
    • Cleaning This column is used in a COALESCE function to determine the final occurred_timestamp
    • Output Columns:
      • occurred_timestamp: Used in COALESCE function
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting owner_id 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings owner_id 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[owner_id]
    • Cleaning This column is used in a COALESCE function to determine the final owner_id
    • Output Columns:
      • owner_id: Used in COALESCE function
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting team_id 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings team_id 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[team_id]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • team_id: Directly copied
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting end_time 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings end_time 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[end_time]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • end_time: Directly copied
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting pre_meeting_prospect_reminders 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings pre_meeting_prospect_reminders 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[pre_meeting_prospect_reminders]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • pre_meeting_prospect_reminders: Directly copied to output
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting source 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings source 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[source]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • source: Directly copied to output
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting source_id 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings source_id 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[source_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • source_id: Directly copied to output
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting start_time 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings start_time 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[start_time]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • start_time: Directly copied to output
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting web_conference_meeting_id 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings web_conference_meeting_id 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[web_conference_meeting_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • web_conference_meeting_id: Directly copied to output
Column Lineage
%3 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting meeting_outcome 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings meeting_outcome 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[meeting_outcome]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • meeting_outcome: Directly copied to output
Column Lineage
%3 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp body 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting body 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f0->97. model.hubspot_source.stg_hubspot__engagement_meeting:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings body 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
97. model.hubspot_source.stg_hubspot__engagement_meeting
  • Input Column: 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp[body]
    • Direct The column is directly selected from the base CTE without any transformation
    • Output Columns:
      • body: It is directly mapped to the 'body' output column
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[body]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • body: Directly copied to output
Column Lineage
%3 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp external_url 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting external_url 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f0->97. model.hubspot_source.stg_hubspot__engagement_meeting:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings external_url 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
97. model.hubspot_source.stg_hubspot__engagement_meeting
  • Input Column: 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp[external_url]
    • Direct The column is directly selected from the base CTE without any transformation
    • Output Columns:
      • external_url: It is directly mapped to the 'external_url' output column
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[external_url]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • external_url: Directly copied to output
Column Lineage
%3 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp title 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting title 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f0->97. model.hubspot_source.stg_hubspot__engagement_meeting:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings title 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
97. model.hubspot_source.stg_hubspot__engagement_meeting
  • Input Column: 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp[title]
    • Direct The column is directly selected from the base CTE without any transformation
    • Output Columns:
      • title: It is directly mapped to the 'title' output column
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[title]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • title: Directly copied to output
98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp

This query selects all columns from the 'engagement_meeting' table in the 'hubspot' schema of the 'TEST' database. It appears to be a staging query that retrieves raw data without any transformations or filtering.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.engagement_meeting
%3 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp engagement_id _fivetran_synced created_from_link_id end_time pre_meeting_prospect_reminders source source_id start_time web_conference_meeting_id meeting_outcome body external_url title 142. source.hubspot_source.hubspot.engagement_meeting 142. source.hubspot_source.hubspot.engagement_meeting
Name Type Comment
engagement_id bigint None
_fivetran_synced timestamp without time zone None
created_from_link_id integer None
end_time text None
pre_meeting_prospect_reminders text None
source text None
source_id text None
start_time text None
web_conference_meeting_id integer None
meeting_outcome integer None
body text None
external_url text None
title text None
Column Lineage
%3 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp engagement_id 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting engagement_id 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f0->97. model.hubspot_source.stg_hubspot__engagement_meeting:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings engagement_id 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
97. model.hubspot_source.stg_hubspot__engagement_meeting
  • Input Column: 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as INT in the macro CTE
    • Output Columns:
      • engagement_id: Directly mapped and cast as INT
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[engagement_id]
    • Integration This column is used as the key to join with the engagements table
    • Output Columns:
      • engagement_id: Directly copied
Column Lineage
%3 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp _fivetran_synced 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting _fivetran_synced 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f0->97. model.hubspot_source.stg_hubspot__engagement_meeting:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings _fivetran_synced 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
97. model.hubspot_source.stg_hubspot__engagement_meeting
  • Input Column: 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TIMESTAMP in the macro CTE
    • Output Columns:
      • _fivetran_synced: Directly mapped and cast as TIMESTAMP
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[_fivetran_synced]
    • Direct This column is directly copied to the output without transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp body 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting body 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f0->97. model.hubspot_source.stg_hubspot__engagement_meeting:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings body 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
97. model.hubspot_source.stg_hubspot__engagement_meeting
  • Input Column: 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp[body]
    • Direct The column is directly selected from the base CTE without any transformation
    • Output Columns:
      • body: It is directly mapped to the 'body' output column
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[body]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • body: Directly copied to output
Column Lineage
%3 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp external_url 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting external_url 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f0->97. model.hubspot_source.stg_hubspot__engagement_meeting:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings external_url 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
97. model.hubspot_source.stg_hubspot__engagement_meeting
  • Input Column: 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp[external_url]
    • Direct The column is directly selected from the base CTE without any transformation
    • Output Columns:
      • external_url: It is directly mapped to the 'external_url' output column
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[external_url]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • external_url: Directly copied to output
Column Lineage
%3 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp title 97. model.hubspot_source.stg_hubspot__engagement_meeting 97. model.hubspot_source.stg_hubspot__engagement_meeting title 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp:f0->97. model.hubspot_source.stg_hubspot__engagement_meeting:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings title 97. model.hubspot_source.stg_hubspot__engagement_meeting:f0->24. model.hubspot.hubspot__engagement_meetings:f0
97. model.hubspot_source.stg_hubspot__engagement_meeting
  • Input Column: 98. model.hubspot_source.stg_hubspot__engagement_meeting_tmp[title]
    • Direct The column is directly selected from the base CTE without any transformation
    • Output Columns:
      • title: It is directly mapped to the 'title' output column
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 97. model.hubspot_source.stg_hubspot__engagement_meeting[title]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • title: Directly copied to output
99. model.hubspot_source.stg_hubspot__engagement_note

This SQL query creates a template structure for the 'stg_hubspot__engagement_note' model. It selects all columns from a temporary table and then defines a set of columns with specific data types but null values. The purpose seems to be to establish a consistent schema for the engagement note data, possibly for further processing or as a placeholder for actual data to be inserted later.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_note_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
    CAST(NULL AS TEXT) AS note,
    CAST(NULL AS TEXT) AS engagement_type,
    CAST(NULL AS INT) AS engagement_id,
    CAST(NULL AS TIMESTAMP) AS created_timestamp,
    CAST(NULL AS TIMESTAMP) AS occurred_timestamp,
    CAST(NULL AS INT) AS owner_id,
    CAST(NULL AS INT) AS team_id
  FROM base
)
SELECT
  *
FROM macro
%3 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note _fivetran_synced _fivetran_deleted engagement_id engagement_type note created_timestamp occurred_timestamp owner_id team_id body_preview lastmodifieddate note_body 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp engagement_id _fivetran_deleted _fivetran_synced property_hs_createdate property_hs_note_body property_hs_timestamp property_hubspot_owner_id property_hubspot_team_id 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f2 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f1->99. model.hubspot_source.stg_hubspot__engagement_note:f1 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f2->99. model.hubspot_source.stg_hubspot__engagement_note:f0 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f3->99. model.hubspot_source.stg_hubspot__engagement_note:f5 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f4->99. model.hubspot_source.stg_hubspot__engagement_note:f4 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f5->99. model.hubspot_source.stg_hubspot__engagement_note:f6 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f6->99. model.hubspot_source.stg_hubspot__engagement_note:f7 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f7->99. model.hubspot_source.stg_hubspot__engagement_note:f8
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
_fivetran_deleted boolean Boolean to mark rows that were deleted in the source database.
engagement_id bigint The ID of the engagement.
engagement_type text The type of the engagement.
note text The body of the note. The body has a limit of 65536 characters.
created_timestamp timestamp without time zone This field marks the note's time of creation and determines where the note sits on the record timeline. You can use either a Unix timestamp in milliseconds or UTC format. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version. For the pre HubSpot v3 versions, this value may be found within the parent `engagement` table.
occurred_timestamp timestamp without time zone This field marks the note's time of occurrence and determines where the note sits on the record timeline. You can use either a Unix timestamp in milliseconds or UTC format. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version. For the pre HubSpot v3 versions, this value may be found within the parent `engagement` table.
owner_id integer The ID of the owner associated with the note. This field determines the user listed as the note creator on the record timeline. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version. For the pre HubSpot v3 versions, this value may be found within the parent `engagement` table.
team_id integer The ID of the team associated with the note. This field determines the team listed as the note creator on the record timeline. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version.
body_preview text None
lastmodifieddate text None
note_body text None
Column Lineage
%3 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp _fivetran_synced 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note _fivetran_synced 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes _fivetran_synced 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly mapped
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp _fivetran_deleted 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note _fivetran_deleted 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes is_active 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[_fivetran_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_deleted: Directly mapped
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[_fivetran_deleted]
    • Other Used in COALESCE function to determine is_active status
    • Output Columns:
      • is_active: Used in COALESCE(engagements.is_active, NOT base._fivetran_deleted)
Column Lineage
%3 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp engagement_id 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note engagement_id 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes engagement_id 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • engagement_id: Directly mapped
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[engagement_id]
    • Integration Used as the key to join the base table with the engagements table
    • Output Columns:
      • engagement_id: Directly copied
Column Lineage
%3 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note engagement_type 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes engagement_type 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied
Column Lineage
%3 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp property_hs_note_body 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note note 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes note 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[property_hs_note_body]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • note: Directly mapped
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[note]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • note: Directly copied
Column Lineage
%3 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp property_hs_createdate 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note created_timestamp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes created_timestamp 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[property_hs_createdate]
    • Cleaning The column is likely cleaned by casting to TIMESTAMP
    • Output Columns:
      • created_timestamp: Mapped after casting to TIMESTAMP
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[created_timestamp]
    • Other Used in COALESCE function to determine final created_timestamp
    • Output Columns:
      • created_timestamp: COALESCE(engagements.created_timestamp, base.created_timestamp)
Column Lineage
%3 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp property_hs_timestamp 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note occurred_timestamp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes occurred_timestamp 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[property_hs_timestamp]
    • Cleaning The column is likely cleaned by casting to TIMESTAMP
    • Output Columns:
      • occurred_timestamp: Mapped after casting to TIMESTAMP
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[occurred_timestamp]
    • Other Used in COALESCE function to determine final occurred_timestamp
    • Output Columns:
      • occurred_timestamp: COALESCE(engagements.occurred_timestamp, base.occurred_timestamp)
Column Lineage
%3 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp property_hubspot_owner_id 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note owner_id 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes owner_id 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[property_hubspot_owner_id]
    • Cleaning The column is likely cleaned by casting to INT
    • Output Columns:
      • owner_id: Mapped after casting to INT
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[owner_id]
    • Other Used in COALESCE function to determine final owner_id
    • Output Columns:
      • owner_id: COALESCE(engagements.owner_id, base.owner_id)
Column Lineage
%3 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp property_hubspot_team_id 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note team_id 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes team_id 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[property_hubspot_team_id]
    • Cleaning The column is likely cleaned by casting to INT
    • Output Columns:
      • team_id: Mapped after casting to INT
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[team_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • team_id: Directly copied
Column Lineage
%3 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note body_preview 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes body_preview 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[body_preview]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • body_preview: Directly copied
Column Lineage
%3 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note note_body 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes note 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[note_body]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • note: The note_body is directly mapped to the 'note' column in the output
100. model.hubspot_source.stg_hubspot__engagement_note_tmp

This SQL query selects all columns from the 'engagement_note' table in the 'hubspot' schema of the 'TEST' database. The query is designed as a staging step, likely to prepare data for further transformation or analysis in a data modeling process.

Integration
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.engagement_note
%3 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp engagement_id _fivetran_deleted _fivetran_synced property_hs_body_preview property_hs_createdate property_hs_lastmodifieddate property_hs_note_body property_hs_timestamp property_hubspot_owner_id property_hubspot_team_id type 143. source.hubspot_source.hubspot.engagement_note 143. source.hubspot_source.hubspot.engagement_note
Name Type Comment
engagement_id bigint None
_fivetran_deleted boolean None
_fivetran_synced timestamp without time zone None
property_hs_body_preview text None
property_hs_createdate timestamp without time zone None
property_hs_lastmodifieddate text None
property_hs_note_body text None
property_hs_timestamp timestamp without time zone None
property_hubspot_owner_id integer None
property_hubspot_team_id integer None
type text None
Column Lineage
%3 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp engagement_id 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note engagement_id 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes engagement_id 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[engagement_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • engagement_id: Directly mapped
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[engagement_id]
    • Integration Used as the key to join the base table with the engagements table
    • Output Columns:
      • engagement_id: Directly copied
Column Lineage
%3 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp _fivetran_deleted 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note _fivetran_deleted 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes is_active 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[_fivetran_deleted]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_deleted: Directly mapped
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[_fivetran_deleted]
    • Other Used in COALESCE function to determine is_active status
    • Output Columns:
      • is_active: Used in COALESCE(engagements.is_active, NOT base._fivetran_deleted)
Column Lineage
%3 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp _fivetran_synced 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note _fivetran_synced 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes _fivetran_synced 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly mapped
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp property_hs_createdate 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note created_timestamp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes created_timestamp 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[property_hs_createdate]
    • Cleaning The column is likely cleaned by casting to TIMESTAMP
    • Output Columns:
      • created_timestamp: Mapped after casting to TIMESTAMP
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[created_timestamp]
    • Other Used in COALESCE function to determine final created_timestamp
    • Output Columns:
      • created_timestamp: COALESCE(engagements.created_timestamp, base.created_timestamp)
Column Lineage
%3 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp property_hs_note_body 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note note 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes note 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[property_hs_note_body]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • note: Directly mapped
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[note]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • note: Directly copied
Column Lineage
%3 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp property_hs_timestamp 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note occurred_timestamp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes occurred_timestamp 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[property_hs_timestamp]
    • Cleaning The column is likely cleaned by casting to TIMESTAMP
    • Output Columns:
      • occurred_timestamp: Mapped after casting to TIMESTAMP
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[occurred_timestamp]
    • Other Used in COALESCE function to determine final occurred_timestamp
    • Output Columns:
      • occurred_timestamp: COALESCE(engagements.occurred_timestamp, base.occurred_timestamp)
Column Lineage
%3 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp property_hubspot_owner_id 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note owner_id 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes owner_id 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[property_hubspot_owner_id]
    • Cleaning The column is likely cleaned by casting to INT
    • Output Columns:
      • owner_id: Mapped after casting to INT
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[owner_id]
    • Other Used in COALESCE function to determine final owner_id
    • Output Columns:
      • owner_id: COALESCE(engagements.owner_id, base.owner_id)
Column Lineage
%3 100. model.hubspot_source.stg_hubspot__engagement_note_tmp 100. model.hubspot_source.stg_hubspot__engagement_note_tmp property_hubspot_team_id 99. model.hubspot_source.stg_hubspot__engagement_note 99. model.hubspot_source.stg_hubspot__engagement_note team_id 100. model.hubspot_source.stg_hubspot__engagement_note_tmp:f0->99. model.hubspot_source.stg_hubspot__engagement_note:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes team_id 99. model.hubspot_source.stg_hubspot__engagement_note:f0->25. model.hubspot.hubspot__engagement_notes:f0
99. model.hubspot_source.stg_hubspot__engagement_note
  • Input Column: 100. model.hubspot_source.stg_hubspot__engagement_note_tmp[property_hubspot_team_id]
    • Cleaning The column is likely cleaned by casting to INT
    • Output Columns:
      • team_id: Mapped after casting to INT
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 99. model.hubspot_source.stg_hubspot__engagement_note[team_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • team_id: Directly copied
101. model.hubspot_source.stg_hubspot__engagement_task

This SQL query creates a staging table for Hubspot engagement tasks. It selects all columns from a temporary table and then casts specific columns to defined data types, including setting some to NULL. This appears to be a data type standardization step in an ETL process.

Cleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__engagement_task_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS BOOLEAN) AS _fivetran_deleted,
    CAST(NULL AS INT) AS engagement_id,
    CAST(NULL AS TEXT) AS engagement_type,
    CAST(NULL AS TIMESTAMP) AS created_timestamp,
    CAST(NULL AS TIMESTAMP) AS occurred_timestamp,
    CAST(NULL AS INT) AS owner_id,
    CAST(NULL AS INT) AS team_id
  FROM base
)
SELECT
  *
FROM macro
%3 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task _fivetran_synced _fivetran_deleted engagement_id engagement_type created_timestamp occurred_timestamp owner_id team_id task_type object_id engagement_source 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp engagement_id _fivetran_deleted _fivetran_synced property_hs_createdate property_hs_timestamp property_hubspot_owner_id property_hubspot_team_id type task_type property_hs_engagement_source 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f2 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f1->101. model.hubspot_source.stg_hubspot__engagement_task:f1 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f2->101. model.hubspot_source.stg_hubspot__engagement_task:f0 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f3->101. model.hubspot_source.stg_hubspot__engagement_task:f4 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f4->101. model.hubspot_source.stg_hubspot__engagement_task:f5 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f5->101. model.hubspot_source.stg_hubspot__engagement_task:f6 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f6->101. model.hubspot_source.stg_hubspot__engagement_task:f7 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f7->101. model.hubspot_source.stg_hubspot__engagement_task:f3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f8->101. model.hubspot_source.stg_hubspot__engagement_task:f8 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f9->101. model.hubspot_source.stg_hubspot__engagement_task:f10
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
_fivetran_deleted boolean Boolean to mark rows that were deleted in the source database.
engagement_id bigint The ID of the engagement.
engagement_type text The type of the engagement.
created_timestamp timestamp without time zone This field marks the task's time of creation and determines where the task sits on the record timeline. You can use either a Unix timestamp in milliseconds or UTC format. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version. For the pre HubSpot v3 versions, this value may be found within the parent `engagement` table.
occurred_timestamp timestamp without time zone This field marks the task's time of occurrence and determines where the task sits on the record timeline. You can use either a Unix timestamp in milliseconds or UTC format. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version. For the pre HubSpot v3 versions, this value may be found within the parent `engagement` table.
owner_id integer The ID of the owner associated with the task. This field determines the user listed as the task creator on the record timeline. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version. For the pre HubSpot v3 versions, this value may be found within the parent `engagement` table.
team_id integer The ID of the team associated with the task. This field determines the team listed as the task creator on the record timeline. PLEASE NOTE: This field will only be populated for connectors utilizing the HubSpot v3 API version.
task_type text None
object_id bigint None
engagement_source text None
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp _fivetran_synced 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task _fivetran_synced 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks _fivetran_synced 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[_fivetran_synced]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting to TIMESTAMP
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp _fivetran_deleted 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task _fivetran_deleted 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks is_active 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[_fivetran_deleted]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to BOOLEAN data type
    • Output Columns:
      • _fivetran_deleted: Directly mapped after casting to BOOLEAN
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[_fivetran_deleted]
    • Cleaning This column is used to determine the is_active status
    • Output Columns:
      • is_active: Used in COALESCE function to determine is_active status
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp engagement_id 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task engagement_id 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_id 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[engagement_id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • engagement_id: Directly mapped after casting to INT
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[engagement_id]
    • Direct This column is directly copied
    • Integration Used as the key to join with the engagements table
    • Output Columns:
      • engagement_id: Directly copied
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp type 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task engagement_type 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_type 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[type]
    • Cleaning The column is cast to TEXT data type
    • Output Columns:
      • engagement_type: Mapped after casting to TEXT
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[engagement_type]
    • Direct This column is directly copied
    • Output Columns:
      • engagement_type: Directly copied
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp property_hs_createdate 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task created_timestamp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks created_timestamp 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[property_hs_createdate]
    • Cleaning The column is likely cast to TIMESTAMP data type
    • Output Columns:
      • created_timestamp: Mapped after casting to TIMESTAMP
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[created_timestamp]
    • Cleaning Used in COALESCE function to determine the final created_timestamp
    • Output Columns:
      • created_timestamp: Used in COALESCE with engagements.created_timestamp
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp property_hs_timestamp 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task occurred_timestamp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks occurred_timestamp 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[property_hs_timestamp]
    • Cleaning The column is likely cast to TIMESTAMP data type
    • Output Columns:
      • occurred_timestamp: Mapped after casting to TIMESTAMP
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[occurred_timestamp]
    • Cleaning Used in COALESCE function to determine the final occurred_timestamp
    • Output Columns:
      • occurred_timestamp: Used in COALESCE with engagements.occurred_timestamp
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp property_hubspot_owner_id 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task owner_id 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks owner_id 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[property_hubspot_owner_id]
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • owner_id: Mapped after casting to INT
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[owner_id]
    • Cleaning Used in COALESCE function to determine the final owner_id
    • Output Columns:
      • owner_id: Used in COALESCE with engagements.owner_id
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp property_hubspot_team_id 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task team_id 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks team_id 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[property_hubspot_team_id]
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • team_id: Mapped after casting to INT
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[team_id]
    • Direct This column is directly copied
    • Output Columns:
      • team_id: Directly copied
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp task_type 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task task_type 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks task_type 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[task_type]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • task_type: Directly copied to the output 'task_type' column
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[task_type]
    • Direct This column is directly copied
    • Output Columns:
      • task_type: Directly copied
Column Lineage
%3 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task object_id 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks object_id 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[object_id]
    • Direct This column is directly copied
    • Output Columns:
      • object_id: Directly copied
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp property_hs_engagement_source 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task engagement_source 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_source 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[property_hs_engagement_source]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is likely renamed for standardization
    • Output Columns:
      • engagement_source: Directly copied and renamed to 'engagement_source' in the output
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[engagement_source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • engagement_source: It is directly mapped to the output column of the same name
102. model.hubspot_source.stg_hubspot__engagement_task_tmp

This SQL query selects all columns from the 'engagement_task' table in the 'hubspot' schema of the 'TEST' database. The query is designed as a staging step, likely part of a dbt (data build tool) project, to create a temporary table that mirrors the source data without any transformations.

Integration
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.engagement_task
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp engagement_id _fivetran_deleted _fivetran_synced property_hs_createdate property_hs_object_id property_hs_task_type property_hs_timestamp property_hubspot_owner_id property_hubspot_team_id type task_type property_hs_engagement_source 144. source.hubspot_source.hubspot.engagement_task 144. source.hubspot_source.hubspot.engagement_task
Name Type Comment
engagement_id bigint None
_fivetran_deleted boolean None
_fivetran_synced timestamp without time zone None
property_hs_createdate timestamp without time zone None
property_hs_object_id bigint None
property_hs_task_type text None
property_hs_timestamp timestamp without time zone None
property_hubspot_owner_id integer None
property_hubspot_team_id integer None
type text None
task_type text None
property_hs_engagement_source text None
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp engagement_id 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task engagement_id 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_id 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[engagement_id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • engagement_id: Directly mapped after casting to INT
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[engagement_id]
    • Direct This column is directly copied
    • Integration Used as the key to join with the engagements table
    • Output Columns:
      • engagement_id: Directly copied
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp _fivetran_deleted 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task _fivetran_deleted 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks is_active 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[_fivetran_deleted]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to BOOLEAN data type
    • Output Columns:
      • _fivetran_deleted: Directly mapped after casting to BOOLEAN
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[_fivetran_deleted]
    • Cleaning This column is used to determine the is_active status
    • Output Columns:
      • is_active: Used in COALESCE function to determine is_active status
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp _fivetran_synced 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task _fivetran_synced 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks _fivetran_synced 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[_fivetran_synced]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting to TIMESTAMP
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp property_hs_createdate 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task created_timestamp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks created_timestamp 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[property_hs_createdate]
    • Cleaning The column is likely cast to TIMESTAMP data type
    • Output Columns:
      • created_timestamp: Mapped after casting to TIMESTAMP
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[created_timestamp]
    • Cleaning Used in COALESCE function to determine the final created_timestamp
    • Output Columns:
      • created_timestamp: Used in COALESCE with engagements.created_timestamp
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp property_hs_timestamp 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task occurred_timestamp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks occurred_timestamp 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[property_hs_timestamp]
    • Cleaning The column is likely cast to TIMESTAMP data type
    • Output Columns:
      • occurred_timestamp: Mapped after casting to TIMESTAMP
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[occurred_timestamp]
    • Cleaning Used in COALESCE function to determine the final occurred_timestamp
    • Output Columns:
      • occurred_timestamp: Used in COALESCE with engagements.occurred_timestamp
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp property_hubspot_owner_id 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task owner_id 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks owner_id 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[property_hubspot_owner_id]
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • owner_id: Mapped after casting to INT
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[owner_id]
    • Cleaning Used in COALESCE function to determine the final owner_id
    • Output Columns:
      • owner_id: Used in COALESCE with engagements.owner_id
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp property_hubspot_team_id 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task team_id 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks team_id 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[property_hubspot_team_id]
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • team_id: Mapped after casting to INT
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[team_id]
    • Direct This column is directly copied
    • Output Columns:
      • team_id: Directly copied
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp type 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task engagement_type 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_type 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[type]
    • Cleaning The column is cast to TEXT data type
    • Output Columns:
      • engagement_type: Mapped after casting to TEXT
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[engagement_type]
    • Direct This column is directly copied
    • Output Columns:
      • engagement_type: Directly copied
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp task_type 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task task_type 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks task_type 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[task_type]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • task_type: Directly copied to the output 'task_type' column
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[task_type]
    • Direct This column is directly copied
    • Output Columns:
      • task_type: Directly copied
Column Lineage
%3 102. model.hubspot_source.stg_hubspot__engagement_task_tmp 102. model.hubspot_source.stg_hubspot__engagement_task_tmp property_hs_engagement_source 101. model.hubspot_source.stg_hubspot__engagement_task 101. model.hubspot_source.stg_hubspot__engagement_task engagement_source 102. model.hubspot_source.stg_hubspot__engagement_task_tmp:f0->101. model.hubspot_source.stg_hubspot__engagement_task:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_source 101. model.hubspot_source.stg_hubspot__engagement_task:f0->26. model.hubspot.hubspot__engagement_tasks:f0
101. model.hubspot_source.stg_hubspot__engagement_task
  • Input Column: 102. model.hubspot_source.stg_hubspot__engagement_task_tmp[property_hs_engagement_source]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is likely renamed for standardization
    • Output Columns:
      • engagement_source: Directly copied and renamed to 'engagement_source' in the output
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 101. model.hubspot_source.stg_hubspot__engagement_task[engagement_source]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • engagement_source: It is directly mapped to the output column of the same name
103. model.hubspot_source.stg_hubspot__engagement_tmp

This SQL query is a simple select statement that retrieves all columns from the 'TEST.hubspot.engagement' table. The comment suggests that this is a placeholder query, possibly used during the dbt compile process, and that the actual table or columns may not exist yet.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.engagement
%3 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp id type _fivetran_synced portal_id 136. source.hubspot_source.hubspot.engagement 136. source.hubspot_source.hubspot.engagement
Name Type Comment
id bigint None
type text None
_fivetran_synced text None
portal_id integer None
Column Lineage
%3 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp id 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_id 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_id 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:header 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:header 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:header 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_id 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 24. model.hubspot.hubspot__engagement_meetings 24. model.hubspot.hubspot__engagement_meetings 27. model.hubspot.hubspot__engagements:f0->24. model.hubspot.hubspot__engagement_meetings:header 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls engagement_id 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes engagement_id 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • engagement_id: Directly mapped and renamed
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_id]
    • Direct This column is directly copied without any transformation
    • Integration Used as the key to join with other tables (contacts_agg, deals_agg, companies_agg)
    • Output Columns:
      • engagement_id: Directly copied to the output
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used to join the engagements table with the engagement_companies table
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used to join engagements with engagement_deals table
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables.
    • Direct Included in the final output.
    • Output Columns:
      • engagement_id: Directly copied to the output.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the engagements table with the base table
24. model.hubspot.hubspot__engagement_meetings
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join with the base table
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration This column is used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied after join
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_id]
    • Integration Used as the key to join the base and engagements tables
    • Output Columns:
      • engagement_id: Directly copied to the output
Column Lineage
%3 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp type 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement engagement_type 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements engagement_type 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 1. model.hubspot.hubspot__companies 1. model.hubspot.hubspot__companies count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f5 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f6 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f0 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f4 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f1 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f3 27. model.hubspot.hubspot__engagements:f0->1. model.hubspot.hubspot__companies:f2 8. model.hubspot.hubspot__deals 8. model.hubspot.hubspot__deals count_engagement_calls count_engagement_emails count_engagement_forwarded_emails count_engagement_incoming_emails count_engagement_meetings count_engagement_notes count_engagement_tasks 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f5 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f6 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f0 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f4 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f1 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f3 27. model.hubspot.hubspot__engagements:f0->8. model.hubspot.hubspot__deals:f2 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails engagement_type 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks engagement_type 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls engagement_type 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes engagement_type 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[type]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • engagement_type: Directly mapped and renamed
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
1. model.hubspot.hubspot__companies
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Featurization Used to create separate counts for each engagement type
    • Output Columns:
      • count_engagement_notes: Counted when engagement_type = 'NOTE'
      • count_engagement_tasks: Counted when engagement_type = 'TASK'
      • count_engagement_calls: Counted when engagement_type = 'CALL'
      • count_engagement_meetings: Counted when engagement_type = 'MEETING'
      • count_engagement_emails: Counted when engagement_type = 'EMAIL'
      • count_engagement_incoming_emails: Counted when engagement_type = 'INCOMING_EMAIL'
      • count_engagement_forwarded_emails: Counted when engagement_type = 'FORWARDED_EMAIL'
8. model.hubspot.hubspot__deals
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Aggregation Used to count different types of engagements
    • Output Columns:
      • count_engagement_notes: Aggregated into this output column
      • count_engagement_tasks: Aggregated into this output column
      • count_engagement_calls: Aggregated into this output column
      • count_engagement_meetings: Aggregated into this output column
      • count_engagement_emails: Aggregated into this output column
      • count_engagement_incoming_emails: Aggregated into this output column
      • count_engagement_forwarded_emails: Aggregated into this output column
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Direct This column is directly included in the final output without transformation.
    • Output Columns:
      • engagement_type: Directly copied to the output.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • engagement_type: Directly copied
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Direct This column is directly copied from the input to the output
    • Output Columns:
      • engagement_type: Directly copied
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[engagement_type]
    • Direct This column is directly selected in the final output without transformation
    • Output Columns:
      • engagement_type: Directly copied to the output
Column Lineage
%3 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp _fivetran_synced 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement _fivetran_synced 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements _fivetran_synced 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0 23. model.hubspot.hubspot__engagement_emails 23. model.hubspot.hubspot__engagement_emails _fivetran_synced 27. model.hubspot.hubspot__engagements:f0->23. model.hubspot.hubspot__engagement_emails:f0 26. model.hubspot.hubspot__engagement_tasks 26. model.hubspot.hubspot__engagement_tasks _fivetran_synced 27. model.hubspot.hubspot__engagements:f0->26. model.hubspot.hubspot__engagement_tasks:f0 22. model.hubspot.hubspot__engagement_calls 22. model.hubspot.hubspot__engagement_calls _fivetran_synced 27. model.hubspot.hubspot__engagements:f0->22. model.hubspot.hubspot__engagement_calls:f0 25. model.hubspot.hubspot__engagement_notes 25. model.hubspot.hubspot__engagement_notes _fivetran_synced 27. model.hubspot.hubspot__engagements:f0->25. model.hubspot.hubspot__engagement_notes:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[_fivetran_synced]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Directly mapped without renaming
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
22. model.hubspot.hubspot__engagement_calls
  • Input Column: 27. model.hubspot.hubspot__engagements[_fivetran_synced]
    • Direct This column is directly included in the final output without transformation.
    • Output Columns:
      • _fivetran_synced: Directly copied to the output.
23. model.hubspot.hubspot__engagement_emails
  • Input Column: 27. model.hubspot.hubspot__engagements[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly copied
25. model.hubspot.hubspot__engagement_notes
  • Input Column: 27. model.hubspot.hubspot__engagements[_fivetran_synced]
    • Direct This column is directly copied from the input to the output
    • Output Columns:
      • _fivetran_synced: Directly copied
26. model.hubspot.hubspot__engagement_tasks
  • Input Column: 27. model.hubspot.hubspot__engagements[_fivetran_synced]
    • Direct This column is directly selected in the final output without transformation
    • Output Columns:
      • _fivetran_synced: Directly copied to the output
Column Lineage
%3 103. model.hubspot_source.stg_hubspot__engagement_tmp 103. model.hubspot_source.stg_hubspot__engagement_tmp portal_id 86. model.hubspot_source.stg_hubspot__engagement 86. model.hubspot_source.stg_hubspot__engagement portal_id 103. model.hubspot_source.stg_hubspot__engagement_tmp:f0->86. model.hubspot_source.stg_hubspot__engagement:f0 27. model.hubspot.hubspot__engagements 27. model.hubspot.hubspot__engagements portal_id 86. model.hubspot_source.stg_hubspot__engagement:f0->27. model.hubspot.hubspot__engagements:f0
86. model.hubspot_source.stg_hubspot__engagement
  • Input Column: 103. model.hubspot_source.stg_hubspot__engagement_tmp[portal_id]
    • Direct The column is directly copied without transformation
    • Cleaning The column is cast to INT data type
    • Output Columns:
      • portal_id: Directly mapped without renaming
27. model.hubspot.hubspot__engagements
  • Input Column: 86. model.hubspot_source.stg_hubspot__engagement[portal_id]
    • Direct This column is directly copied without any transformation
    • Output Columns:
      • portal_id: Directly copied to the output
104. model.hubspot_source.stg_hubspot__owner

This SQL query performs data cleaning and featurization on the 'stg_hubspot__owner' table. It casts several columns to specific data types, renames some columns, and creates a new 'full_name' column by concatenating and trimming the first and last names. The query also sets up a structure to handle potentially missing columns by using a CTE with NULL values.

CleaningFeaturization
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__owner_tmp
), macro AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS TEXT) AS email,
    CAST(NULL AS TEXT) AS first_name,
    CAST(NULL AS TEXT) AS last_name,
    CAST(NULL AS INT) AS owner_id,
    CAST(NULL AS INT) AS portal_id,
    CAST(NULL AS TEXT) AS type,
    CAST(NULL AS TIMESTAMP) AS updated_at
  FROM base
), fields AS (
  SELECT
    CAST(_fivetran_synced AS TIMESTAMP) AS _fivetran_synced,
    CAST(created_at AS TIMESTAMP) AS created_timestamp,
    email AS email_address,
    first_name,
    last_name,
    owner_id,
    portal_id,
    type AS owner_type,
    CAST(updated_at AS TIMESTAMP) AS updated_timestamp,
    TRIM(first_name || ' ' || last_name) AS full_name
  FROM macro
)
SELECT
  *
FROM fields
%3 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner _fivetran_synced created_timestamp email_address first_name full_name last_name owner_id portal_id owner_type updated_timestamp 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp owner_id _fivetran_synced created_at portal_id type updated_at email first_name last_name 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f6 105. model.hubspot_source.stg_hubspot__owner_tmp:f1->104. model.hubspot_source.stg_hubspot__owner:f0 105. model.hubspot_source.stg_hubspot__owner_tmp:f2->104. model.hubspot_source.stg_hubspot__owner:f1 105. model.hubspot_source.stg_hubspot__owner_tmp:f3->104. model.hubspot_source.stg_hubspot__owner:f7 105. model.hubspot_source.stg_hubspot__owner_tmp:f4->104. model.hubspot_source.stg_hubspot__owner:f8 105. model.hubspot_source.stg_hubspot__owner_tmp:f5->104. model.hubspot_source.stg_hubspot__owner:f9 105. model.hubspot_source.stg_hubspot__owner_tmp:f6->104. model.hubspot_source.stg_hubspot__owner:f2 105. model.hubspot_source.stg_hubspot__owner_tmp:f7->104. model.hubspot_source.stg_hubspot__owner:f3 105. model.hubspot_source.stg_hubspot__owner_tmp:f7->104. model.hubspot_source.stg_hubspot__owner:f4 105. model.hubspot_source.stg_hubspot__owner_tmp:f8->104. model.hubspot_source.stg_hubspot__owner:f5 105. model.hubspot_source.stg_hubspot__owner_tmp:f8->104. model.hubspot_source.stg_hubspot__owner:f4
Name Type Comment
_fivetran_synced timestamp without time zone Timestamp of when Fivetran synced a record.
created_timestamp timestamp without time zone A timestamp for when the owner was created.
email_address text The email address of the owner.
first_name text The first name of the owner.
full_name text Full name of the owner.
last_name text The last name of the owner.
owner_id bigint The ID of the owner.
portal_id integer The hub ID.
owner_type text The type of owner.
updated_timestamp timestamp without time zone A timestamp for when the owner was last updated.
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp _fivetran_synced 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner _fivetran_synced 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to TIMESTAMP type
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting to TIMESTAMP
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp created_at 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner created_timestamp 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[created_at]
    • Cleaning The column is cast to TIMESTAMP type and renamed
    • Output Columns:
      • created_timestamp: Mapped after casting to TIMESTAMP and renaming
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp email 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner email_address 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[email]
    • Cleaning The column is renamed
    • Output Columns:
      • email_address: Mapped after renaming
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp first_name 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner first_name full_name 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f1
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[first_name]
    • Direct The column is directly copied without any transformation
    • Featurization Used to create the full_name feature
    • Output Columns:
      • first_name: Directly mapped
      • full_name: Used in concatenation with last_name to create full_name
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp first_name last_name 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner first_name full_name last_name 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f1 105. model.hubspot_source.stg_hubspot__owner_tmp:f1->104. model.hubspot_source.stg_hubspot__owner:f2 105. model.hubspot_source.stg_hubspot__owner_tmp:f1->104. model.hubspot_source.stg_hubspot__owner:f1
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[first_name]
    • Direct The column is directly copied without any transformation
    • Featurization Used to create the full_name feature
    • Output Columns:
      • first_name: Directly mapped
      • full_name: Used in concatenation with last_name to create full_name
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[last_name]
    • Direct The column is directly copied without any transformation
    • Featurization Used to create the full_name feature
    • Output Columns:
      • last_name: Directly mapped
      • full_name: Used in concatenation with first_name to create full_name
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp last_name 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner full_name last_name 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f1 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[last_name]
    • Direct The column is directly copied without any transformation
    • Featurization Used to create the full_name feature
    • Output Columns:
      • last_name: Directly mapped
      • full_name: Used in concatenation with first_name to create full_name
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp owner_id 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner owner_id 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[owner_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT type
    • Output Columns:
      • owner_id: Directly mapped after casting to INT
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp portal_id 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner portal_id 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[portal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT type
    • Output Columns:
      • portal_id: Directly mapped after casting to INT
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp type 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner owner_type 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[type]
    • Cleaning The column is renamed
    • Output Columns:
      • owner_type: Mapped after renaming
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp updated_at 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner updated_timestamp 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[updated_at]
    • Cleaning The column is cast to TIMESTAMP type and renamed
    • Output Columns:
      • updated_timestamp: Mapped after casting to TIMESTAMP and renaming
105. model.hubspot_source.stg_hubspot__owner_tmp

This SQL query selects all columns from the 'owner' table in the 'hubspot' schema of the 'TEST' database. The query is likely intended to be a staging step for further data processing or analysis of HubSpot owner data. The comment suggests that the table might not exist yet or all columns were excluded, implying this could be a placeholder or template query.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.owner
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp owner_id _fivetran_synced created_at portal_id type updated_at email first_name last_name 145. source.hubspot_source.hubspot.owner 145. source.hubspot_source.hubspot.owner
Name Type Comment
owner_id bigint None
_fivetran_synced text None
created_at text None
portal_id integer None
type text None
updated_at text None
email text None
first_name text None
last_name text None
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp owner_id 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner owner_id 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[owner_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT type
    • Output Columns:
      • owner_id: Directly mapped after casting to INT
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp _fivetran_synced 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner _fivetran_synced 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to TIMESTAMP type
    • Output Columns:
      • _fivetran_synced: Directly mapped after casting to TIMESTAMP
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp created_at 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner created_timestamp 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[created_at]
    • Cleaning The column is cast to TIMESTAMP type and renamed
    • Output Columns:
      • created_timestamp: Mapped after casting to TIMESTAMP and renaming
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp portal_id 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner portal_id 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[portal_id]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast to INT type
    • Output Columns:
      • portal_id: Directly mapped after casting to INT
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp type 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner owner_type 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[type]
    • Cleaning The column is renamed
    • Output Columns:
      • owner_type: Mapped after renaming
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp updated_at 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner updated_timestamp 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[updated_at]
    • Cleaning The column is cast to TIMESTAMP type and renamed
    • Output Columns:
      • updated_timestamp: Mapped after casting to TIMESTAMP and renaming
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp email 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner email_address 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[email]
    • Cleaning The column is renamed
    • Output Columns:
      • email_address: Mapped after renaming
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp first_name 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner first_name full_name 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f1
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[first_name]
    • Direct The column is directly copied without any transformation
    • Featurization Used to create the full_name feature
    • Output Columns:
      • first_name: Directly mapped
      • full_name: Used in concatenation with last_name to create full_name
Column Lineage
%3 105. model.hubspot_source.stg_hubspot__owner_tmp 105. model.hubspot_source.stg_hubspot__owner_tmp last_name 104. model.hubspot_source.stg_hubspot__owner 104. model.hubspot_source.stg_hubspot__owner full_name last_name 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f1 105. model.hubspot_source.stg_hubspot__owner_tmp:f0->104. model.hubspot_source.stg_hubspot__owner:f0
104. model.hubspot_source.stg_hubspot__owner
  • Input Column: 105. model.hubspot_source.stg_hubspot__owner_tmp[last_name]
    • Direct The column is directly copied without any transformation
    • Featurization Used to create the full_name feature
    • Output Columns:
      • last_name: Directly mapped
      • full_name: Used in concatenation with first_name to create full_name
106. model.hubspot_source.stg_hubspot__property

This SQL query performs a series of transformations on the 'stg_hubspot__property_tmp' table. It first creates a base CTE with all columns from the source table. Then, it defines a macro CTE that casts all columns to specific data types, effectively creating a schema. Finally, it selects and renames certain columns in the fields CTE. The query primarily focuses on data type standardization and column renaming.

Cleaning
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__property_tmp
), macro AS (
  SELECT
    CAST(NULL AS TEXT) AS _fivetran_id,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS BOOLEAN) AS calculated,
    CAST(NULL AS TIMESTAMP) AS created_at,
    CAST(NULL AS TEXT) AS description,
    CAST(NULL AS TEXT) AS field_type,
    CAST(NULL AS TEXT) AS group_name,
    CAST(NULL AS BOOLEAN) AS hubspot_defined,
    CAST(NULL AS TEXT) AS hubspot_object,
    CAST(NULL AS TEXT) AS label,
    CAST(NULL AS TEXT) AS name,
    CAST(NULL AS BOOLEAN) AS show_currency_symbol,
    CAST(NULL AS TEXT) AS type,
    CAST(NULL AS TIMESTAMP) AS updated_at
  FROM base
), fields AS (
  SELECT
    _fivetran_id,
    _fivetran_synced,
    calculated,
    created_at,
    description,
    field_type,
    group_name,
    hubspot_defined,
    hubspot_object,
    label AS property_label,
    name AS property_name,
    type AS property_type,
    updated_at
  FROM macro
)
SELECT
  *
FROM fields
%3 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property _fivetran_id _fivetran_synced calculated created_at description field_type group_name hubspot_defined hubspot_object property_label property_name property_type updated_at 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp _fivetran_id _fivetran_synced calculated created_at description field_type group_name hubspot_defined hubspot_object label name type updated_at 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0 109. model.hubspot_source.stg_hubspot__property_tmp:f1->106. model.hubspot_source.stg_hubspot__property:f1 109. model.hubspot_source.stg_hubspot__property_tmp:f2->106. model.hubspot_source.stg_hubspot__property:f2 109. model.hubspot_source.stg_hubspot__property_tmp:f3->106. model.hubspot_source.stg_hubspot__property:f3 109. model.hubspot_source.stg_hubspot__property_tmp:f4->106. model.hubspot_source.stg_hubspot__property:f4 109. model.hubspot_source.stg_hubspot__property_tmp:f5->106. model.hubspot_source.stg_hubspot__property:f5 109. model.hubspot_source.stg_hubspot__property_tmp:f6->106. model.hubspot_source.stg_hubspot__property:f6 109. model.hubspot_source.stg_hubspot__property_tmp:f7->106. model.hubspot_source.stg_hubspot__property:f7 109. model.hubspot_source.stg_hubspot__property_tmp:f8->106. model.hubspot_source.stg_hubspot__property:f8 109. model.hubspot_source.stg_hubspot__property_tmp:f9->106. model.hubspot_source.stg_hubspot__property:f9 109. model.hubspot_source.stg_hubspot__property_tmp:f10->106. model.hubspot_source.stg_hubspot__property:f10 109. model.hubspot_source.stg_hubspot__property_tmp:f11->106. model.hubspot_source.stg_hubspot__property:f11 109. model.hubspot_source.stg_hubspot__property_tmp:f12->106. model.hubspot_source.stg_hubspot__property:f12
Name Type Comment
_fivetran_id text Fivetran generated id. Joins to `property_id` in the `property_option` table.
_fivetran_synced text Timestamp of when Fivetran synced a record.
calculated boolean Indicates if the property is calculated by a HubSpot process
created_at text Timestamp representing when the property was created.
description text A description of the property.
field_type text One of textarea, text, date, file, number, select, radio, checkbox, or booleancheckbox.
group_name text The name of the property group that the property belongs to.
hubspot_defined boolean This will be true for default properties that are built into HubSpot.
hubspot_object text If this property is related to other objects, the object will be listed here.
property_label text A human readable label for the property.
property_name text The internal name of the property.
property_type text One of string, number, date, datetime, or enumeration.
updated_at text Timestamp representing when the property was last updated.
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp _fivetran_id 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property _fivetran_id 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[_fivetran_id]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to TEXT data type
    • Output Columns:
      • _fivetran_id: Directly copied after casting to TEXT
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp _fivetran_synced 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property _fivetran_synced 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Directly copied after casting to TIMESTAMP
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp calculated 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property calculated 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[calculated]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to BOOLEAN data type
    • Output Columns:
      • calculated: Directly copied after casting to BOOLEAN
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp created_at 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property created_at 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[created_at]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • created_at: Directly copied after casting to TIMESTAMP
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp description 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property description 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[description]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to TEXT data type
    • Output Columns:
      • description: Directly copied after casting to TEXT
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp field_type 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property field_type 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[field_type]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to TEXT data type
    • Output Columns:
      • field_type: Directly copied after casting to TEXT
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp group_name 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property group_name 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[group_name]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to TEXT data type
    • Output Columns:
      • group_name: Directly copied after casting to TEXT
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp hubspot_defined 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property hubspot_defined 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[hubspot_defined]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to BOOLEAN data type
    • Output Columns:
      • hubspot_defined: Directly copied after casting to BOOLEAN
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp hubspot_object 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property hubspot_object 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[hubspot_object]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to TEXT data type
    • Output Columns:
      • hubspot_object: Directly copied after casting to TEXT
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp label 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property property_label 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[label]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to TEXT data type
    • Output Columns:
      • property_label: Renamed and directly copied after casting to TEXT
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp name 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property property_name 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[name]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed to 'property_name'
    • Output Columns:
      • property_name: Directly copied and renamed
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp type 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property property_type 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[type]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed to 'property_type'
    • Output Columns:
      • property_type: Directly copied and renamed
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp updated_at 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property updated_at 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[updated_at]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • updated_at: Directly copied
107. model.hubspot_source.stg_hubspot__property_option

This SQL query appears to be a staging query that prepares data from a source table for further use. It creates a CTE structure with three parts: 'base' which selects all data from a source table, 'macro' which defines a structure with NULL values for specific columns, and 'fields' which renames some columns. The final SELECT statement returns all columns from the 'fields' CTE.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_stg_hubspot.stg_hubspot__property_option_tmp
), macro AS (
  SELECT
    CAST(NULL AS TEXT) AS label,
    CAST(NULL AS TEXT) AS property_id,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS display_order,
    CAST(NULL AS BOOLEAN) AS hidden,
    CAST(NULL AS TEXT) AS value
  FROM base
), fields AS (
  SELECT
    label AS property_option_label,
    property_id,
    _fivetran_synced,
    display_order,
    hidden,
    value AS property_option_value
  FROM macro
)
SELECT
  *
FROM fields
%3 107. model.hubspot_source.stg_hubspot__property_option 107. model.hubspot_source.stg_hubspot__property_option _fivetran_synced property_option_label property_id display_order hidden property_option_value 108. model.hubspot_source.stg_hubspot__property_option_tmp 108. model.hubspot_source.stg_hubspot__property_option_tmp label property_id _fivetran_synced display_order hidden value 108. model.hubspot_source.stg_hubspot__property_option_tmp:f0->107. model.hubspot_source.stg_hubspot__property_option:f1 108. model.hubspot_source.stg_hubspot__property_option_tmp:f1->107. model.hubspot_source.stg_hubspot__property_option:f2 108. model.hubspot_source.stg_hubspot__property_option_tmp:f2->107. model.hubspot_source.stg_hubspot__property_option:f0 108. model.hubspot_source.stg_hubspot__property_option_tmp:f3->107. model.hubspot_source.stg_hubspot__property_option:f3 108. model.hubspot_source.stg_hubspot__property_option_tmp:f4->107. model.hubspot_source.stg_hubspot__property_option:f4 108. model.hubspot_source.stg_hubspot__property_option_tmp:f5->107. model.hubspot_source.stg_hubspot__property_option:f5
Name Type Comment
_fivetran_synced text Timestamp of when Fivetran synced a record.
property_option_label text The label of the option displayed inside the HubSpot app.
property_id text The ID of the related property.
display_order integer Order of options displayed in Hubspot, starting with the lowest positive integer value. Values of -1 will cause the option to be displayed after any positive values.
hidden boolean Boolean if the option will be displayed in HubSpot
property_option_value text The internal value of the option.
Column Lineage
%3 108. model.hubspot_source.stg_hubspot__property_option_tmp 108. model.hubspot_source.stg_hubspot__property_option_tmp _fivetran_synced 107. model.hubspot_source.stg_hubspot__property_option 107. model.hubspot_source.stg_hubspot__property_option _fivetran_synced 108. model.hubspot_source.stg_hubspot__property_option_tmp:f0->107. model.hubspot_source.stg_hubspot__property_option:f0
107. model.hubspot_source.stg_hubspot__property_option
  • Input Column: 108. model.hubspot_source.stg_hubspot__property_option_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly mapped
Column Lineage
%3 108. model.hubspot_source.stg_hubspot__property_option_tmp 108. model.hubspot_source.stg_hubspot__property_option_tmp label 107. model.hubspot_source.stg_hubspot__property_option 107. model.hubspot_source.stg_hubspot__property_option property_option_label 108. model.hubspot_source.stg_hubspot__property_option_tmp:f0->107. model.hubspot_source.stg_hubspot__property_option:f0
107. model.hubspot_source.stg_hubspot__property_option
  • Input Column: 108. model.hubspot_source.stg_hubspot__property_option_tmp[label]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed to 'property_option_label'
    • Output Columns:
      • property_option_label: Directly mapped and renamed
Column Lineage
%3 108. model.hubspot_source.stg_hubspot__property_option_tmp 108. model.hubspot_source.stg_hubspot__property_option_tmp property_id 107. model.hubspot_source.stg_hubspot__property_option 107. model.hubspot_source.stg_hubspot__property_option property_id 108. model.hubspot_source.stg_hubspot__property_option_tmp:f0->107. model.hubspot_source.stg_hubspot__property_option:f0
107. model.hubspot_source.stg_hubspot__property_option
  • Input Column: 108. model.hubspot_source.stg_hubspot__property_option_tmp[property_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • property_id: Directly mapped
Column Lineage
%3 108. model.hubspot_source.stg_hubspot__property_option_tmp 108. model.hubspot_source.stg_hubspot__property_option_tmp display_order 107. model.hubspot_source.stg_hubspot__property_option 107. model.hubspot_source.stg_hubspot__property_option display_order 108. model.hubspot_source.stg_hubspot__property_option_tmp:f0->107. model.hubspot_source.stg_hubspot__property_option:f0
107. model.hubspot_source.stg_hubspot__property_option
  • Input Column: 108. model.hubspot_source.stg_hubspot__property_option_tmp[display_order]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • display_order: Directly mapped
Column Lineage
%3 108. model.hubspot_source.stg_hubspot__property_option_tmp 108. model.hubspot_source.stg_hubspot__property_option_tmp hidden 107. model.hubspot_source.stg_hubspot__property_option 107. model.hubspot_source.stg_hubspot__property_option hidden 108. model.hubspot_source.stg_hubspot__property_option_tmp:f0->107. model.hubspot_source.stg_hubspot__property_option:f0
107. model.hubspot_source.stg_hubspot__property_option
  • Input Column: 108. model.hubspot_source.stg_hubspot__property_option_tmp[hidden]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • hidden: Directly mapped
Column Lineage
%3 108. model.hubspot_source.stg_hubspot__property_option_tmp 108. model.hubspot_source.stg_hubspot__property_option_tmp value 107. model.hubspot_source.stg_hubspot__property_option 107. model.hubspot_source.stg_hubspot__property_option property_option_value 108. model.hubspot_source.stg_hubspot__property_option_tmp:f0->107. model.hubspot_source.stg_hubspot__property_option:f0
107. model.hubspot_source.stg_hubspot__property_option
  • Input Column: 108. model.hubspot_source.stg_hubspot__property_option_tmp[value]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed to 'property_option_value'
    • Output Columns:
      • property_option_value: Directly mapped and renamed
108. model.hubspot_source.stg_hubspot__property_option_tmp

This SQL query selects all columns from the 'property_option' table in the 'hubspot' schema of the 'TEST' database. The query is designed to be a staging step, likely part of a dbt (data build tool) project, to prepare data for further transformation or analysis. The comment suggests that this query might be used as a placeholder or template, especially during the compilation phase of dbt, and it's structured to be compatible with SQLFluff, a SQL linter.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.property_option
%3 108. model.hubspot_source.stg_hubspot__property_option_tmp 108. model.hubspot_source.stg_hubspot__property_option_tmp label property_id _fivetran_synced display_order hidden value 147. source.hubspot_source.hubspot.property_option 147. source.hubspot_source.hubspot.property_option
Name Type Comment
label text None
property_id text None
_fivetran_synced text None
display_order integer None
hidden boolean None
value text None
Column Lineage
%3 108. model.hubspot_source.stg_hubspot__property_option_tmp 108. model.hubspot_source.stg_hubspot__property_option_tmp label 107. model.hubspot_source.stg_hubspot__property_option 107. model.hubspot_source.stg_hubspot__property_option property_option_label 108. model.hubspot_source.stg_hubspot__property_option_tmp:f0->107. model.hubspot_source.stg_hubspot__property_option:f0
107. model.hubspot_source.stg_hubspot__property_option
  • Input Column: 108. model.hubspot_source.stg_hubspot__property_option_tmp[label]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed to 'property_option_label'
    • Output Columns:
      • property_option_label: Directly mapped and renamed
Column Lineage
%3 108. model.hubspot_source.stg_hubspot__property_option_tmp 108. model.hubspot_source.stg_hubspot__property_option_tmp property_id 107. model.hubspot_source.stg_hubspot__property_option 107. model.hubspot_source.stg_hubspot__property_option property_id 108. model.hubspot_source.stg_hubspot__property_option_tmp:f0->107. model.hubspot_source.stg_hubspot__property_option:f0
107. model.hubspot_source.stg_hubspot__property_option
  • Input Column: 108. model.hubspot_source.stg_hubspot__property_option_tmp[property_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • property_id: Directly mapped
Column Lineage
%3 108. model.hubspot_source.stg_hubspot__property_option_tmp 108. model.hubspot_source.stg_hubspot__property_option_tmp _fivetran_synced 107. model.hubspot_source.stg_hubspot__property_option 107. model.hubspot_source.stg_hubspot__property_option _fivetran_synced 108. model.hubspot_source.stg_hubspot__property_option_tmp:f0->107. model.hubspot_source.stg_hubspot__property_option:f0
107. model.hubspot_source.stg_hubspot__property_option
  • Input Column: 108. model.hubspot_source.stg_hubspot__property_option_tmp[_fivetran_synced]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_synced: Directly mapped
Column Lineage
%3 108. model.hubspot_source.stg_hubspot__property_option_tmp 108. model.hubspot_source.stg_hubspot__property_option_tmp display_order 107. model.hubspot_source.stg_hubspot__property_option 107. model.hubspot_source.stg_hubspot__property_option display_order 108. model.hubspot_source.stg_hubspot__property_option_tmp:f0->107. model.hubspot_source.stg_hubspot__property_option:f0
107. model.hubspot_source.stg_hubspot__property_option
  • Input Column: 108. model.hubspot_source.stg_hubspot__property_option_tmp[display_order]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • display_order: Directly mapped
Column Lineage
%3 108. model.hubspot_source.stg_hubspot__property_option_tmp 108. model.hubspot_source.stg_hubspot__property_option_tmp hidden 107. model.hubspot_source.stg_hubspot__property_option 107. model.hubspot_source.stg_hubspot__property_option hidden 108. model.hubspot_source.stg_hubspot__property_option_tmp:f0->107. model.hubspot_source.stg_hubspot__property_option:f0
107. model.hubspot_source.stg_hubspot__property_option
  • Input Column: 108. model.hubspot_source.stg_hubspot__property_option_tmp[hidden]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • hidden: Directly mapped
Column Lineage
%3 108. model.hubspot_source.stg_hubspot__property_option_tmp 108. model.hubspot_source.stg_hubspot__property_option_tmp value 107. model.hubspot_source.stg_hubspot__property_option 107. model.hubspot_source.stg_hubspot__property_option property_option_value 108. model.hubspot_source.stg_hubspot__property_option_tmp:f0->107. model.hubspot_source.stg_hubspot__property_option:f0
107. model.hubspot_source.stg_hubspot__property_option
  • Input Column: 108. model.hubspot_source.stg_hubspot__property_option_tmp[value]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed to 'property_option_value'
    • Output Columns:
      • property_option_value: Directly mapped and renamed
109. model.hubspot_source.stg_hubspot__property_tmp

This SQL query is designed to select all columns from the 'property' table in the 'hubspot' schema of the 'TEST' database. However, the comment suggests that no columns were returned, possibly because the relation doesn't exist yet or all columns were excluded. The query appears to be a placeholder or template, potentially used in a dbt (data build tool) project, to maintain structure and satisfy SQLFluff linting requirements during compilation.

Other
SQL Query
SELECT
  *
/* No columns were returned. Maybe the relation doesn't exist yet 
or all columns were excluded. This star is only output during  
dbt compile, and exists to keep SQLFluff happy. */
FROM TEST.hubspot.property
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp _fivetran_id _fivetran_synced calculated created_at description field_type group_name hubspot_defined hubspot_object label name show_currency_symbol type updated_at 146. source.hubspot_source.hubspot.property 146. source.hubspot_source.hubspot.property
Name Type Comment
_fivetran_id text None
_fivetran_synced text None
calculated boolean None
created_at text None
description text None
field_type text None
group_name text None
hubspot_defined boolean None
hubspot_object text None
label text None
name text None
show_currency_symbol boolean None
type text None
updated_at text None
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp _fivetran_id 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property _fivetran_id 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[_fivetran_id]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to TEXT data type
    • Output Columns:
      • _fivetran_id: Directly copied after casting to TEXT
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp _fivetran_synced 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property _fivetran_synced 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[_fivetran_synced]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • _fivetran_synced: Directly copied after casting to TIMESTAMP
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp calculated 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property calculated 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[calculated]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to BOOLEAN data type
    • Output Columns:
      • calculated: Directly copied after casting to BOOLEAN
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp created_at 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property created_at 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[created_at]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to TIMESTAMP data type
    • Output Columns:
      • created_at: Directly copied after casting to TIMESTAMP
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp description 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property description 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[description]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to TEXT data type
    • Output Columns:
      • description: Directly copied after casting to TEXT
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp field_type 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property field_type 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[field_type]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to TEXT data type
    • Output Columns:
      • field_type: Directly copied after casting to TEXT
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp group_name 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property group_name 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[group_name]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to TEXT data type
    • Output Columns:
      • group_name: Directly copied after casting to TEXT
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp hubspot_defined 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property hubspot_defined 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[hubspot_defined]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to BOOLEAN data type
    • Output Columns:
      • hubspot_defined: Directly copied after casting to BOOLEAN
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp hubspot_object 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property hubspot_object 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[hubspot_object]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to TEXT data type
    • Output Columns:
      • hubspot_object: Directly copied after casting to TEXT
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp label 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property property_label 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[label]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast to TEXT data type
    • Output Columns:
      • property_label: Renamed and directly copied after casting to TEXT
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp name 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property property_name 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[name]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed to 'property_name'
    • Output Columns:
      • property_name: Directly copied and renamed
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp type 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property property_type 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[type]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is renamed to 'property_type'
    • Output Columns:
      • property_type: Directly copied and renamed
Column Lineage
%3 109. model.hubspot_source.stg_hubspot__property_tmp 109. model.hubspot_source.stg_hubspot__property_tmp updated_at 106. model.hubspot_source.stg_hubspot__property 106. model.hubspot_source.stg_hubspot__property updated_at 109. model.hubspot_source.stg_hubspot__property_tmp:f0->106. model.hubspot_source.stg_hubspot__property:f0
106. model.hubspot_source.stg_hubspot__property
  • Input Column: 109. model.hubspot_source.stg_hubspot__property_tmp[updated_at]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • updated_at: Directly copied
110. source.hubspot_source.hubspot.company
The model details are not provided
111. source.hubspot_source.hubspot.company_property_history
The model details are not provided
112. source.hubspot_source.hubspot.contact
The model details are not provided
113. source.hubspot_source.hubspot.contact_list
The model details are not provided
114. source.hubspot_source.hubspot.contact_list_member
The model details are not provided
115. source.hubspot_source.hubspot.contact_property_history
The model details are not provided
116. source.hubspot_source.hubspot.deal
The model details are not provided
117. source.hubspot_source.hubspot.deal_company
The model details are not provided
118. source.hubspot_source.hubspot.deal_contact
The model details are not provided
119. source.hubspot_source.hubspot.deal_pipeline
The model details are not provided
120. source.hubspot_source.hubspot.deal_pipeline_stage
The model details are not provided
121. source.hubspot_source.hubspot.deal_property_history
The model details are not provided
122. source.hubspot_source.hubspot.deal_stage
The model details are not provided
123. source.hubspot_source.hubspot.email_campaign
The model details are not provided
124. source.hubspot_source.hubspot.email_event
The model details are not provided
125. source.hubspot_source.hubspot.email_event_bounce
The model details are not provided
126. source.hubspot_source.hubspot.email_event_click
The model details are not provided
127. source.hubspot_source.hubspot.email_event_deferred
The model details are not provided
128. source.hubspot_source.hubspot.email_event_delivered
The model details are not provided
129. source.hubspot_source.hubspot.email_event_dropped
The model details are not provided
130. source.hubspot_source.hubspot.email_event_forward
The model details are not provided
131. source.hubspot_source.hubspot.email_event_open
The model details are not provided
132. source.hubspot_source.hubspot.email_event_print
The model details are not provided
133. source.hubspot_source.hubspot.email_event_sent
The model details are not provided
134. source.hubspot_source.hubspot.email_event_spam_report
The model details are not provided
135. source.hubspot_source.hubspot.email_event_status_change
The model details are not provided
136. source.hubspot_source.hubspot.engagement
The model details are not provided
137. source.hubspot_source.hubspot.engagement_call
The model details are not provided
138. source.hubspot_source.hubspot.engagement_company
The model details are not provided
139. source.hubspot_source.hubspot.engagement_contact
The model details are not provided
140. source.hubspot_source.hubspot.engagement_deal
The model details are not provided
141. source.hubspot_source.hubspot.engagement_email
The model details are not provided
142. source.hubspot_source.hubspot.engagement_meeting
The model details are not provided
143. source.hubspot_source.hubspot.engagement_note
The model details are not provided
144. source.hubspot_source.hubspot.engagement_task
The model details are not provided
145. source.hubspot_source.hubspot.owner
The model details are not provided
146. source.hubspot_source.hubspot.property
The model details are not provided
147. source.hubspot_source.hubspot.property_option
The model details are not provided