%3 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history 6. model.facebook_ads.facebook_ads__url_tags->7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history->5. model.facebook_ads.facebook_ads__url_report 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history->1. model.facebook_ads.facebook_ads__account_report 8. model.facebook_ads_source.stg_facebook_ads__account_history->2. model.facebook_ads.facebook_ads__ad_report 8. model.facebook_ads_source.stg_facebook_ads__account_history->3. model.facebook_ads.facebook_ads__ad_set_report 8. model.facebook_ads_source.stg_facebook_ads__account_history->4. model.facebook_ads.facebook_ads__campaign_report 8. model.facebook_ads_source.stg_facebook_ads__account_history->5. model.facebook_ads.facebook_ads__url_report 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp->8. model.facebook_ads_source.stg_facebook_ads__account_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history->2. model.facebook_ads.facebook_ads__ad_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history->3. model.facebook_ads.facebook_ads__ad_set_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history->4. model.facebook_ads.facebook_ads__campaign_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history->5. model.facebook_ads.facebook_ads__url_report 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp->10. model.facebook_ads_source.stg_facebook_ads__ad_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history->2. model.facebook_ads.facebook_ads__ad_report 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history->3. model.facebook_ads.facebook_ads__ad_set_report 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history->5. model.facebook_ads.facebook_ads__url_report 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad->1. model.facebook_ads.facebook_ads__account_report 14. model.facebook_ads_source.stg_facebook_ads__basic_ad->2. model.facebook_ads.facebook_ads__ad_report 14. model.facebook_ads_source.stg_facebook_ads__basic_ad->3. model.facebook_ads.facebook_ads__ad_set_report 14. model.facebook_ads_source.stg_facebook_ads__basic_ad->4. model.facebook_ads.facebook_ads__campaign_report 14. model.facebook_ads_source.stg_facebook_ads__basic_ad->5. model.facebook_ads.facebook_ads__url_report 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp->14. model.facebook_ads_source.stg_facebook_ads__basic_ad 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history->2. model.facebook_ads.facebook_ads__ad_report 16. model.facebook_ads_source.stg_facebook_ads__campaign_history->3. model.facebook_ads.facebook_ads__ad_set_report 16. model.facebook_ads_source.stg_facebook_ads__campaign_history->4. model.facebook_ads.facebook_ads__campaign_report 16. model.facebook_ads_source.stg_facebook_ads__campaign_history->5. model.facebook_ads.facebook_ads__url_report 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp->16. model.facebook_ads_source.stg_facebook_ads__campaign_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history->6. model.facebook_ads.facebook_ads__url_tags 18. model.facebook_ads_source.stg_facebook_ads__creative_history->7. model.facebook_ads.int_facebook_ads__creative_history 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp->18. model.facebook_ads_source.stg_facebook_ads__creative_history 20. source.facebook_ads_source.facebook_ads.account_history 20. source.facebook_ads_source.facebook_ads.account_history 20. source.facebook_ads_source.facebook_ads.account_history->9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 21. source.facebook_ads_source.facebook_ads.ad_history 21. source.facebook_ads_source.facebook_ads.ad_history 21. source.facebook_ads_source.facebook_ads.ad_history->11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 22. source.facebook_ads_source.facebook_ads.ad_set_history 22. source.facebook_ads_source.facebook_ads.ad_set_history 22. source.facebook_ads_source.facebook_ads.ad_set_history->13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 23. source.facebook_ads_source.facebook_ads.basic_ad 23. source.facebook_ads_source.facebook_ads.basic_ad 23. source.facebook_ads_source.facebook_ads.basic_ad->15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 24. source.facebook_ads_source.facebook_ads.campaign_history 24. source.facebook_ads_source.facebook_ads.campaign_history 24. source.facebook_ads_source.facebook_ads.campaign_history->17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 25. source.facebook_ads_source.facebook_ads.creative_history 25. source.facebook_ads_source.facebook_ads.creative_history 25. source.facebook_ads_source.facebook_ads.creative_history->19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp
1. model.facebook_ads.facebook_ads__account_report

This SQL query combines data from two staging tables: basic ad report and account history. It joins these tables on account ID and source relation, filtering for the most recent account records. The query then aggregates ad performance metrics (clicks, impressions, spend) at the account and date level, while including various account details. The result is a comprehensive daily account-level report of Facebook ad performance with associated account information.

FilteringIntegrationAggregation
SQL Query
WITH report AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__basic_ad
), accounts AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__account_history
  WHERE
    is_most_recent_record = TRUE
), joined AS (
  SELECT
    report.source_relation,
    report.date_day,
    accounts.account_id,
    accounts.account_name,
    accounts.account_status,
    accounts.business_country_code,
    accounts.created_at,
    accounts.currency,
    accounts.timezone_name,
    SUM(report.clicks) AS clicks,
    SUM(report.impressions) AS impressions,
    SUM(report.spend) AS spend
  FROM report
  LEFT JOIN accounts
    ON report.account_id = accounts.account_id
    AND report.source_relation = accounts.source_relation
  GROUP BY
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9
)
SELECT
  *
FROM joined
%3 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report source_relation date_day account_id account_name clicks impressions spend account_status business_country_code created_at currency timezone_name 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history source_relation account_id account_name is_most_recent_record account_status business_country_code created_at currency timezone_name 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0 8. model.facebook_ads_source.stg_facebook_ads__account_history:f1->1. model.facebook_ads.facebook_ads__account_report:f2 8. model.facebook_ads_source.stg_facebook_ads__account_history:f2->1. model.facebook_ads.facebook_ads__account_report:f3 8. model.facebook_ads_source.stg_facebook_ads__account_history:f4->1. model.facebook_ads.facebook_ads__account_report:f7 8. model.facebook_ads_source.stg_facebook_ads__account_history:f5->1. model.facebook_ads.facebook_ads__account_report:f8 8. model.facebook_ads_source.stg_facebook_ads__account_history:f6->1. model.facebook_ads.facebook_ads__account_report:f9 8. model.facebook_ads_source.stg_facebook_ads__account_history:f7->1. model.facebook_ads.facebook_ads__account_report:f10 8. model.facebook_ads_source.stg_facebook_ads__account_history:f8->1. model.facebook_ads.facebook_ads__account_report:f11 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad source_relation date_day account_id impressions clicks spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->1. model.facebook_ads.facebook_ads__account_report:f0 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f1->1. model.facebook_ads.facebook_ads__account_report:f1 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f2->1. model.facebook_ads.facebook_ads__account_report:f2 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f3->1. model.facebook_ads.facebook_ads__account_report:f5 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f4->1. model.facebook_ads.facebook_ads__account_report:f4 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f5->1. model.facebook_ads.facebook_ads__account_report:f6
Name Type Comment
source_relation text The source of the record if the unioning functionality is being used. If not this field will be empty.
date_day date The date of the performance.
account_id bigint The ID of the related account.
account_name text The name of the related account.
clicks bigint The number of clicks the ad had on the given day.
impressions bigint The number of impressions the ad had on the given day.
spend double precision The spend on the ad in the given day.
account_status text None
business_country_code text None
created_at timestamp without time zone None
currency text None
timezone_name text None
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history source_relation 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report source_relation 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad source_relation 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->1. model.facebook_ads.facebook_ads__account_report:f0
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the report table
    • Aggregation The column is part of the GROUP BY clause
    • Output Columns:
      • source_relation: Directly copied to output
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join condition with the accounts table
    • Aggregation Used in the GROUP BY clause
    • Output Columns:
      • source_relation: Directly copied to the output
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad date_day 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report date_day 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->1. model.facebook_ads.facebook_ads__account_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp date 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[date]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • date_day: Directly mapped and renamed
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[date_day]
    • Direct The column is directly copied without any transformation
    • Aggregation Used in the GROUP BY clause
    • Output Columns:
      • date_day: Directly copied to the output
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history account_id 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report account_id 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad account_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->1. model.facebook_ads.facebook_ads__account_report:f0 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp id 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f0->8. model.facebook_ads_source.stg_facebook_ads__account_history:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp account_id 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
8. model.facebook_ads_source.stg_facebook_ads__account_history
  • Input Column: 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp[id]
    • Cleaning The column is cast to BIGINT
    • Deduplication Used in the ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • account_id: Directly mapped after casting to BIGINT
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[account_id]
    • Cleaning The column is cast to BIGINT data type
    • Output Columns:
      • account_id: Directly mapped after casting
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the report table
    • Aggregation The column is part of the GROUP BY clause
    • Output Columns:
      • account_id: Directly copied to output
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[account_id]
    • Integration Used as the key to join with the accounts table
    • Aggregation Used in the GROUP BY clause
    • Output Columns:
      • account_id: Directly copied to the output
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history account_name 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report account_name 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp name 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f0->8. model.facebook_ads_source.stg_facebook_ads__account_history:f0
8. model.facebook_ads_source.stg_facebook_ads__account_history
  • Input Column: 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp[name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • account_name: Directly mapped
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_name]
    • Direct The column is directly copied without any transformation
    • Aggregation The column is part of the GROUP BY clause
    • Output Columns:
      • account_name: Directly copied to output
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad clicks 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report clicks 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->1. model.facebook_ads.facebook_ads__account_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp inline_link_clicks 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[inline_link_clicks]
    • Cleaning The column is cleaned by applying COALESCE to handle potential NULL values
    • Output Columns:
      • clicks: Mapped after applying COALESCE and renamed
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[clicks]
    • Aggregation Summed up in the SELECT clause
    • Output Columns:
      • clicks: Aggregated into the output column
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad impressions 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report impressions 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->1. model.facebook_ads.facebook_ads__account_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp impressions 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[impressions]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • impressions: Directly mapped
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[impressions]
    • Aggregation Summed up in the SELECT clause
    • Output Columns:
      • impressions: Aggregated into the output column
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad spend 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->1. model.facebook_ads.facebook_ads__account_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp spend 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[spend]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • spend: Directly mapped
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[spend]
    • Aggregation Summed up in the SELECT clause
    • Output Columns:
      • spend: Aggregated into the output column
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history account_status 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report account_status 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_status]
    • Direct The column is directly copied without any transformation
    • Aggregation The column is part of the GROUP BY clause
    • Output Columns:
      • account_status: Directly copied to output
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history business_country_code 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report business_country_code 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[business_country_code]
    • Direct The column is directly copied without any transformation
    • Aggregation The column is part of the GROUP BY clause
    • Output Columns:
      • business_country_code: Directly copied to output
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history created_at 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report created_at 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[created_at]
    • Direct The column is directly copied without any transformation
    • Aggregation The column is part of the GROUP BY clause
    • Output Columns:
      • created_at: Directly copied to output
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history currency 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report currency 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[currency]
    • Direct The column is directly copied without any transformation
    • Aggregation The column is part of the GROUP BY clause
    • Output Columns:
      • currency: Directly copied to output
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history timezone_name 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report timezone_name 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[timezone_name]
    • Direct The column is directly copied without any transformation
    • Aggregation The column is part of the GROUP BY clause
    • Output Columns:
      • timezone_name: Directly copied to output
2. model.facebook_ads.facebook_ads__ad_report

This SQL query integrates data from multiple Facebook Ads-related tables (ad reports, accounts, campaigns, ad sets, and ads) to create a comprehensive ad performance report. It joins these tables based on various IDs and the source relation, filters for the most recent records in history tables, and aggregates metrics such as clicks, impressions, and spend. The result is a detailed view of ad performance across different levels of the ad hierarchy (account, campaign, ad set, and ad).

FilteringIntegrationAggregation
SQL Query
WITH report AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__basic_ad
), accounts AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__account_history
  WHERE
    is_most_recent_record = TRUE
), campaigns AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__campaign_history
  WHERE
    is_most_recent_record = TRUE
), ad_sets AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__ad_set_history
  WHERE
    is_most_recent_record = TRUE
), ads AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__ad_history
  WHERE
    is_most_recent_record = TRUE
), joined AS (
  SELECT
    report.source_relation,
    report.date_day,
    accounts.account_id,
    accounts.account_name,
    campaigns.campaign_id,
    campaigns.campaign_name,
    ad_sets.ad_set_id,
    ad_sets.ad_set_name,
    ads.ad_id,
    ads.ad_name,
    SUM(report.clicks) AS clicks,
    SUM(report.impressions) AS impressions,
    SUM(report.spend) AS spend
  FROM report
  LEFT JOIN accounts
    ON report.account_id = accounts.account_id
    AND report.source_relation = accounts.source_relation
  LEFT JOIN ads
    ON report.ad_id = ads.ad_id AND report.source_relation = ads.source_relation
  LEFT JOIN campaigns
    ON ads.campaign_id = campaigns.campaign_id
    AND ads.source_relation = campaigns.source_relation
  LEFT JOIN ad_sets
    ON ads.ad_set_id = ad_sets.ad_set_id
    AND ads.source_relation = ad_sets.source_relation
  GROUP BY
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10
)
SELECT
  *
FROM joined
%3 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report source_relation date_day account_id account_name campaign_id campaign_name ad_set_id ad_set_name ad_id ad_name clicks impressions spend 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history source_relation account_id account_name is_most_recent_record 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 8. model.facebook_ads_source.stg_facebook_ads__account_history:f1->2. model.facebook_ads.facebook_ads__ad_report:f2 8. model.facebook_ads_source.stg_facebook_ads__account_history:f2->2. model.facebook_ads.facebook_ads__ad_report:f3 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history source_relation ad_id campaign_id ad_name is_most_recent_record 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f1->2. model.facebook_ads.facebook_ads__ad_report:f8 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f3->2. model.facebook_ads.facebook_ads__ad_report:f9 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history source_relation ad_set_id ad_set_name is_most_recent_record status 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f1->2. model.facebook_ads.facebook_ads__ad_report:f6 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f2->2. model.facebook_ads.facebook_ads__ad_report:f7 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad source_relation ad_id date_day account_id impressions clicks spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f1->2. model.facebook_ads.facebook_ads__ad_report:f8 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f2->2. model.facebook_ads.facebook_ads__ad_report:f1 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f3->2. model.facebook_ads.facebook_ads__ad_report:f2 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f4->2. model.facebook_ads.facebook_ads__ad_report:f11 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f5->2. model.facebook_ads.facebook_ads__ad_report:f10 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f6->2. model.facebook_ads.facebook_ads__ad_report:f12 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history source_relation campaign_id campaign_name is_most_recent_record 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f1->2. model.facebook_ads.facebook_ads__ad_report:f4 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f2->2. model.facebook_ads.facebook_ads__ad_report:f5
Name Type Comment
source_relation text The source of the record if the unioning functionality is being used. If not this field will be empty.
date_day date The date of the performance.
account_id bigint The ID of the related account.
account_name text The name of the related account.
campaign_id bigint The ID of the related campaign.
campaign_name text The name of the related campaign.
ad_set_id bigint The ID of the related ad set.
ad_set_name text The name of the related ad set.
ad_id bigint The ID of the related ad.
ad_name text The name of the related ad.
clicks bigint The number of clicks the ad had on the given day.
impressions bigint The number of impressions the ad had on the given day.
spend double precision The spend on the ad in the given day.
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history source_relation 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report source_relation 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history source_relation 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history source_relation 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad source_relation 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history source_relation 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[source_relation]
    • Integration used as part of the join condition with the report table
    • Direct directly copied to the output
    • Output Columns:
      • source_relation: directly copied
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[source_relation]
    • Integration used as a key to join with other tables
    • Direct copied directly to the output
    • Output Columns:
      • source_relation: directly copied
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[source_relation]
    • Integration used as part of the join condition with other tables
    • Direct directly copied to the output
    • Output Columns:
      • source_relation: directly copied
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join condition with other tables
    • Aggregation Included in the GROUP BY clause
    • Output Columns:
      • source_relation: Directly copied to the output
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[source_relation]
    • Integration used to join with other tables
    • Direct directly copied to the output
    • Output Columns:
      • source_relation: directly copied
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad date_day 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report date_day 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp date 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[date]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • date_day: Directly mapped and renamed
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[date_day]
    • Direct The column is directly copied without any transformation
    • Aggregation Included in the GROUP BY clause
    • Output Columns:
      • date_day: Directly copied to the output
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history account_id 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report account_id 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad account_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp id 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f0->8. model.facebook_ads_source.stg_facebook_ads__account_history:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp account_id 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
8. model.facebook_ads_source.stg_facebook_ads__account_history
  • Input Column: 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp[id]
    • Cleaning The column is cast to BIGINT
    • Deduplication Used in the ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • account_id: Directly mapped after casting to BIGINT
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[account_id]
    • Cleaning The column is cast to BIGINT data type
    • Output Columns:
      • account_id: Directly mapped after casting
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_id]
    • Integration used as the join key with the report table
    • Direct directly copied to the output
    • Output Columns:
      • account_id: directly copied
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[account_id]
    • Integration Used as a join key to connect with the accounts table
    • Output Columns:
      • account_id: Directly copied to the output from the joined accounts table
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history account_name 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report account_name 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp name 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f0->8. model.facebook_ads_source.stg_facebook_ads__account_history:f0
8. model.facebook_ads_source.stg_facebook_ads__account_history
  • Input Column: 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp[name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • account_name: Directly mapped
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_name]
    • Direct directly copied to the output
    • Output Columns:
      • account_name: directly copied
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history campaign_id 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report campaign_id 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp id 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f0->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0
16. model.facebook_ads_source.stg_facebook_ads__campaign_history
  • Input Column: 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp[id]
    • Cleaning Cast to BIGINT data type
    • Deduplication Used in the ROW_NUMBER() window function to identify the most recent record
    • Output Columns:
      • campaign_id: Directly mapped after casting to BIGINT
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_id]
    • Integration used to join with the ads table
    • Direct directly copied to the output
    • Output Columns:
      • campaign_id: directly copied
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history campaign_name 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report campaign_name 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp name 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f0->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0
16. model.facebook_ads_source.stg_facebook_ads__campaign_history
  • Input Column: 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp[name]
    • Direct Copied without transformation
    • Output Columns:
      • campaign_name: Directly mapped
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_name]
    • Direct directly copied to the output
    • Output Columns:
      • campaign_name: directly copied
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history ad_set_id 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report ad_set_id 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp id 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f0->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0
12. model.facebook_ads_source.stg_facebook_ads__ad_set_history
  • Input Column: 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp[id]
    • Cleaning The column is cast to BIGINT
    • Deduplication Used in the ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • ad_set_id: Directly mapped after casting to BIGINT
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[ad_set_id]
    • Integration used as part of the join condition with the ads table
    • Direct directly copied to the output
    • Output Columns:
      • ad_set_id: directly copied
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history ad_set_name 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report ad_set_name 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp name 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f0->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0
12. model.facebook_ads_source.stg_facebook_ads__ad_set_history
  • Input Column: 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp[name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • ad_set_name: Directly mapped
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[ad_set_name]
    • Direct directly copied to the output
    • Output Columns:
      • ad_set_name: directly copied
Column Lineage
%3 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history ad_id 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report ad_id 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad ad_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp id 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp ad_id 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
10. model.facebook_ads_source.stg_facebook_ads__ad_history
  • Input Column: 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp[id]
    • Cleaning The column is cast to BIGINT
    • Deduplication Used in ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • ad_id: Directly mapped after casting to BIGINT
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[ad_id]
    • Cleaning The column is cast to BIGINT data type
    • Output Columns:
      • ad_id: Directly mapped after casting
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_id]
    • Integration used as a key to join with the report table
    • Direct copied directly to the output
    • Output Columns:
      • ad_id: directly copied
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[ad_id]
    • Integration Used as a join key to connect with the ads table
    • Aggregation Included in the GROUP BY clause
    • Output Columns:
      • ad_id: Directly copied to the output from the joined ads table
Column Lineage
%3 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history ad_name 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report ad_name 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp name 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0
10. model.facebook_ads_source.stg_facebook_ads__ad_history
  • Input Column: 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp[name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • ad_name: Directly mapped
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_name]
    • Direct copied directly to the output
    • Output Columns:
      • ad_name: directly copied
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad clicks 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report clicks 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp inline_link_clicks 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[inline_link_clicks]
    • Cleaning The column is cleaned by applying COALESCE to handle potential NULL values
    • Output Columns:
      • clicks: Mapped after applying COALESCE and renamed
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[clicks]
    • Aggregation The column is summed up in the SELECT statement
    • Output Columns:
      • clicks: Aggregated sum in the output
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad impressions 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report impressions 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp impressions 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[impressions]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • impressions: Directly mapped
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[impressions]
    • Aggregation The column is summed up in the SELECT statement
    • Output Columns:
      • impressions: Aggregated sum in the output
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad spend 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp spend 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[spend]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • spend: Directly mapped
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[spend]
    • Aggregation The column is summed up in the SELECT statement
    • Output Columns:
      • spend: Aggregated sum in the output
3. model.facebook_ads.facebook_ads__ad_set_report

This SQL query integrates data from multiple Facebook Ads related tables (basic ad reports, account history, campaign history, ad set history, and ad history) to create a comprehensive ad set report. It filters for the most recent records in the history tables, joins these tables based on various ID fields and source relations, and then aggregates metrics like clicks, impressions, and spend at the ad set level. The result is a detailed report that includes account, campaign, and ad set information along with performance metrics.

FilteringIntegrationAggregation
SQL Query
WITH report AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__basic_ad
), accounts AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__account_history
  WHERE
    is_most_recent_record = TRUE
), campaigns AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__campaign_history
  WHERE
    is_most_recent_record = TRUE
), ad_sets AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__ad_set_history
  WHERE
    is_most_recent_record = TRUE
), ads AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__ad_history
  WHERE
    is_most_recent_record = TRUE
), joined AS (
  SELECT
    report.source_relation,
    report.date_day,
    accounts.account_id,
    accounts.account_name,
    campaigns.campaign_id,
    campaigns.campaign_name,
    ad_sets.ad_set_id,
    ad_sets.ad_set_name,
    ad_sets.start_at,
    ad_sets.end_at,
    ad_sets.bid_strategy,
    ad_sets.daily_budget,
    ad_sets.budget_remaining,
    SUM(report.clicks) AS clicks,
    SUM(report.impressions) AS impressions,
    SUM(report.spend) AS spend
  FROM report
  LEFT JOIN accounts
    ON report.account_id = accounts.account_id
    AND report.source_relation = accounts.source_relation
  LEFT JOIN ads
    ON report.ad_id = ads.ad_id AND report.source_relation = ads.source_relation
  LEFT JOIN campaigns
    ON ads.campaign_id = campaigns.campaign_id
    AND ads.source_relation = campaigns.source_relation
  LEFT JOIN ad_sets
    ON ads.ad_set_id = ad_sets.ad_set_id
    AND ads.source_relation = ad_sets.source_relation
  GROUP BY
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    11,
    12,
    13
)
SELECT
  *
FROM joined
%3 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report source_relation date_day account_id account_name campaign_id campaign_name ad_set_id ad_set_name clicks impressions spend start_at end_at bid_strategy daily_budget budget_remaining 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history source_relation account_id account_name is_most_recent_record 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0 8. model.facebook_ads_source.stg_facebook_ads__account_history:f1->3. model.facebook_ads.facebook_ads__ad_set_report:f2 8. model.facebook_ads_source.stg_facebook_ads__account_history:f2->3. model.facebook_ads.facebook_ads__ad_set_report:f3 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history source_relation ad_id account_id ad_set_id campaign_id is_most_recent_record 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history source_relation ad_set_id ad_set_name is_most_recent_record start_at end_at bid_strategy daily_budget budget_remaining 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f1->3. model.facebook_ads.facebook_ads__ad_set_report:f6 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f2->3. model.facebook_ads.facebook_ads__ad_set_report:f7 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f4->3. model.facebook_ads.facebook_ads__ad_set_report:f11 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f5->3. model.facebook_ads.facebook_ads__ad_set_report:f12 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f6->3. model.facebook_ads.facebook_ads__ad_set_report:f13 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f7->3. model.facebook_ads.facebook_ads__ad_set_report:f14 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f8->3. model.facebook_ads.facebook_ads__ad_set_report:f15 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad source_relation ad_id date_day account_id impressions clicks spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f2->3. model.facebook_ads.facebook_ads__ad_set_report:f1 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f4->3. model.facebook_ads.facebook_ads__ad_set_report:f9 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f5->3. model.facebook_ads.facebook_ads__ad_set_report:f8 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f6->3. model.facebook_ads.facebook_ads__ad_set_report:f10 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history source_relation campaign_id campaign_name is_most_recent_record status 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f1->3. model.facebook_ads.facebook_ads__ad_set_report:f4 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f2->3. model.facebook_ads.facebook_ads__ad_set_report:f5
Name Type Comment
source_relation text The source of the record if the unioning functionality is being used. If not this field will be empty.
date_day date The date of the performance.
account_id bigint The ID of the related account.
account_name text The name of the related account.
campaign_id bigint The ID of the related campaign.
campaign_name text The name of the related campaign.
ad_set_id bigint The ID of the related ad set.
ad_set_name text The name of the related ad set.
clicks bigint The number of clicks the ad had on the given day.
impressions bigint The number of impressions the ad had on the given day.
spend double precision The spend on the ad in the given day.
start_at timestamp without time zone None
end_at timestamp without time zone None
bid_strategy text None
daily_budget integer None
budget_remaining integer None
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history source_relation 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report source_relation 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history source_relation 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history source_relation 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad source_relation 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[source_relation]
    • Integration used as part of the join condition with the report table
    • Direct directly copied to the output
    • Output Columns:
      • source_relation: directly copied
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[source_relation]
    • Integration used as a key to join with other tables
    • Output Columns:
      • source_relation: directly copied to output
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[source_relation]
    • Integration used as part of the join condition with other tables
    • Direct directly copied to the output
    • Output Columns:
      • source_relation: directly copied
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join condition with other tables
    • Aggregation Included in the GROUP BY clause
    • Output Columns:
      • source_relation: Directly copied to the output
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad date_day 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report date_day 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp date 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[date]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • date_day: Directly mapped and renamed
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[date_day]
    • Direct The column is directly copied without any transformation
    • Aggregation Included in the GROUP BY clause
    • Output Columns:
      • date_day: Directly copied to the output
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history account_id 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report account_id 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp id 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f0->8. model.facebook_ads_source.stg_facebook_ads__account_history:f0
8. model.facebook_ads_source.stg_facebook_ads__account_history
  • Input Column: 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp[id]
    • Cleaning The column is cast to BIGINT
    • Deduplication Used in the ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • account_id: Directly mapped after casting to BIGINT
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_id]
    • Integration used as the key to join with the report table
    • Direct directly copied to the output
    • Output Columns:
      • account_id: directly copied
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history account_name 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report account_name 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp name 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f0->8. model.facebook_ads_source.stg_facebook_ads__account_history:f0
8. model.facebook_ads_source.stg_facebook_ads__account_history
  • Input Column: 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp[name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • account_name: Directly mapped
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_name]
    • Direct directly copied to the output
    • Output Columns:
      • account_name: directly copied
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history campaign_id 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report campaign_id 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp id 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f0->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0
16. model.facebook_ads_source.stg_facebook_ads__campaign_history
  • Input Column: 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp[id]
    • Cleaning Cast to BIGINT data type
    • Deduplication Used in the ROW_NUMBER() window function to identify the most recent record
    • Output Columns:
      • campaign_id: Directly mapped after casting to BIGINT
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_id]
    • Integration used as the key to join with the ads table
    • Direct directly copied to the output
    • Output Columns:
      • campaign_id: directly copied
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history campaign_name 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report campaign_name 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp name 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f0->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0
16. model.facebook_ads_source.stg_facebook_ads__campaign_history
  • Input Column: 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp[name]
    • Direct Copied without transformation
    • Output Columns:
      • campaign_name: Directly mapped
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_name]
    • Direct directly copied to the output
    • Output Columns:
      • campaign_name: directly copied
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history ad_set_id 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report ad_set_id 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp id 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f0->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0
12. model.facebook_ads_source.stg_facebook_ads__ad_set_history
  • Input Column: 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp[id]
    • Cleaning The column is cast to BIGINT
    • Deduplication Used in the ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • ad_set_id: Directly mapped after casting to BIGINT
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[ad_set_id]
    • Integration used as the key to join with the ads table
    • Direct directly copied to the output
    • Output Columns:
      • ad_set_id: directly copied
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history ad_set_name 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report ad_set_name 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp name 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f0->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0
12. model.facebook_ads_source.stg_facebook_ads__ad_set_history
  • Input Column: 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp[name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • ad_set_name: Directly mapped
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[ad_set_name]
    • Direct directly copied to the output
    • Output Columns:
      • ad_set_name: directly copied
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad clicks 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report clicks 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp inline_link_clicks 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[inline_link_clicks]
    • Cleaning The column is cleaned by applying COALESCE to handle potential NULL values
    • Output Columns:
      • clicks: Mapped after applying COALESCE and renamed
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[clicks]
    • Aggregation The column is summed up in the SELECT statement
    • Output Columns:
      • clicks: Aggregated sum in the output
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad impressions 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report impressions 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp impressions 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[impressions]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • impressions: Directly mapped
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[impressions]
    • Aggregation The column is summed up in the SELECT statement
    • Output Columns:
      • impressions: Aggregated sum in the output
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad spend 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp spend 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[spend]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • spend: Directly mapped
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[spend]
    • Aggregation The column is summed up in the SELECT statement
    • Output Columns:
      • spend: Aggregated sum in the output
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history start_at 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report start_at 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[start_at]
    • Direct directly copied to the output
    • Output Columns:
      • start_at: directly copied
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history end_at 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report end_at 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[end_at]
    • Direct directly copied to the output
    • Output Columns:
      • end_at: directly copied
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history bid_strategy 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report bid_strategy 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[bid_strategy]
    • Direct directly copied to the output
    • Output Columns:
      • bid_strategy: directly copied
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history daily_budget 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report daily_budget 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[daily_budget]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • daily_budget: Directly copied to the output
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history budget_remaining 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report budget_remaining 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[budget_remaining]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • budget_remaining: Directly copied to the output
4. model.facebook_ads.facebook_ads__campaign_report

This SQL query combines data from multiple Facebook Ads-related tables to create a comprehensive campaign report. It joins account, campaign, and ad data with the basic ad report, filtering for the most recent records in history tables. The query then aggregates clicks, impressions, and spend data at the campaign level, providing a detailed view of campaign performance along with account and campaign details.

FilteringIntegrationAggregation
SQL Query
WITH report AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__basic_ad
), accounts AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__account_history
  WHERE
    is_most_recent_record = TRUE
), campaigns AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__campaign_history
  WHERE
    is_most_recent_record = TRUE
), ads AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__ad_history
  WHERE
    is_most_recent_record = TRUE
), joined AS (
  SELECT
    report.source_relation,
    report.date_day,
    accounts.account_id,
    accounts.account_name,
    campaigns.campaign_id,
    campaigns.campaign_name,
    campaigns.start_at,
    campaigns.end_at,
    campaigns.status,
    campaigns.daily_budget,
    campaigns.lifetime_budget,
    campaigns.budget_remaining,
    SUM(report.clicks) AS clicks,
    SUM(report.impressions) AS impressions,
    SUM(report.spend) AS spend
  FROM report
  LEFT JOIN accounts
    ON report.account_id = accounts.account_id
    AND report.source_relation = accounts.source_relation
  LEFT JOIN ads
    ON report.ad_id = ads.ad_id AND report.source_relation = ads.source_relation
  LEFT JOIN campaigns
    ON ads.campaign_id = campaigns.campaign_id
    AND ads.source_relation = campaigns.source_relation
  GROUP BY
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    11,
    12
)
SELECT
  *
FROM joined
%3 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report source_relation date_day account_id account_name campaign_id campaign_name clicks impressions spend start_at end_at status daily_budget lifetime_budget budget_remaining 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history source_relation account_id account_name is_most_recent_record 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 8. model.facebook_ads_source.stg_facebook_ads__account_history:f1->4. model.facebook_ads.facebook_ads__campaign_report:f2 8. model.facebook_ads_source.stg_facebook_ads__account_history:f2->4. model.facebook_ads.facebook_ads__campaign_report:f3 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history source_relation ad_id campaign_id is_most_recent_record 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad source_relation ad_id date_day account_id impressions clicks spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f2->4. model.facebook_ads.facebook_ads__campaign_report:f1 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f3->4. model.facebook_ads.facebook_ads__campaign_report:f2 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f4->4. model.facebook_ads.facebook_ads__campaign_report:f7 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f5->4. model.facebook_ads.facebook_ads__campaign_report:f6 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f6->4. model.facebook_ads.facebook_ads__campaign_report:f8 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history source_relation campaign_id account_id campaign_name is_most_recent_record start_at end_at daily_budget budget_remaining lifetime_budget status 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f1->4. model.facebook_ads.facebook_ads__campaign_report:f4 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f3->4. model.facebook_ads.facebook_ads__campaign_report:f5 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f5->4. model.facebook_ads.facebook_ads__campaign_report:f9 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f6->4. model.facebook_ads.facebook_ads__campaign_report:f10 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f7->4. model.facebook_ads.facebook_ads__campaign_report:f12 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f8->4. model.facebook_ads.facebook_ads__campaign_report:f14 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f9->4. model.facebook_ads.facebook_ads__campaign_report:f13 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f10->4. model.facebook_ads.facebook_ads__campaign_report:f11
Name Type Comment
source_relation text The source of the record if the unioning functionality is being used. If not this field will be empty.
date_day date The date of the performance.
account_id bigint The ID of the related account.
account_name text The name of the related account.
campaign_id bigint The ID of the related campaign.
campaign_name text The name of the related campaign.
clicks bigint The number of clicks the ad had on the given day.
impressions bigint The number of impressions the ad had on the given day.
spend double precision The spend on the ad in the given day.
start_at timestamp without time zone None
end_at timestamp without time zone None
status text None
daily_budget integer None
lifetime_budget integer None
budget_remaining double precision None
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history source_relation 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report source_relation 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history source_relation 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad source_relation 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history source_relation 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join tables
    • Output Columns:
      • source_relation: Directly copied
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[source_relation]
    • Integration used as part of the join condition with other tables
    • Direct copied directly to the output
    • Output Columns:
      • source_relation: directly copied
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with other tables
    • Aggregation Part of the GROUP BY clause
    • Output Columns:
      • source_relation: Directly copied to the output
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[source_relation]
    • Integration used as part of the join condition with other tables
    • Direct directly copied to the output
    • Output Columns:
      • source_relation: directly copied
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad date_day 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report date_day 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp date 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[date]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • date_day: Directly mapped and renamed
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[date_day]
    • Direct The column is directly copied without any transformation
    • Aggregation Part of the GROUP BY clause
    • Output Columns:
      • date_day: Directly copied to the output
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history account_id 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report account_id 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad account_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp id 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f0->8. model.facebook_ads_source.stg_facebook_ads__account_history:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp account_id 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
8. model.facebook_ads_source.stg_facebook_ads__account_history
  • Input Column: 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp[id]
    • Cleaning The column is cast to BIGINT
    • Deduplication Used in the ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • account_id: Directly mapped after casting to BIGINT
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[account_id]
    • Cleaning The column is cast to BIGINT data type
    • Output Columns:
      • account_id: Directly mapped after casting
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join tables
    • Output Columns:
      • account_id: Directly copied
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[account_id]
    • Integration Used as a key to join with the accounts table
    • Output Columns:
      • account_id: Indirectly mapped through the join with accounts table
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history account_name 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report account_name 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp name 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f0->8. model.facebook_ads_source.stg_facebook_ads__account_history:f0
8. model.facebook_ads_source.stg_facebook_ads__account_history
  • Input Column: 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp[name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • account_name: Directly mapped
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • account_name: Directly copied
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history campaign_id 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report campaign_id 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp id 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f0->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0
16. model.facebook_ads_source.stg_facebook_ads__campaign_history
  • Input Column: 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp[id]
    • Cleaning Cast to BIGINT data type
    • Deduplication Used in the ROW_NUMBER() window function to identify the most recent record
    • Output Columns:
      • campaign_id: Directly mapped after casting to BIGINT
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_id]
    • Integration used as the key to join with the ads table
    • Direct directly copied to the output
    • Output Columns:
      • campaign_id: directly copied
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history campaign_name 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report campaign_name 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp name 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f0->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0
16. model.facebook_ads_source.stg_facebook_ads__campaign_history
  • Input Column: 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp[name]
    • Direct Copied without transformation
    • Output Columns:
      • campaign_name: Directly mapped
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_name]
    • Direct directly copied to the output
    • Output Columns:
      • campaign_name: directly copied
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad clicks 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report clicks 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp inline_link_clicks 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[inline_link_clicks]
    • Cleaning The column is cleaned by applying COALESCE to handle potential NULL values
    • Output Columns:
      • clicks: Mapped after applying COALESCE and renamed
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[clicks]
    • Aggregation The column is aggregated using SUM function
    • Output Columns:
      • clicks: Aggregated sum in the output
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad impressions 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report impressions 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp impressions 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[impressions]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • impressions: Directly mapped
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[impressions]
    • Aggregation The column is aggregated using SUM function
    • Output Columns:
      • impressions: Aggregated sum in the output
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad spend 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp spend 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[spend]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • spend: Directly mapped
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[spend]
    • Aggregation The column is aggregated using SUM function
    • Output Columns:
      • spend: Aggregated sum in the output
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history start_at 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report start_at 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[start_at]
    • Direct directly copied to the output
    • Output Columns:
      • start_at: directly copied
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history end_at 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report end_at 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[end_at]
    • Direct directly copied to the output
    • Output Columns:
      • end_at: directly copied
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history status 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report status 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[status]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the ads table
    • Output Columns:
      • status: Directly copied to the output
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history daily_budget 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report daily_budget 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[daily_budget]
    • Direct directly copied to the output
    • Output Columns:
      • daily_budget: directly copied
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history lifetime_budget 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report lifetime_budget 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[lifetime_budget]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the ads table
    • Output Columns:
      • lifetime_budget: Directly copied to the output
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history budget_remaining 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report budget_remaining 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[budget_remaining]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the ads table
    • Output Columns:
      • budget_remaining: Directly copied to the output
5. model.facebook_ads.facebook_ads__url_report

This SQL query integrates data from various Facebook Ads-related tables to create a comprehensive URL report. It joins information from ad accounts, campaigns, ad sets, ads, and creatives, focusing on URLs associated with the ads. The query filters out records where the URL is null, aggregates metrics like clicks, impressions, and spend, and groups the results by various dimensions including date, account, campaign, ad set, ad, and URL-related fields.

IntegrationFilteringAggregation
SQL Query
WITH report AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__basic_ad
), creatives AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads.int_facebook_ads__creative_history
), accounts AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__account_history
  WHERE
    is_most_recent_record = TRUE
), ads AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__ad_history
  WHERE
    is_most_recent_record = TRUE
), ad_sets AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__ad_set_history
  WHERE
    is_most_recent_record = TRUE
), campaigns AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__campaign_history
  WHERE
    is_most_recent_record = TRUE
), joined AS (
  SELECT
    report.source_relation,
    report.date_day,
    accounts.account_id,
    accounts.account_name,
    campaigns.campaign_id,
    campaigns.campaign_name,
    ad_sets.ad_set_id,
    ad_sets.ad_set_name,
    ads.ad_id,
    ads.ad_name,
    creatives.creative_id,
    creatives.creative_name,
    creatives.base_url,
    creatives.url_host,
    creatives.url_path,
    creatives.utm_source,
    creatives.utm_medium,
    creatives.utm_campaign,
    creatives.utm_content,
    creatives.utm_term,
    SUM(report.clicks) AS clicks,
    SUM(report.impressions) AS impressions,
    SUM(report.spend) AS spend
  FROM report
  LEFT JOIN ads
    ON report.ad_id = ads.ad_id AND report.source_relation = ads.source_relation
  LEFT JOIN creatives
    ON ads.creative_id = creatives.creative_id
    AND ads.source_relation = creatives.source_relation
  LEFT JOIN ad_sets
    ON ads.ad_set_id = ad_sets.ad_set_id
    AND ads.source_relation = ad_sets.source_relation
  LEFT JOIN campaigns
    ON ads.campaign_id = campaigns.campaign_id
    AND ads.source_relation = campaigns.source_relation
  LEFT JOIN accounts
    ON report.account_id = accounts.account_id
    AND report.source_relation = accounts.source_relation
  WHERE
    NOT creatives.url IS NULL
  GROUP BY
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    11,
    12,
    13,
    14,
    15,
    16,
    17,
    18,
    19,
    20
)
SELECT
  *
FROM joined
%3 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report source_relation date_day account_id account_name campaign_id campaign_name ad_set_id ad_set_name ad_id ad_name creative_id creative_name base_url url_host url_path utm_source utm_medium utm_campaign utm_content utm_term clicks impressions spend 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history source_relation creative_id creative_name url base_url url_host url_path utm_source utm_medium utm_campaign utm_content utm_term 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 7. model.facebook_ads.int_facebook_ads__creative_history:f1->5. model.facebook_ads.facebook_ads__url_report:f10 7. model.facebook_ads.int_facebook_ads__creative_history:f2->5. model.facebook_ads.facebook_ads__url_report:f11 7. model.facebook_ads.int_facebook_ads__creative_history:f4->5. model.facebook_ads.facebook_ads__url_report:f12 7. model.facebook_ads.int_facebook_ads__creative_history:f5->5. model.facebook_ads.facebook_ads__url_report:f13 7. model.facebook_ads.int_facebook_ads__creative_history:f6->5. model.facebook_ads.facebook_ads__url_report:f14 7. model.facebook_ads.int_facebook_ads__creative_history:f7->5. model.facebook_ads.facebook_ads__url_report:f15 7. model.facebook_ads.int_facebook_ads__creative_history:f8->5. model.facebook_ads.facebook_ads__url_report:f16 7. model.facebook_ads.int_facebook_ads__creative_history:f9->5. model.facebook_ads.facebook_ads__url_report:f17 7. model.facebook_ads.int_facebook_ads__creative_history:f10->5. model.facebook_ads.facebook_ads__url_report:f18 7. model.facebook_ads.int_facebook_ads__creative_history:f11->5. model.facebook_ads.facebook_ads__url_report:f19 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history source_relation account_id account_name is_most_recent_record 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 8. model.facebook_ads_source.stg_facebook_ads__account_history:f1->5. model.facebook_ads.facebook_ads__url_report:f2 8. model.facebook_ads_source.stg_facebook_ads__account_history:f2->5. model.facebook_ads.facebook_ads__url_report:f3 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history source_relation ad_id ad_set_id campaign_id creative_id ad_name is_most_recent_record 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f1->5. model.facebook_ads.facebook_ads__url_report:f8 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f5->5. model.facebook_ads.facebook_ads__url_report:f9 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history source_relation ad_set_id ad_set_name is_most_recent_record status 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f1->5. model.facebook_ads.facebook_ads__url_report:f6 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f2->5. model.facebook_ads.facebook_ads__url_report:f7 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad source_relation ad_id date_day account_id impressions clicks spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f1->5. model.facebook_ads.facebook_ads__url_report:f8 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f2->5. model.facebook_ads.facebook_ads__url_report:f1 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f3->5. model.facebook_ads.facebook_ads__url_report:f2 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f4->5. model.facebook_ads.facebook_ads__url_report:f21 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f5->5. model.facebook_ads.facebook_ads__url_report:f20 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f6->5. model.facebook_ads.facebook_ads__url_report:f22 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history source_relation campaign_id campaign_name is_most_recent_record status 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f1->5. model.facebook_ads.facebook_ads__url_report:f4 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f2->5. model.facebook_ads.facebook_ads__url_report:f5
Name Type Comment
source_relation text The source of the record if the unioning functionality is being used. If not this field will be empty.
date_day date The date of the performance.
account_id bigint The ID of the related account.
account_name text The name of the related account.
campaign_id bigint The ID of the related campaign.
campaign_name text The name of the related campaign.
ad_set_id bigint The ID of the related ad set.
ad_set_name text The name of the related ad set.
ad_id bigint The ID of the related ad.
ad_name text The name of the related ad.
creative_id bigint The ID of the related creative.
creative_name text The name of the related creative.
base_url text The base URL of the ad, extracted from the page_link and template_page_link.
url_host text The URL host of the ad, extracted from the page_link and template_page_link.
url_path text The URL path of the ad, extracted from the page_link and template_page_link.
utm_source text The utm_source parameter of the ad, extracted from the page_link and template_page_link.
utm_medium text The utm_medium parameter of the ad, extracted from the page_link and template_page_link.
utm_campaign text The utm_campaign parameter of the ad, extracted from the page_link and template_page_link.
utm_content text The utm_content parameter of the ad, extracted from the page_link and template_page_link.
utm_term text The utm_term parameter of the ad, extracted from the page_link and template_page_link.
clicks bigint The number of clicks the ad had on the given day.
impressions bigint The number of impressions the ad had on the given day.
spend double precision The spend on the ad in the given day.
Column Lineage
%3 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history source_relation 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report source_relation 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history source_relation 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history source_relation 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history source_relation 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad source_relation 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history source_relation 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags source_relation 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history source_relation 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f0
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[source_relation]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • source_relation: Directly copied
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[source_relation]
    • Integration Used to join with the base table
    • Direct Directly selected in the final output
    • Output Columns:
      • source_relation: Directly copied to the output
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join condition with url_tags_pivoted
    • Output Columns:
      • source_relation: Directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[source_relation]
    • Direct The column is directly copied without transformation
    • Integration Used as part of the join condition with other tables
    • Output Columns:
      • source_relation: Directly copied to the output
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[source_relation]
    • Integration Used as part of the join condition with the report table
    • Direct Directly copied to the output
    • Output Columns:
      • source_relation: Directly copied
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[source_relation]
    • Integration used as part of the join condition with other tables
    • Direct copied directly to the output
    • Output Columns:
      • source_relation: directly copied
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[source_relation]
    • Integration used as part of the join condition with other tables
    • Direct directly copied to the output
    • Output Columns:
      • source_relation: directly copied
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join conditions with other tables
    • Output Columns:
      • source_relation: Directly copied to the output
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[source_relation]
    • Integration used to join with other tables
    • Filtering used in the WHERE clause to ensure consistency across joins
    • Output Columns:
      • source_relation: directly copied to output
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad date_day 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report date_day 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp date 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[date]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • date_day: Directly mapped and renamed
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[date_day]
    • Direct The column is directly copied without any transformation
    • Aggregation Used in the GROUP BY clause
    • Output Columns:
      • date_day: Directly copied to the output
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history account_id 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report account_id 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad account_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp id 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f0->8. model.facebook_ads_source.stg_facebook_ads__account_history:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp account_id 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
8. model.facebook_ads_source.stg_facebook_ads__account_history
  • Input Column: 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp[id]
    • Cleaning The column is cast to BIGINT
    • Deduplication Used in the ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • account_id: Directly mapped after casting to BIGINT
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[account_id]
    • Cleaning The column is cast to BIGINT data type
    • Output Columns:
      • account_id: Directly mapped after casting
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_id]
    • Integration Used as part of the join condition with the report table
    • Direct Directly copied to the output
    • Output Columns:
      • account_id: Directly copied
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[account_id]
    • Integration Used as a key to join with the accounts table
    • Output Columns:
      • account_id: Indirectly mapped through the join with accounts table
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history account_name 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report account_name 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp name 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f0->8. model.facebook_ads_source.stg_facebook_ads__account_history:f0
8. model.facebook_ads_source.stg_facebook_ads__account_history
  • Input Column: 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp[name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • account_name: Directly mapped
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_name]
    • Direct Directly copied to the output
    • Output Columns:
      • account_name: Directly copied
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history campaign_id 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report campaign_id 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp id 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f0->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0
16. model.facebook_ads_source.stg_facebook_ads__campaign_history
  • Input Column: 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp[id]
    • Cleaning Cast to BIGINT data type
    • Deduplication Used in the ROW_NUMBER() window function to identify the most recent record
    • Output Columns:
      • campaign_id: Directly mapped after casting to BIGINT
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_id]
    • Integration used to join with the ads table
    • Filtering used in the WHERE clause to ensure consistency across joins
    • Output Columns:
      • campaign_id: directly copied to output
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history campaign_name 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report campaign_name 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp name 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f0->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0
16. model.facebook_ads_source.stg_facebook_ads__campaign_history
  • Input Column: 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp[name]
    • Direct Copied without transformation
    • Output Columns:
      • campaign_name: Directly mapped
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_name]
    • Direct copied without transformation
    • Output Columns:
      • campaign_name: directly copied to output
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history ad_set_id 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report ad_set_id 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp id 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f0->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0
12. model.facebook_ads_source.stg_facebook_ads__ad_set_history
  • Input Column: 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp[id]
    • Cleaning The column is cast to BIGINT
    • Deduplication Used in the ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • ad_set_id: Directly mapped after casting to BIGINT
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[ad_set_id]
    • Integration used as the key to join with the report table
    • Direct directly copied to the output
    • Output Columns:
      • ad_set_id: directly copied
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history ad_set_name 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report ad_set_name 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp name 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f0->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0
12. model.facebook_ads_source.stg_facebook_ads__ad_set_history
  • Input Column: 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp[name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • ad_set_name: Directly mapped
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[ad_set_name]
    • Direct directly copied to the output
    • Output Columns:
      • ad_set_name: directly copied
Column Lineage
%3 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history ad_id 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report ad_id 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad ad_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp id 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp ad_id 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
10. model.facebook_ads_source.stg_facebook_ads__ad_history
  • Input Column: 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp[id]
    • Cleaning The column is cast to BIGINT
    • Deduplication Used in ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • ad_id: Directly mapped after casting to BIGINT
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[ad_id]
    • Cleaning The column is cast to BIGINT data type
    • Output Columns:
      • ad_id: Directly mapped after casting
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_id]
    • Integration used as the key to join with the report table
    • Direct copied directly to the output
    • Output Columns:
      • ad_id: directly copied
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[ad_id]
    • Integration Used as a key to join with the ads table
    • Output Columns:
      • ad_id: Indirectly mapped through the join with ads table
Column Lineage
%3 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history ad_name 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report ad_name 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp name 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0
10. model.facebook_ads_source.stg_facebook_ads__ad_history
  • Input Column: 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp[name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • ad_name: Directly mapped
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_name]
    • Direct copied directly to the output
    • Output Columns:
      • ad_name: directly copied
Column Lineage
%3 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history creative_id 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report creative_id 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags creative_id 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history creative_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp id 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[creative_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • creative_id: Directly copied
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[id]
    • Cleaning The column is cast as BIGINT
    • Deduplication Used in the window function to determine the most recent record
    • Output Columns:
      • creative_id: Mapped after casting to BIGINT
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[creative_id]
    • Integration Used to join with the base table
    • Aggregation Used in GROUP BY clause
    • Output Columns:
      • creative_id: Directly copied to the output
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[creative_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join condition with url_tags_pivoted
    • Output Columns:
      • creative_id: Directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[creative_id]
    • Direct The column is directly copied without transformation
    • Integration Used as the key to join with the ads table
    • Output Columns:
      • creative_id: Directly copied to the output
Column Lineage
%3 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history creative_name 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report creative_name 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history creative_name 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp name 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[name]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • creative_name: Renamed and directly mapped
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[creative_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • creative_name: Directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[creative_name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • creative_name: Directly copied to the output
Column Lineage
%3 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report base_url 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link page_link template_page_link 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link page_link template_page_link 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f1->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f2->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[base_url]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • base_url: Directly copied to the output
Column Lineage
%3 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report url_host 7. model.facebook_ads.int_facebook_ads__creative_history:f2->5. model.facebook_ads.facebook_ads__url_report:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link page_link template_page_link 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link page_link template_page_link 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f1->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f2->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url_host]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • url_host: Directly copied to the output
Column Lineage
%3 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report url_path 7. model.facebook_ads.int_facebook_ads__creative_history:f3->5. model.facebook_ads.facebook_ads__url_report:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link page_link template_page_link 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link page_link template_page_link 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f1->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f2->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url_path]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • url_path: Directly copied to the output
Column Lineage
%3 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report utm_source 7. model.facebook_ads.int_facebook_ads__creative_history:f7->5. model.facebook_ads.facebook_ads__url_report:f0 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags key type value 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link page_link template_page_link url_tags 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link page_link template_page_link url_tags 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f1->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f2->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f3->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[key]
    • Featurization Used to pivot the data, extracting different UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[value]
    • Featurization Used as the value for the pivoted UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_source]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • utm_source: Directly copied to the output
Column Lineage
%3 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report utm_medium 7. model.facebook_ads.int_facebook_ads__creative_history:f6->5. model.facebook_ads.facebook_ads__url_report:f0 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags key type value 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link page_link template_page_link url_tags 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link page_link template_page_link url_tags 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f1->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f2->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f3->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[key]
    • Featurization Used to pivot the data, extracting different UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[value]
    • Featurization Used as the value for the pivoted UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_medium]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_medium: Directly copied to the output
Column Lineage
%3 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report utm_campaign 7. model.facebook_ads.int_facebook_ads__creative_history:f4->5. model.facebook_ads.facebook_ads__url_report:f0 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags key type value 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link page_link template_page_link url_tags 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link page_link template_page_link url_tags 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f1->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f2->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f3->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[key]
    • Featurization Used to pivot the data, extracting different UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[value]
    • Featurization Used as the value for the pivoted UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_campaign]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_campaign: Directly copied to the output
Column Lineage
%3 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report utm_content 7. model.facebook_ads.int_facebook_ads__creative_history:f5->5. model.facebook_ads.facebook_ads__url_report:f0 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags key type value 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link page_link template_page_link url_tags 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link page_link template_page_link url_tags 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f1->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f2->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f3->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[key]
    • Featurization Used to pivot the data, extracting different UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[value]
    • Featurization Used as the value for the pivoted UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_content]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_content: Directly copied to the output
Column Lineage
%3 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report utm_term 7. model.facebook_ads.int_facebook_ads__creative_history:f8->5. model.facebook_ads.facebook_ads__url_report:f0 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags key type value 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link page_link template_page_link url_tags 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link page_link template_page_link url_tags 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f1->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f2->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f3->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[key]
    • Featurization Used to pivot the data, extracting different UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[value]
    • Featurization Used as the value for the pivoted UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_term]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_term: Directly copied to the output
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad clicks 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report clicks 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp inline_link_clicks 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[inline_link_clicks]
    • Cleaning The column is cleaned by applying COALESCE to handle potential NULL values
    • Output Columns:
      • clicks: Mapped after applying COALESCE and renamed
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[clicks]
    • Aggregation Summed up in the SELECT clause
    • Output Columns:
      • clicks: Aggregated sum in the output
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad impressions 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report impressions 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp impressions 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[impressions]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • impressions: Directly mapped
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[impressions]
    • Aggregation Summed up in the SELECT clause
    • Output Columns:
      • impressions: Aggregated sum in the output
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad spend 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp spend 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[spend]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • spend: Directly mapped
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[spend]
    • Aggregation Summed up in the SELECT clause
    • Output Columns:
      • spend: Aggregated sum in the output
6. model.facebook_ads.facebook_ads__url_tags

This SQL query processes Facebook ads creative history data, focusing on URL tags. It starts by selecting the most recent records, then filters for non-null URL tags. The query then parses the JSON-formatted URL tags, flattens the structure, and extracts key-value pairs along with their types from the URL tags.

FilteringCleaningFeaturization
SQL Query
with base as (

    select *
    from TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__creative_history
    where is_most_recent_record = true
), 

required_fields as (

    select
        source_relation,
        _fivetran_id,
        creative_id,
        url_tags
    from base
    where url_tags is not null
), 



  cleaned_fields as (

      select
          source_relation,
          _fivetran_id,
          creative_id,
          parse_json(url_tags) as url_tags
      from required_fields
      where url_tags is not null
  ), 

  fields as (

      select
          source_relation,
          _fivetran_id,
          creative_id,
          url_tags.value:key::string as key,
          url_tags.value:value::string as value,
          url_tags.value:type::string as type
      from cleaned_fields,
      lateral flatten( input => url_tags ) as url_tags
  )

 

select *
from fields
%3 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags source_relation _fivetran_id creative_id key value type 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history source_relation _fivetran_id creative_id url_tags is_most_recent_record 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->6. model.facebook_ads.facebook_ads__url_tags:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f5
Name Type Comment
source_relation text The source of the record if the unioning functionality is being used. If not this field will be empty.
_fivetran_id text The unique fivetran ID for this record.
creative_id bigint The associated creative_id for this record.
key text The url tag object name e.g. utm_source associated with this record.
value text The value assigned to the url tag object associated with this record.
type text The type assigned to the url tag object e.g. 'AD_VIDEO'.
Column Lineage
%3 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history source_relation 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags source_relation 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f0 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history source_relation 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report source_relation 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[source_relation]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • source_relation: Directly copied
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[source_relation]
    • Integration Used to join with the base table
    • Direct Directly selected in the final output
    • Output Columns:
      • source_relation: Directly copied to the output
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[source_relation]
    • Direct The column is directly copied without transformation
    • Integration Used as part of the join condition with other tables
    • Output Columns:
      • source_relation: Directly copied to the output
Column Lineage
%3 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history _fivetran_id is_most_recent_record 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags _fivetran_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f0 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:header 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp _fivetran_id 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[_fivetran_id]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Deduplication This column is used in the window function to determine the most recent record
    • Output Columns:
      • _fivetran_id: Directly mapped to this output column
      • is_most_recent_record: Indirectly used to determine this flag
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[_fivetran_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_id: Directly copied
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[_fivetran_id]
    • Integration Used to join with the base table
    • Aggregation Used in GROUP BY clause
Column Lineage
%3 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history creative_id 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags creative_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f0 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history creative_id 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp id 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report creative_id 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[id]
    • Cleaning The column is cast as BIGINT
    • Deduplication Used in the window function to determine the most recent record
    • Output Columns:
      • creative_id: Mapped after casting to BIGINT
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[creative_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • creative_id: Directly copied
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[creative_id]
    • Integration Used to join with the base table
    • Aggregation Used in GROUP BY clause
    • Output Columns:
      • creative_id: Directly copied to the output
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[creative_id]
    • Direct The column is directly copied without transformation
    • Integration Used as the key to join with the ads table
    • Output Columns:
      • creative_id: Directly copied to the output
Column Lineage
%3 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history url_tags 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags key type value 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f1 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history utm_campaign utm_content utm_medium utm_source utm_term 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp url_tags 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report utm_campaign utm_content utm_medium utm_source utm_term 7. model.facebook_ads.int_facebook_ads__creative_history:f3->5. model.facebook_ads.facebook_ads__url_report:f3 7. model.facebook_ads.int_facebook_ads__creative_history:f2->5. model.facebook_ads.facebook_ads__url_report:f2 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 7. model.facebook_ads.int_facebook_ads__creative_history:f1->5. model.facebook_ads.facebook_ads__url_report:f1 7. model.facebook_ads.int_facebook_ads__creative_history:f4->5. model.facebook_ads.facebook_ads__url_report:f4
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[url_tags]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • url_tags: Directly mapped
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[key]
    • Featurization Used to pivot the data, extracting different UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_source]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • utm_source: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_medium]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_medium: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_campaign]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_campaign: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_content]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_content: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_term]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_term: Directly copied to the output
Column Lineage
%3 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history url_tags 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags key type value 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f1 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history utm_campaign utm_content utm_medium utm_source utm_term 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp url_tags 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report utm_campaign utm_content utm_medium utm_source utm_term 7. model.facebook_ads.int_facebook_ads__creative_history:f3->5. model.facebook_ads.facebook_ads__url_report:f3 7. model.facebook_ads.int_facebook_ads__creative_history:f2->5. model.facebook_ads.facebook_ads__url_report:f2 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 7. model.facebook_ads.int_facebook_ads__creative_history:f1->5. model.facebook_ads.facebook_ads__url_report:f1 7. model.facebook_ads.int_facebook_ads__creative_history:f4->5. model.facebook_ads.facebook_ads__url_report:f4
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[url_tags]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • url_tags: Directly mapped
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[value]
    • Featurization Used as the value for the pivoted UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_source]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • utm_source: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_medium]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_medium: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_campaign]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_campaign: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_content]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_content: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_term]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_term: Directly copied to the output
Column Lineage
%3 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history url_tags 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags key type value 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp url_tags 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[url_tags]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • url_tags: Directly mapped
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
7. model.facebook_ads.int_facebook_ads__creative_history

This SQL query processes Facebook ad creative data, focusing on URL-related information. It starts by selecting the most recent records from the creative history, then joins this with URL tag data. The query extensively cleans and extracts various components of URLs (such as base URL, host, and path) and UTM parameters. It also handles cases where UTM parameters might be directly in the URL or in a separate tags table. The result is a comprehensive view of each creative's URL structure and associated tracking parameters.

FilteringCleaningFeaturizationIntegrationOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__creative_history
  WHERE
    is_most_recent_record = TRUE
), url_tags AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads.facebook_ads__url_tags
), url_tags_pivoted AS (
  SELECT
    source_relation,
    _fivetran_id,
    creative_id,
    MIN(CASE WHEN key = 'utm_source' THEN value END) AS utm_source,
    MIN(CASE WHEN key = 'utm_medium' THEN value END) AS utm_medium,
    MIN(CASE WHEN key = 'utm_campaign' THEN value END) AS utm_campaign,
    MIN(CASE WHEN key = 'utm_content' THEN value END) AS utm_content,
    MIN(CASE WHEN key = 'utm_term' THEN value END) AS utm_term
  FROM url_tags
  GROUP BY
    1,
    2,
    3
), fields AS (
  SELECT
    base.source_relation,
    base._fivetran_id,
    base.creative_id,
    base.account_id,
    base.creative_name,
    COALESCE(page_link, template_page_link) AS url,
    SPLIT_PART(COALESCE(page_link, template_page_link), '?', 1) AS base_url,
    TRY_CAST(SPLIT_PART(
      SPLIT_PART(
        REPLACE(
          REPLACE(
            REPLACE(COALESCE(page_link, template_page_link), 'android-app://', ''),
            'http://',
            ''
          ),
          'https://',
          ''
        ),
        '/',
        1
      ),
      '?',
      1
    ) AS TEXT) AS url_host,
    '/' || TRY_CAST(SPLIT_PART(
      CASE
        WHEN LENGTH(
          REPLACE(REPLACE(COALESCE(page_link, template_page_link), 'http://', ''), 'https://', '')
        ) - COALESCE(
          NULLIF(
            STR_POSITION(
              REPLACE(REPLACE(COALESCE(page_link, template_page_link), 'http://', ''), 'https://', ''),
              '/'
            ),
            0
          ),
          STR_POSITION(
            REPLACE(REPLACE(COALESCE(page_link, template_page_link), 'http://', ''), 'https://', ''),
            '?'
          ) - 1
        ) = 0
        THEN ''
        ELSE RIGHT(
          REPLACE(REPLACE(COALESCE(page_link, template_page_link), 'http://', ''), 'https://', ''),
          LENGTH(
            REPLACE(REPLACE(COALESCE(page_link, template_page_link), 'http://', ''), 'https://', '')
          ) - COALESCE(
            NULLIF(
              STR_POSITION(
                REPLACE(REPLACE(COALESCE(page_link, template_page_link), 'http://', ''), 'https://', ''),
                '/'
              ),
              0
            ),
            STR_POSITION(
              REPLACE(REPLACE(COALESCE(page_link, template_page_link), 'http://', ''), 'https://', ''),
              '?'
            ) - 1
          )
        )
      END,
      '?',
      1
    ) AS TEXT) AS url_path,
    COALESCE(
      url_tags_pivoted.utm_source,
      NULLIF(
        SPLIT_PART(SPLIT_PART(COALESCE(page_link, template_page_link), 'utm_source=', 2), '&', 1),
        ''
      )
    ) AS utm_source,
    COALESCE(
      url_tags_pivoted.utm_medium,
      NULLIF(
        SPLIT_PART(SPLIT_PART(COALESCE(page_link, template_page_link), 'utm_medium=', 2), '&', 1),
        ''
      )
    ) AS utm_medium,
    COALESCE(
      url_tags_pivoted.utm_campaign,
      NULLIF(
        SPLIT_PART(SPLIT_PART(COALESCE(page_link, template_page_link), 'utm_campaign=', 2), '&', 1),
        ''
      )
    ) AS utm_campaign,
    COALESCE(
      url_tags_pivoted.utm_content,
      NULLIF(
        SPLIT_PART(SPLIT_PART(COALESCE(page_link, template_page_link), 'utm_content=', 2), '&', 1),
        ''
      )
    ) AS utm_content,
    COALESCE(
      url_tags_pivoted.utm_term,
      NULLIF(
        SPLIT_PART(SPLIT_PART(COALESCE(page_link, template_page_link), 'utm_term=', 2), '&', 1),
        ''
      )
    ) AS utm_term
  FROM base
  LEFT JOIN url_tags_pivoted
    ON base._fivetran_id = url_tags_pivoted._fivetran_id
    AND base.source_relation = url_tags_pivoted.source_relation
    AND base.creative_id = url_tags_pivoted.creative_id
)
SELECT
  *
FROM fields
%3 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history source_relation _fivetran_id creative_id account_id creative_name url base_url url_host url_path utm_source utm_medium utm_campaign utm_content utm_term 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags source_relation _fivetran_id creative_id key value 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 6. model.facebook_ads.facebook_ads__url_tags:f3->7. model.facebook_ads.int_facebook_ads__creative_history:f9 6. model.facebook_ads.facebook_ads__url_tags:f3->7. model.facebook_ads.int_facebook_ads__creative_history:f10 6. model.facebook_ads.facebook_ads__url_tags:f3->7. model.facebook_ads.int_facebook_ads__creative_history:f11 6. model.facebook_ads.facebook_ads__url_tags:f3->7. model.facebook_ads.int_facebook_ads__creative_history:f12 6. model.facebook_ads.facebook_ads__url_tags:f3->7. model.facebook_ads.int_facebook_ads__creative_history:f13 6. model.facebook_ads.facebook_ads__url_tags:f4->7. model.facebook_ads.int_facebook_ads__creative_history:f9 6. model.facebook_ads.facebook_ads__url_tags:f4->7. model.facebook_ads.int_facebook_ads__creative_history:f10 6. model.facebook_ads.facebook_ads__url_tags:f4->7. model.facebook_ads.int_facebook_ads__creative_history:f11 6. model.facebook_ads.facebook_ads__url_tags:f4->7. model.facebook_ads.int_facebook_ads__creative_history:f12 6. model.facebook_ads.facebook_ads__url_tags:f4->7. model.facebook_ads.int_facebook_ads__creative_history:f13 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history source_relation _fivetran_id creative_id account_id creative_name is_most_recent_record page_link template_page_link object_story_link_data_link 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f4->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f6->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f6->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f6->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f6->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f6->7. model.facebook_ads.int_facebook_ads__creative_history:f9 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f6->7. model.facebook_ads.int_facebook_ads__creative_history:f10 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f6->7. model.facebook_ads.int_facebook_ads__creative_history:f11 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f6->7. model.facebook_ads.int_facebook_ads__creative_history:f12 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f6->7. model.facebook_ads.int_facebook_ads__creative_history:f13 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f7->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f7->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f7->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f7->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f7->7. model.facebook_ads.int_facebook_ads__creative_history:f9 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f7->7. model.facebook_ads.int_facebook_ads__creative_history:f10 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f7->7. model.facebook_ads.int_facebook_ads__creative_history:f11 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f7->7. model.facebook_ads.int_facebook_ads__creative_history:f12 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f7->7. model.facebook_ads.int_facebook_ads__creative_history:f13 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f8->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f8->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f8->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f8->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f8->7. model.facebook_ads.int_facebook_ads__creative_history:f9 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f8->7. model.facebook_ads.int_facebook_ads__creative_history:f10 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f8->7. model.facebook_ads.int_facebook_ads__creative_history:f11 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f8->7. model.facebook_ads.int_facebook_ads__creative_history:f12 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f8->7. model.facebook_ads.int_facebook_ads__creative_history:f13
Name Type Comment
source_relation text None
_fivetran_id text None
creative_id bigint None
account_id bigint None
creative_name text None
url character varying None
base_url text None
url_host text None
url_path text None
utm_source text None
utm_medium text None
utm_campaign text None
utm_content text None
utm_term text None
Column Lineage
%3 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags source_relation 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history source_relation 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report source_relation 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history source_relation 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[source_relation]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • source_relation: Directly copied
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[source_relation]
    • Integration Used to join with the base table
    • Direct Directly selected in the final output
    • Output Columns:
      • source_relation: Directly copied to the output
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join condition with url_tags_pivoted
    • Output Columns:
      • source_relation: Directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[source_relation]
    • Direct The column is directly copied without transformation
    • Integration Used as part of the join condition with other tables
    • Output Columns:
      • source_relation: Directly copied to the output
Column Lineage
%3 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history _fivetran_id is_most_recent_record 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history _fivetran_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp _fivetran_id 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[_fivetran_id]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Deduplication This column is used in the window function to determine the most recent record
    • Output Columns:
      • _fivetran_id: Directly mapped to this output column
      • is_most_recent_record: Indirectly used to determine this flag
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[_fivetran_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join condition with url_tags_pivoted
    • Output Columns:
      • _fivetran_id: Directly copied
Column Lineage
%3 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags creative_id 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history creative_id 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report creative_id 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history creative_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp id 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[creative_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • creative_id: Directly copied
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[id]
    • Cleaning The column is cast as BIGINT
    • Deduplication Used in the window function to determine the most recent record
    • Output Columns:
      • creative_id: Mapped after casting to BIGINT
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[creative_id]
    • Integration Used to join with the base table
    • Aggregation Used in GROUP BY clause
    • Output Columns:
      • creative_id: Directly copied to the output
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[creative_id]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join condition with url_tags_pivoted
    • Output Columns:
      • creative_id: Directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[creative_id]
    • Direct The column is directly copied without transformation
    • Integration Used as the key to join with the ads table
    • Output Columns:
      • creative_id: Directly copied to the output
Column Lineage
%3 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history account_id 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history account_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp account_id 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[account_id]
    • Cleaning The column is cast as BIGINT
    • Output Columns:
      • account_id: Mapped after casting to BIGINT
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[account_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • account_id: Directly copied
Column Lineage
%3 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history creative_name 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history creative_name 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report creative_name 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp name 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[name]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • creative_name: Renamed and directly mapped
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[creative_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • creative_name: Directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[creative_name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • creative_name: Directly copied to the output
Column Lineage
%3 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link page_link template_page_link 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report 7. model.facebook_ads.int_facebook_ads__creative_history:f1->5. model.facebook_ads.facebook_ads__url_report:header 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link page_link template_page_link 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f1->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f2->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url]
    • Filtering Used in the WHERE clause to filter out null URLs
Column Lineage
%3 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link page_link template_page_link 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report base_url 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link page_link template_page_link 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f1->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f2->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[base_url]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • base_url: Directly copied to the output
Column Lineage
%3 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link page_link template_page_link 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report url_host 7. model.facebook_ads.int_facebook_ads__creative_history:f2->5. model.facebook_ads.facebook_ads__url_report:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link page_link template_page_link 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f1->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f2->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url_host]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • url_host: Directly copied to the output
Column Lineage
%3 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link page_link template_page_link 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report url_path 7. model.facebook_ads.int_facebook_ads__creative_history:f3->5. model.facebook_ads.facebook_ads__url_report:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link page_link template_page_link 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f1->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f2->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url_path]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • url_path: Directly copied to the output
Column Lineage
%3 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags key type value 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report utm_source 7. model.facebook_ads.int_facebook_ads__creative_history:f7->5. model.facebook_ads.facebook_ads__url_report:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link page_link template_page_link url_tags 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link page_link template_page_link url_tags 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f1->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f2->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f3->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[key]
    • Featurization Used to pivot the data, extracting different UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[value]
    • Featurization Used as the value for the pivoted UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_source]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • utm_source: Directly copied to the output
Column Lineage
%3 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags key type value 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report utm_medium 7. model.facebook_ads.int_facebook_ads__creative_history:f6->5. model.facebook_ads.facebook_ads__url_report:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link page_link template_page_link url_tags 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link page_link template_page_link url_tags 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f1->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f2->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f3->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[key]
    • Featurization Used to pivot the data, extracting different UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[value]
    • Featurization Used as the value for the pivoted UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_medium]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_medium: Directly copied to the output
Column Lineage
%3 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags key type value 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report utm_campaign 7. model.facebook_ads.int_facebook_ads__creative_history:f4->5. model.facebook_ads.facebook_ads__url_report:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link page_link template_page_link url_tags 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link page_link template_page_link url_tags 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f1->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f2->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f3->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[key]
    • Featurization Used to pivot the data, extracting different UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[value]
    • Featurization Used as the value for the pivoted UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_campaign]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_campaign: Directly copied to the output
Column Lineage
%3 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags key type value 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report utm_content 7. model.facebook_ads.int_facebook_ads__creative_history:f5->5. model.facebook_ads.facebook_ads__url_report:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link page_link template_page_link url_tags 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link page_link template_page_link url_tags 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f1->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f2->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f3->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[key]
    • Featurization Used to pivot the data, extracting different UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[value]
    • Featurization Used as the value for the pivoted UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_content]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_content: Directly copied to the output
Column Lineage
%3 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags key type value 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report utm_term 7. model.facebook_ads.int_facebook_ads__creative_history:f8->5. model.facebook_ads.facebook_ads__url_report:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link page_link template_page_link url_tags 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3->6. model.facebook_ads.facebook_ads__url_tags:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f8 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link page_link template_page_link url_tags 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f1->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f2->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f3->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[key]
    • Featurization Used to pivot the data, extracting different UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[value]
    • Featurization Used as the value for the pivoted UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_term]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_term: Directly copied to the output
8. model.facebook_ads_source.stg_facebook_ads__account_history

This SQL query stages data from a Facebook Ads account history source table. It casts fields to specific data types, renames some columns, and adds a flag to identify the most recent record for each account. The query also includes a mechanism to generate a surrogate key when the natural key (id) is missing.

CleaningDeduplicationFeaturization
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__account_history_tmp
), fields AS (
  SELECT
    CAST(NULL AS INT) AS id,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS TEXT) AS name,
    CAST(NULL AS TEXT) AS account_status,
    CAST(NULL AS TEXT) AS business_country_code,
    CAST(NULL AS TIMESTAMP) AS created_time,
    CAST(NULL AS TEXT) AS currency,
    CAST(NULL AS TEXT) AS timezone_name,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    source_relation,
    CAST(id AS BIGINT) AS account_id,
    _fivetran_synced,
    name AS account_name,
    account_status,
    business_country_code,
    created_time AS created_at,
    currency,
    timezone_name,
    CASE
      WHEN id IS NULL AND _fivetran_synced IS NULL
      THEN ROW_NUMBER() OVER (PARTITION BY source_relation ORDER BY source_relation)
      ELSE ROW_NUMBER() OVER (PARTITION BY source_relation, id ORDER BY _fivetran_synced DESC)
    END = 1 AS is_most_recent_record
  FROM fields
)
SELECT
  *
FROM final
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history source_relation account_id account_name is_most_recent_record _fivetran_synced account_status business_country_code created_at currency timezone_name 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp id name _fivetran_synced 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f0->8. model.facebook_ads_source.stg_facebook_ads__account_history:f1 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f1->8. model.facebook_ads_source.stg_facebook_ads__account_history:f2 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f2->8. model.facebook_ads_source.stg_facebook_ads__account_history:f4
Name Type Comment
source_relation text The source of the record if the unioning functionality is being used. If not this field will be empty.
account_id bigint The ID of the ad account.
account_name text Name of the account.
is_most_recent_record boolean Boolean representing whether a record is the most recent version of that record. All records should have this value set to True given we filter on it.
_fivetran_synced timestamp without time zone When the record was last synced by Fivetran.
account_status text Current status of account.
business_country_code text Country code of business associated to account.
created_at timestamp without time zone The time account was created.
currency text Currency associated with account.
timezone_name text Timezone associated with account.
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history source_relation 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report source_relation 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report source_relation 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report source_relation 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report source_relation 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report source_relation 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the report table
    • Aggregation The column is part of the GROUP BY clause
    • Output Columns:
      • source_relation: Directly copied to output
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[source_relation]
    • Integration used as part of the join condition with the report table
    • Direct directly copied to the output
    • Output Columns:
      • source_relation: directly copied
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[source_relation]
    • Integration used as part of the join condition with the report table
    • Direct directly copied to the output
    • Output Columns:
      • source_relation: directly copied
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join tables
    • Output Columns:
      • source_relation: Directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[source_relation]
    • Integration Used as part of the join condition with the report table
    • Direct Directly copied to the output
    • Output Columns:
      • source_relation: Directly copied
Column Lineage
%3 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp id 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history account_id 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f0->8. model.facebook_ads_source.stg_facebook_ads__account_history:f0 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report account_id 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report account_id 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report account_id 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report account_id 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report account_id 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
8. model.facebook_ads_source.stg_facebook_ads__account_history
  • Input Column: 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp[id]
    • Cleaning The column is cast to BIGINT
    • Deduplication Used in the ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • account_id: Directly mapped after casting to BIGINT
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the report table
    • Aggregation The column is part of the GROUP BY clause
    • Output Columns:
      • account_id: Directly copied to output
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_id]
    • Integration used as the join key with the report table
    • Direct directly copied to the output
    • Output Columns:
      • account_id: directly copied
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_id]
    • Integration used as the key to join with the report table
    • Direct directly copied to the output
    • Output Columns:
      • account_id: directly copied
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join tables
    • Output Columns:
      • account_id: Directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_id]
    • Integration Used as part of the join condition with the report table
    • Direct Directly copied to the output
    • Output Columns:
      • account_id: Directly copied
Column Lineage
%3 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp name 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history account_name 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f0->8. model.facebook_ads_source.stg_facebook_ads__account_history:f0 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report account_name 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report account_name 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report account_name 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report account_name 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report account_name 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
8. model.facebook_ads_source.stg_facebook_ads__account_history
  • Input Column: 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp[name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • account_name: Directly mapped
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_name]
    • Direct The column is directly copied without any transformation
    • Aggregation The column is part of the GROUP BY clause
    • Output Columns:
      • account_name: Directly copied to output
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_name]
    • Direct directly copied to the output
    • Output Columns:
      • account_name: directly copied
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_name]
    • Direct directly copied to the output
    • Output Columns:
      • account_name: directly copied
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • account_name: Directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_name]
    • Direct Directly copied to the output
    • Output Columns:
      • account_name: Directly copied
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history is_most_recent_record 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:header 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:header 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->5. model.facebook_ads.facebook_ads__url_report:header 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->2. model.facebook_ads.facebook_ads__ad_report:header 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:header
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[is_most_recent_record]
    • Filtering The column is used to filter for the most recent account records
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[is_most_recent_record]
    • Filtering used to filter only the most recent records
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[is_most_recent_record]
    • Filtering used to filter for the most recent record
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[is_most_recent_record]
    • Filtering The column is used to filter for the most recent records
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[is_most_recent_record]
    • Filtering Used to filter only the most recent records
Column Lineage
%3 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp _fivetran_synced 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history _fivetran_synced 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f0->8. model.facebook_ads_source.stg_facebook_ads__account_history:f0
8. model.facebook_ads_source.stg_facebook_ads__account_history
  • Input Column: 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp[_fivetran_synced]
    • Direct The column is directly copied without transformation
    • Deduplication Used in the ROW_NUMBER() function to order records and identify the most recent
    • Output Columns:
      • _fivetran_synced: Directly mapped
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history account_status 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report account_status 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_status]
    • Direct The column is directly copied without any transformation
    • Aggregation The column is part of the GROUP BY clause
    • Output Columns:
      • account_status: Directly copied to output
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history business_country_code 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report business_country_code 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[business_country_code]
    • Direct The column is directly copied without any transformation
    • Aggregation The column is part of the GROUP BY clause
    • Output Columns:
      • business_country_code: Directly copied to output
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history created_at 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report created_at 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[created_at]
    • Direct The column is directly copied without any transformation
    • Aggregation The column is part of the GROUP BY clause
    • Output Columns:
      • created_at: Directly copied to output
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history currency 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report currency 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[currency]
    • Direct The column is directly copied without any transformation
    • Aggregation The column is part of the GROUP BY clause
    • Output Columns:
      • currency: Directly copied to output
Column Lineage
%3 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history timezone_name 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report timezone_name 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[timezone_name]
    • Direct The column is directly copied without any transformation
    • Aggregation The column is part of the GROUP BY clause
    • Output Columns:
      • timezone_name: Directly copied to output
9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It's likely used as a placeholder or template for further operations in a dbt (data build tool) model.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp id name _fivetran_synced 20. source.facebook_ads_source.facebook_ads.account_history 20. source.facebook_ads_source.facebook_ads.account_history
Name Type Comment
id bigint None
name text None
_fivetran_synced timestamp without time zone None
Column Lineage
%3 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp id 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history account_id 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f0->8. model.facebook_ads_source.stg_facebook_ads__account_history:f0 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report account_id 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report account_id 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report account_id 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report account_id 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report account_id 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
8. model.facebook_ads_source.stg_facebook_ads__account_history
  • Input Column: 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp[id]
    • Cleaning The column is cast to BIGINT
    • Deduplication Used in the ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • account_id: Directly mapped after casting to BIGINT
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join with the report table
    • Aggregation The column is part of the GROUP BY clause
    • Output Columns:
      • account_id: Directly copied to output
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_id]
    • Integration used as the join key with the report table
    • Direct directly copied to the output
    • Output Columns:
      • account_id: directly copied
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_id]
    • Integration used as the key to join with the report table
    • Direct directly copied to the output
    • Output Columns:
      • account_id: directly copied
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_id]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as a key to join tables
    • Output Columns:
      • account_id: Directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_id]
    • Integration Used as part of the join condition with the report table
    • Direct Directly copied to the output
    • Output Columns:
      • account_id: Directly copied
Column Lineage
%3 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp name 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history account_name 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f0->8. model.facebook_ads_source.stg_facebook_ads__account_history:f0 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report account_name 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->1. model.facebook_ads.facebook_ads__account_report:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report account_name 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report account_name 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report account_name 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report account_name 8. model.facebook_ads_source.stg_facebook_ads__account_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
8. model.facebook_ads_source.stg_facebook_ads__account_history
  • Input Column: 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp[name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • account_name: Directly mapped
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_name]
    • Direct The column is directly copied without any transformation
    • Aggregation The column is part of the GROUP BY clause
    • Output Columns:
      • account_name: Directly copied to output
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_name]
    • Direct directly copied to the output
    • Output Columns:
      • account_name: directly copied
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_name]
    • Direct directly copied to the output
    • Output Columns:
      • account_name: directly copied
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • account_name: Directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 8. model.facebook_ads_source.stg_facebook_ads__account_history[account_name]
    • Direct Directly copied to the output
    • Output Columns:
      • account_name: Directly copied
Column Lineage
%3 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp _fivetran_synced 8. model.facebook_ads_source.stg_facebook_ads__account_history 8. model.facebook_ads_source.stg_facebook_ads__account_history _fivetran_synced 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp:f0->8. model.facebook_ads_source.stg_facebook_ads__account_history:f0
8. model.facebook_ads_source.stg_facebook_ads__account_history
  • Input Column: 9. model.facebook_ads_source.stg_facebook_ads__account_history_tmp[_fivetran_synced]
    • Direct The column is directly copied without transformation
    • Deduplication Used in the ROW_NUMBER() function to order records and identify the most recent
    • Output Columns:
      • _fivetran_synced: Directly mapped
10. model.facebook_ads_source.stg_facebook_ads__ad_history

This SQL query performs several operations on the Facebook Ads data. It starts by selecting all columns from a temporary staging table, then defines a set of fields with specific data types. The final select statement casts various ID fields to BIGINT, renames some columns, and adds an 'is_most_recent_record' flag. This flag is determined using a ROW_NUMBER() function, which helps in identifying the most recent record for each unique ad (or source relation if id is null).

CleaningDeduplicationOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__ad_history_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS updated_time,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS TEXT) AS name,
    CAST(NULL AS INT) AS account_id,
    CAST(NULL AS INT) AS ad_set_id,
    CAST(NULL AS INT) AS campaign_id,
    CAST(NULL AS INT) AS creative_id,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    source_relation,
    updated_time AS updated_at,
    CAST(id AS BIGINT) AS ad_id,
    name AS ad_name,
    CAST(account_id AS BIGINT) AS account_id,
    CAST(ad_set_id AS BIGINT) AS ad_set_id,
    CAST(campaign_id AS BIGINT) AS campaign_id,
    CAST(creative_id AS BIGINT) AS creative_id,
    CASE
      WHEN id IS NULL AND updated_time IS NULL
      THEN ROW_NUMBER() OVER (PARTITION BY source_relation ORDER BY source_relation)
      ELSE ROW_NUMBER() OVER (PARTITION BY source_relation, id ORDER BY updated_time DESC)
    END = 1 AS is_most_recent_record
  FROM fields
)
SELECT
  *
FROM final
%3 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history source_relation ad_id account_id ad_set_id campaign_id creative_id ad_name is_most_recent_record updated_at 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp id account_id ad_set_id campaign_id creative_id name updated_time 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f1 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f1->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f2 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f2->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f3 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f3->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f4 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f4->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f5 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f5->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f6 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f6->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f8
Name Type Comment
source_relation text The source of the record if the unioning functionality is being used. If not this field will be empty.
ad_id bigint The ID of this ad.
account_id bigint The ID of the ad account that this ad belongs to.
ad_set_id bigint ID of the ad set that contains the ad.
campaign_id bigint Ad campaign that contains this ad.
creative_id bigint The ID of the ad creative to be used by this ad.
ad_name text Name of the ad.
is_most_recent_record boolean Boolean representing whether a record is the most recent version of that record. All records should have this value set to True given we filter on it.
updated_at timestamp without time zone The timestamp of the last update of a record.
Column Lineage
%3 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history source_relation 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report source_relation 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report source_relation 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report source_relation 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report source_relation 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[source_relation]
    • Integration used as a key to join with other tables
    • Direct copied directly to the output
    • Output Columns:
      • source_relation: directly copied
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[source_relation]
    • Integration used as a key to join with other tables
    • Output Columns:
      • source_relation: directly copied to output
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[source_relation]
    • Integration used as part of the join condition with other tables
    • Direct copied directly to the output
    • Output Columns:
      • source_relation: directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[source_relation]
    • Integration used as part of the join condition with other tables
    • Direct copied directly to the output
    • Output Columns:
      • source_relation: directly copied
Column Lineage
%3 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp id 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history ad_id 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:header 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report ad_id 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report ad_id 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:header
10. model.facebook_ads_source.stg_facebook_ads__ad_history
  • Input Column: 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp[id]
    • Cleaning The column is cast to BIGINT
    • Deduplication Used in ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • ad_id: Directly mapped after casting to BIGINT
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_id]
    • Integration used as a key to join with the report table
    • Direct copied directly to the output
    • Output Columns:
      • ad_id: directly copied
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_id]
    • Integration used as a key to join with the report table
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_id]
    • Integration used as the key to join with the report table
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_id]
    • Integration used as the key to join with the report table
    • Direct copied directly to the output
    • Output Columns:
      • ad_id: directly copied
Column Lineage
%3 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp account_id 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history account_id 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:header
10. model.facebook_ads_source.stg_facebook_ads__ad_history
  • Input Column: 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp[account_id]
    • Cleaning The column is cast to BIGINT
    • Output Columns:
      • account_id: Directly mapped after casting to BIGINT
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[account_id]
    • Integration used indirectly through joins with other tables
Column Lineage
%3 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp ad_set_id 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history ad_set_id 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->5. model.facebook_ads.facebook_ads__url_report:header 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:header
10. model.facebook_ads_source.stg_facebook_ads__ad_history
  • Input Column: 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp[ad_set_id]
    • Cleaning The column is cast to BIGINT
    • Output Columns:
      • ad_set_id: Directly mapped after casting to BIGINT
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_set_id]
    • Integration used as a key to join with the ad_sets table
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_set_id]
    • Integration used to join with the ad_sets table
Column Lineage
%3 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp campaign_id 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history campaign_id 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:header 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->5. model.facebook_ads.facebook_ads__url_report:header 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->2. model.facebook_ads.facebook_ads__ad_report:header 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:header
10. model.facebook_ads_source.stg_facebook_ads__ad_history
  • Input Column: 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp[campaign_id]
    • Cleaning The column is cast to BIGINT
    • Output Columns:
      • campaign_id: Directly mapped after casting to BIGINT
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[campaign_id]
    • Integration used as a key to join with the campaigns table
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[campaign_id]
    • Integration used as a key to join with the campaigns table
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[campaign_id]
    • Integration used as the key to join with the campaigns table
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[campaign_id]
    • Integration used to join with the campaigns table
Column Lineage
%3 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp creative_id 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history creative_id 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->5. model.facebook_ads.facebook_ads__url_report:header
10. model.facebook_ads_source.stg_facebook_ads__ad_history
  • Input Column: 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp[creative_id]
    • Cleaning The column is cast to BIGINT
    • Output Columns:
      • creative_id: Directly mapped after casting to BIGINT
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[creative_id]
    • Integration used to join with the creatives table
Column Lineage
%3 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp name 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history ad_name 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report ad_name 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report ad_name 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0
10. model.facebook_ads_source.stg_facebook_ads__ad_history
  • Input Column: 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp[name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • ad_name: Directly mapped
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_name]
    • Direct copied directly to the output
    • Output Columns:
      • ad_name: directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_name]
    • Direct copied directly to the output
    • Output Columns:
      • ad_name: directly copied
Column Lineage
%3 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history is_most_recent_record 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:header 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->5. model.facebook_ads.facebook_ads__url_report:header 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->2. model.facebook_ads.facebook_ads__ad_report:header 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:header
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[is_most_recent_record]
    • Filtering used to filter only the most recent records
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[is_most_recent_record]
    • Filtering used to filter for the most recent records
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[is_most_recent_record]
    • Filtering used to filter only the most recent records
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[is_most_recent_record]
    • Filtering used to filter only the most recent records
Column Lineage
%3 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp updated_time 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history updated_at 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0
10. model.facebook_ads_source.stg_facebook_ads__ad_history
  • Input Column: 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp[updated_time]
    • Deduplication Used in ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • updated_at: Directly mapped
11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, containing NULL values. The LIMIT 0 clause ensures no rows are returned. This query is likely used as a placeholder or template for generating a schema without actual data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp id account_id ad_set_id campaign_id creative_id name _fivetran_synced updated_time 21. source.facebook_ads_source.facebook_ads.ad_history 21. source.facebook_ads_source.facebook_ads.ad_history
Name Type Comment
id bigint None
account_id bigint None
ad_set_id bigint None
campaign_id bigint None
creative_id bigint None
name text None
_fivetran_synced timestamp without time zone None
updated_time timestamp without time zone None
Column Lineage
%3 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp id 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history ad_id 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:header 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report ad_id 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report ad_id 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:header
10. model.facebook_ads_source.stg_facebook_ads__ad_history
  • Input Column: 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp[id]
    • Cleaning The column is cast to BIGINT
    • Deduplication Used in ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • ad_id: Directly mapped after casting to BIGINT
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_id]
    • Integration used as a key to join with the report table
    • Direct copied directly to the output
    • Output Columns:
      • ad_id: directly copied
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_id]
    • Integration used as a key to join with the report table
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_id]
    • Integration used as the key to join with the report table
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_id]
    • Integration used as the key to join with the report table
    • Direct copied directly to the output
    • Output Columns:
      • ad_id: directly copied
Column Lineage
%3 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp account_id 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history account_id 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:header
10. model.facebook_ads_source.stg_facebook_ads__ad_history
  • Input Column: 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp[account_id]
    • Cleaning The column is cast to BIGINT
    • Output Columns:
      • account_id: Directly mapped after casting to BIGINT
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[account_id]
    • Integration used indirectly through joins with other tables
Column Lineage
%3 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp ad_set_id 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history ad_set_id 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->5. model.facebook_ads.facebook_ads__url_report:header 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:header
10. model.facebook_ads_source.stg_facebook_ads__ad_history
  • Input Column: 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp[ad_set_id]
    • Cleaning The column is cast to BIGINT
    • Output Columns:
      • ad_set_id: Directly mapped after casting to BIGINT
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_set_id]
    • Integration used as a key to join with the ad_sets table
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_set_id]
    • Integration used to join with the ad_sets table
Column Lineage
%3 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp campaign_id 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history campaign_id 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:header 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->5. model.facebook_ads.facebook_ads__url_report:header 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->2. model.facebook_ads.facebook_ads__ad_report:header 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:header
10. model.facebook_ads_source.stg_facebook_ads__ad_history
  • Input Column: 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp[campaign_id]
    • Cleaning The column is cast to BIGINT
    • Output Columns:
      • campaign_id: Directly mapped after casting to BIGINT
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[campaign_id]
    • Integration used as a key to join with the campaigns table
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[campaign_id]
    • Integration used as a key to join with the campaigns table
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[campaign_id]
    • Integration used as the key to join with the campaigns table
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[campaign_id]
    • Integration used to join with the campaigns table
Column Lineage
%3 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp creative_id 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history creative_id 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->5. model.facebook_ads.facebook_ads__url_report:header
10. model.facebook_ads_source.stg_facebook_ads__ad_history
  • Input Column: 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp[creative_id]
    • Cleaning The column is cast to BIGINT
    • Output Columns:
      • creative_id: Directly mapped after casting to BIGINT
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[creative_id]
    • Integration used to join with the creatives table
Column Lineage
%3 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp name 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history ad_name 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report ad_name 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report ad_name 10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0
10. model.facebook_ads_source.stg_facebook_ads__ad_history
  • Input Column: 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp[name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • ad_name: Directly mapped
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_name]
    • Direct copied directly to the output
    • Output Columns:
      • ad_name: directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 10. model.facebook_ads_source.stg_facebook_ads__ad_history[ad_name]
    • Direct copied directly to the output
    • Output Columns:
      • ad_name: directly copied
Column Lineage
%3 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp updated_time 10. model.facebook_ads_source.stg_facebook_ads__ad_history 10. model.facebook_ads_source.stg_facebook_ads__ad_history updated_at 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp:f0->10. model.facebook_ads_source.stg_facebook_ads__ad_history:f0
10. model.facebook_ads_source.stg_facebook_ads__ad_history
  • Input Column: 11. model.facebook_ads_source.stg_facebook_ads__ad_history_tmp[updated_time]
    • Deduplication Used in ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • updated_at: Directly mapped
12. model.facebook_ads_source.stg_facebook_ads__ad_set_history

This SQL query performs several transformations on data from a Facebook Ads source table. It casts various fields to specific data types, renames some columns, and adds a flag to identify the most recent record for each ad set. The query also includes logic to handle cases where 'id' and 'updated_time' might be null.

CleaningDeduplicationOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__ad_set_history_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS updated_time,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS TEXT) AS name,
    CAST(NULL AS INT) AS account_id,
    CAST(NULL AS INT) AS campaign_id,
    CAST(NULL AS TIMESTAMP) AS start_time,
    CAST(NULL AS TIMESTAMP) AS end_time,
    CAST(NULL AS TEXT) AS bid_strategy,
    CAST(NULL AS INT) AS daily_budget,
    CAST(NULL AS INT) AS budget_remaining,
    CAST(NULL AS TEXT) AS status,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    source_relation,
    updated_time AS updated_at,
    CAST(id AS BIGINT) AS ad_set_id,
    name AS ad_set_name,
    CAST(account_id AS BIGINT) AS account_id,
    CAST(campaign_id AS BIGINT) AS campaign_id,
    start_time AS start_at,
    end_time AS end_at,
    bid_strategy,
    daily_budget,
    budget_remaining,
    status,
    CASE
      WHEN id IS NULL AND updated_time IS NULL
      THEN ROW_NUMBER() OVER (PARTITION BY source_relation ORDER BY source_relation)
      ELSE ROW_NUMBER() OVER (PARTITION BY source_relation, id ORDER BY updated_time DESC)
    END = 1 AS is_most_recent_record
  FROM fields
)
SELECT
  *
FROM final
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history source_relation ad_set_id account_id campaign_id ad_set_name is_most_recent_record updated_at start_at end_at bid_strategy daily_budget budget_remaining status 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp id account_id campaign_id name updated_time 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f0->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f1 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f1->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f2 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f2->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f3 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f3->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f4 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f4->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f6
Name Type Comment
source_relation text The source of the record if the unioning functionality is being used. If not this field will be empty.
ad_set_id bigint The ID of the ad set.
account_id bigint The ID of the ad account that this ad set belongs to.
campaign_id bigint Ad campaign that contains this ad set.
ad_set_name text The name of the ad set.
is_most_recent_record boolean Boolean representing whether a record is the most recent version of that record. All records should have this value set to True given we filter on it.
updated_at timestamp without time zone The timestamp of the last update of a record.
start_at timestamp without time zone Timestamp of designated ad set start time.
end_at timestamp without time zone Timestamp of designated ad set end time.
bid_strategy text Bid strategy values are - 'LOWEST_COST_WITHOUT_CAP', 'LOWEST_COST_WITH_BID_CAP', 'COST_CAP', 'LOWEST_COST_WITH_MIN_ROAS'.
daily_budget integer Daily budget of ad set.
budget_remaining integer Remaining budget of ad set.
status text Status values are - 'ACTIVE', 'PAUSED', 'DELETED', 'ARCHIVED'.
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history source_relation 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report source_relation 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report source_relation 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report source_relation 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[source_relation]
    • Integration used as part of the join condition with other tables
    • Direct directly copied to the output
    • Output Columns:
      • source_relation: directly copied
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[source_relation]
    • Integration used as part of the join condition with other tables
    • Direct directly copied to the output
    • Output Columns:
      • source_relation: directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[source_relation]
    • Integration used as part of the join condition with other tables
    • Direct directly copied to the output
    • Output Columns:
      • source_relation: directly copied
Column Lineage
%3 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp id 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history ad_set_id 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f0->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report ad_set_id 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report ad_set_id 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report ad_set_id 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
12. model.facebook_ads_source.stg_facebook_ads__ad_set_history
  • Input Column: 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp[id]
    • Cleaning The column is cast to BIGINT
    • Deduplication Used in the ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • ad_set_id: Directly mapped after casting to BIGINT
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[ad_set_id]
    • Integration used as part of the join condition with the ads table
    • Direct directly copied to the output
    • Output Columns:
      • ad_set_id: directly copied
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[ad_set_id]
    • Integration used as the key to join with the ads table
    • Direct directly copied to the output
    • Output Columns:
      • ad_set_id: directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[ad_set_id]
    • Integration used as the key to join with the report table
    • Direct directly copied to the output
    • Output Columns:
      • ad_set_id: directly copied
Column Lineage
%3 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp account_id 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history account_id 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f0->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0
12. model.facebook_ads_source.stg_facebook_ads__ad_set_history
  • Input Column: 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp[account_id]
    • Cleaning The column is cast to BIGINT
    • Output Columns:
      • account_id: Directly mapped after casting to BIGINT
Column Lineage
%3 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp campaign_id 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history campaign_id 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f0->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0
12. model.facebook_ads_source.stg_facebook_ads__ad_set_history
  • Input Column: 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp[campaign_id]
    • Cleaning The column is cast to BIGINT
    • Output Columns:
      • campaign_id: Directly mapped after casting to BIGINT
Column Lineage
%3 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp name 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history ad_set_name 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f0->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report ad_set_name 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report ad_set_name 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report ad_set_name 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
12. model.facebook_ads_source.stg_facebook_ads__ad_set_history
  • Input Column: 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp[name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • ad_set_name: Directly mapped
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[ad_set_name]
    • Direct directly copied to the output
    • Output Columns:
      • ad_set_name: directly copied
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[ad_set_name]
    • Direct directly copied to the output
    • Output Columns:
      • ad_set_name: directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[ad_set_name]
    • Direct directly copied to the output
    • Output Columns:
      • ad_set_name: directly copied
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history is_most_recent_record 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->5. model.facebook_ads.facebook_ads__url_report:header 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->2. model.facebook_ads.facebook_ads__ad_report:header 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:header
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[is_most_recent_record]
    • Filtering used to filter only the most recent records
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[is_most_recent_record]
    • Filtering used to filter for the most recent records
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[is_most_recent_record]
    • Filtering used to filter only the most recent records
Column Lineage
%3 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp updated_time 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history updated_at 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f0->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0
12. model.facebook_ads_source.stg_facebook_ads__ad_set_history
  • Input Column: 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp[updated_time]
    • Cleaning Cast to TIMESTAMP
    • Deduplication Used in the ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • updated_at: Directly mapped after casting to TIMESTAMP
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history start_at 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report start_at 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[start_at]
    • Direct directly copied to the output
    • Output Columns:
      • start_at: directly copied
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history end_at 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report end_at 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[end_at]
    • Direct directly copied to the output
    • Output Columns:
      • end_at: directly copied
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history bid_strategy 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report bid_strategy 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[bid_strategy]
    • Direct directly copied to the output
    • Output Columns:
      • bid_strategy: directly copied
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history daily_budget 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report daily_budget 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[daily_budget]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • daily_budget: Directly copied to the output
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history budget_remaining 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report budget_remaining 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[budget_remaining]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • budget_remaining: Directly copied to the output
Column Lineage
%3 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history status 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->5. model.facebook_ads.facebook_ads__url_report:header 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->2. model.facebook_ads.facebook_ads__ad_report:header
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[status]
    • Filtering The column is used to filter for the most recent records with the condition 'is_most_recent_record = TRUE'
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[status]
    • Filtering The column is used to filter for the most recent record with the condition 'is_most_recent_record = TRUE'
13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, which is set to NULL. The query is limited to 0 rows, effectively returning no data. This type of query is often used as a placeholder or template in data modeling tools like dbt (data build tool) to define the structure of a staging table without actually populating it with data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp id account_id campaign_id name _fivetran_synced updated_time 22. source.facebook_ads_source.facebook_ads.ad_set_history 22. source.facebook_ads_source.facebook_ads.ad_set_history
Name Type Comment
id bigint None
account_id bigint None
campaign_id bigint None
name text None
_fivetran_synced timestamp without time zone None
updated_time timestamp without time zone None
Column Lineage
%3 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp id 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history ad_set_id 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f0->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report ad_set_id 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report ad_set_id 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report ad_set_id 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
12. model.facebook_ads_source.stg_facebook_ads__ad_set_history
  • Input Column: 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp[id]
    • Cleaning The column is cast to BIGINT
    • Deduplication Used in the ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • ad_set_id: Directly mapped after casting to BIGINT
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[ad_set_id]
    • Integration used as part of the join condition with the ads table
    • Direct directly copied to the output
    • Output Columns:
      • ad_set_id: directly copied
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[ad_set_id]
    • Integration used as the key to join with the ads table
    • Direct directly copied to the output
    • Output Columns:
      • ad_set_id: directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[ad_set_id]
    • Integration used as the key to join with the report table
    • Direct directly copied to the output
    • Output Columns:
      • ad_set_id: directly copied
Column Lineage
%3 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp account_id 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history account_id 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f0->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0
12. model.facebook_ads_source.stg_facebook_ads__ad_set_history
  • Input Column: 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp[account_id]
    • Cleaning The column is cast to BIGINT
    • Output Columns:
      • account_id: Directly mapped after casting to BIGINT
Column Lineage
%3 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp campaign_id 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history campaign_id 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f0->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0
12. model.facebook_ads_source.stg_facebook_ads__ad_set_history
  • Input Column: 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp[campaign_id]
    • Cleaning The column is cast to BIGINT
    • Output Columns:
      • campaign_id: Directly mapped after casting to BIGINT
Column Lineage
%3 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp name 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history ad_set_name 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f0->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report ad_set_name 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report ad_set_name 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report ad_set_name 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
12. model.facebook_ads_source.stg_facebook_ads__ad_set_history
  • Input Column: 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp[name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • ad_set_name: Directly mapped
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[ad_set_name]
    • Direct directly copied to the output
    • Output Columns:
      • ad_set_name: directly copied
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[ad_set_name]
    • Direct directly copied to the output
    • Output Columns:
      • ad_set_name: directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history[ad_set_name]
    • Direct directly copied to the output
    • Output Columns:
      • ad_set_name: directly copied
Column Lineage
%3 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp updated_time 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history 12. model.facebook_ads_source.stg_facebook_ads__ad_set_history updated_at 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp:f0->12. model.facebook_ads_source.stg_facebook_ads__ad_set_history:f0
12. model.facebook_ads_source.stg_facebook_ads__ad_set_history
  • Input Column: 13. model.facebook_ads_source.stg_facebook_ads__ad_set_history_tmp[updated_time]
    • Cleaning Cast to TIMESTAMP
    • Deduplication Used in the ROW_NUMBER() function to identify the most recent record
    • Output Columns:
      • updated_at: Directly mapped after casting to TIMESTAMP
14. model.facebook_ads_source.stg_facebook_ads__basic_ad

This SQL query performs data type casting and column renaming on a Facebook ads dataset. It starts by selecting all columns from a temporary staging table, then defines a set of fields with specific data types. Finally, it casts some columns to different data types, renames a few columns, and applies a COALESCE function to handle potential NULL values in the 'clicks' column.

CleaningOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__basic_ad_tmp
), fields AS (
  SELECT
    CAST(NULL AS TEXT) AS ad_id,
    CAST(NULL AS TEXT) AS ad_name,
    CAST(NULL AS TEXT) AS adset_name,
    CAST(NULL AS DATE) AS date,
    CAST(NULL AS INT) AS account_id,
    CAST(NULL AS INT) AS impressions,
    CAST(NULL AS INT) AS inline_link_clicks,
    CAST(NULL AS FLOAT) AS spend,
    CAST(NULL AS INT) AS reach,
    CAST(NULL AS FLOAT) AS frequency,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    source_relation,
    CAST(ad_id AS BIGINT) AS ad_id,
    ad_name,
    adset_name AS ad_set_name,
    date AS date_day,
    CAST(account_id AS BIGINT) AS account_id,
    impressions,
    COALESCE(inline_link_clicks, 0) AS clicks,
    spend,
    reach,
    frequency
  FROM fields
)
SELECT
  *
FROM final
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad source_relation ad_id ad_name ad_set_name date_day account_id impressions clicks spend reach frequency 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp ad_id date account_id impressions inline_link_clicks spend 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f1 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f1->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f4 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f2->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f5 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f3->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f6 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f4->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f7 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f5->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f8
Name Type Comment
source_relation text The source of the record if the unioning functionality is being used. If not this field will be empty.
ad_id bigint The ID of the ad the report relates to.
ad_name text Name of the ad the report relates to.
ad_set_name text Name of the ad set the report relates to.
date_day date The date of the reported performance.
account_id bigint The ID of the ad account that this ad belongs to.
impressions integer The number of impressions the ad had on the given day.
clicks integer The number of clicks the ad had on the given day.
spend double precision The spend on the ad in the given day.
reach integer The number of people who saw any content from your Page or about your Page. This metric is estimated.
frequency double precision The average number of times each person saw your ad; it is calculated as impressions divided by reach.
Column Lineage
%3 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad source_relation 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report source_relation 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->1. model.facebook_ads.facebook_ads__account_report:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report source_relation 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report source_relation 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report source_relation 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report source_relation 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join condition with the accounts table
    • Aggregation Used in the GROUP BY clause
    • Output Columns:
      • source_relation: Directly copied to the output
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join condition with other tables
    • Aggregation Included in the GROUP BY clause
    • Output Columns:
      • source_relation: Directly copied to the output
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join condition with other tables
    • Aggregation Included in the GROUP BY clause
    • Output Columns:
      • source_relation: Directly copied to the output
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as a key to join with other tables
    • Aggregation Part of the GROUP BY clause
    • Output Columns:
      • source_relation: Directly copied to the output
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[source_relation]
    • Direct The column is directly copied without any transformation
    • Integration Used as part of the join conditions with other tables
    • Output Columns:
      • source_relation: Directly copied to the output
Column Lineage
%3 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp ad_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad ad_id 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:header 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report ad_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report ad_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->3. model.facebook_ads.facebook_ads__ad_set_report:header
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[ad_id]
    • Cleaning The column is cast to BIGINT data type
    • Output Columns:
      • ad_id: Directly mapped after casting
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[ad_id]
    • Integration Used as a join key to connect with the ads table
    • Aggregation Included in the GROUP BY clause
    • Output Columns:
      • ad_id: Directly copied to the output from the joined ads table
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[ad_id]
    • Integration Used as a join key to connect with the ads table
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[ad_id]
    • Integration Used as a key to join with the ads table
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[ad_id]
    • Integration Used as a key to join with the ads table
    • Output Columns:
      • ad_id: Indirectly mapped through the join with ads table
Column Lineage
%3 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp date 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad date_day 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report date_day 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->1. model.facebook_ads.facebook_ads__account_report:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report date_day 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report date_day 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report date_day 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report date_day 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[date]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • date_day: Directly mapped and renamed
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[date_day]
    • Direct The column is directly copied without any transformation
    • Aggregation Used in the GROUP BY clause
    • Output Columns:
      • date_day: Directly copied to the output
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[date_day]
    • Direct The column is directly copied without any transformation
    • Aggregation Included in the GROUP BY clause
    • Output Columns:
      • date_day: Directly copied to the output
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[date_day]
    • Direct The column is directly copied without any transformation
    • Aggregation Included in the GROUP BY clause
    • Output Columns:
      • date_day: Directly copied to the output
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[date_day]
    • Direct The column is directly copied without any transformation
    • Aggregation Part of the GROUP BY clause
    • Output Columns:
      • date_day: Directly copied to the output
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[date_day]
    • Direct The column is directly copied without any transformation
    • Aggregation Used in the GROUP BY clause
    • Output Columns:
      • date_day: Directly copied to the output
Column Lineage
%3 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp account_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad account_id 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report account_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->1. model.facebook_ads.facebook_ads__account_report:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report account_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report account_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report account_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->3. model.facebook_ads.facebook_ads__ad_set_report:header
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[account_id]
    • Cleaning The column is cast to BIGINT data type
    • Output Columns:
      • account_id: Directly mapped after casting
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[account_id]
    • Integration Used as the key to join with the accounts table
    • Aggregation Used in the GROUP BY clause
    • Output Columns:
      • account_id: Directly copied to the output
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[account_id]
    • Integration Used as a join key to connect with the accounts table
    • Output Columns:
      • account_id: Directly copied to the output from the joined accounts table
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[account_id]
    • Integration Used as a join key to connect with the accounts table
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[account_id]
    • Integration Used as a key to join with the accounts table
    • Output Columns:
      • account_id: Indirectly mapped through the join with accounts table
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[account_id]
    • Integration Used as a key to join with the accounts table
    • Output Columns:
      • account_id: Indirectly mapped through the join with accounts table
Column Lineage
%3 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp impressions 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad impressions 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report impressions 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->1. model.facebook_ads.facebook_ads__account_report:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report impressions 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report impressions 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report impressions 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report impressions 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[impressions]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • impressions: Directly mapped
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[impressions]
    • Aggregation Summed up in the SELECT clause
    • Output Columns:
      • impressions: Aggregated into the output column
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[impressions]
    • Aggregation The column is summed up in the SELECT statement
    • Output Columns:
      • impressions: Aggregated sum in the output
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[impressions]
    • Aggregation The column is summed up in the SELECT statement
    • Output Columns:
      • impressions: Aggregated sum in the output
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[impressions]
    • Aggregation The column is aggregated using SUM function
    • Output Columns:
      • impressions: Aggregated sum in the output
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[impressions]
    • Aggregation Summed up in the SELECT clause
    • Output Columns:
      • impressions: Aggregated sum in the output
Column Lineage
%3 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp inline_link_clicks 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad clicks 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report clicks 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->1. model.facebook_ads.facebook_ads__account_report:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report clicks 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report clicks 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report clicks 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report clicks 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[inline_link_clicks]
    • Cleaning The column is cleaned by applying COALESCE to handle potential NULL values
    • Output Columns:
      • clicks: Mapped after applying COALESCE and renamed
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[clicks]
    • Aggregation Summed up in the SELECT clause
    • Output Columns:
      • clicks: Aggregated into the output column
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[clicks]
    • Aggregation The column is summed up in the SELECT statement
    • Output Columns:
      • clicks: Aggregated sum in the output
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[clicks]
    • Aggregation The column is summed up in the SELECT statement
    • Output Columns:
      • clicks: Aggregated sum in the output
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[clicks]
    • Aggregation The column is aggregated using SUM function
    • Output Columns:
      • clicks: Aggregated sum in the output
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[clicks]
    • Aggregation Summed up in the SELECT clause
    • Output Columns:
      • clicks: Aggregated sum in the output
Column Lineage
%3 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad spend 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->1. model.facebook_ads.facebook_ads__account_report:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[spend]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • spend: Directly mapped
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[spend]
    • Aggregation Summed up in the SELECT clause
    • Output Columns:
      • spend: Aggregated into the output column
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[spend]
    • Aggregation The column is summed up in the SELECT statement
    • Output Columns:
      • spend: Aggregated sum in the output
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[spend]
    • Aggregation The column is summed up in the SELECT statement
    • Output Columns:
      • spend: Aggregated sum in the output
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[spend]
    • Aggregation The column is aggregated using SUM function
    • Output Columns:
      • spend: Aggregated sum in the output
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[spend]
    • Aggregation Summed up in the SELECT clause
    • Output Columns:
      • spend: Aggregated sum in the output
15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, which is set to NULL. The query is limited to 0 rows, effectively returning no data. This type of query is often used as a placeholder or for testing purposes, particularly in data modeling or ETL processes.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp ad_id date account_id impressions inline_link_clicks spend 23. source.facebook_ads_source.facebook_ads.basic_ad 23. source.facebook_ads_source.facebook_ads.basic_ad
Name Type Comment
ad_id bigint None
date date None
account_id bigint None
impressions integer None
inline_link_clicks integer None
spend double precision None
Column Lineage
%3 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp ad_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad ad_id 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:header 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report ad_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report ad_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->3. model.facebook_ads.facebook_ads__ad_set_report:header
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[ad_id]
    • Cleaning The column is cast to BIGINT data type
    • Output Columns:
      • ad_id: Directly mapped after casting
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[ad_id]
    • Integration Used as a join key to connect with the ads table
    • Aggregation Included in the GROUP BY clause
    • Output Columns:
      • ad_id: Directly copied to the output from the joined ads table
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[ad_id]
    • Integration Used as a join key to connect with the ads table
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[ad_id]
    • Integration Used as a key to join with the ads table
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[ad_id]
    • Integration Used as a key to join with the ads table
    • Output Columns:
      • ad_id: Indirectly mapped through the join with ads table
Column Lineage
%3 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp date 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad date_day 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report date_day 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->1. model.facebook_ads.facebook_ads__account_report:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report date_day 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report date_day 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report date_day 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report date_day 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[date]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • date_day: Directly mapped and renamed
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[date_day]
    • Direct The column is directly copied without any transformation
    • Aggregation Used in the GROUP BY clause
    • Output Columns:
      • date_day: Directly copied to the output
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[date_day]
    • Direct The column is directly copied without any transformation
    • Aggregation Included in the GROUP BY clause
    • Output Columns:
      • date_day: Directly copied to the output
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[date_day]
    • Direct The column is directly copied without any transformation
    • Aggregation Included in the GROUP BY clause
    • Output Columns:
      • date_day: Directly copied to the output
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[date_day]
    • Direct The column is directly copied without any transformation
    • Aggregation Part of the GROUP BY clause
    • Output Columns:
      • date_day: Directly copied to the output
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[date_day]
    • Direct The column is directly copied without any transformation
    • Aggregation Used in the GROUP BY clause
    • Output Columns:
      • date_day: Directly copied to the output
Column Lineage
%3 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp account_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad account_id 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report account_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->1. model.facebook_ads.facebook_ads__account_report:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report account_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report account_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report account_id 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->3. model.facebook_ads.facebook_ads__ad_set_report:header
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[account_id]
    • Cleaning The column is cast to BIGINT data type
    • Output Columns:
      • account_id: Directly mapped after casting
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[account_id]
    • Integration Used as the key to join with the accounts table
    • Aggregation Used in the GROUP BY clause
    • Output Columns:
      • account_id: Directly copied to the output
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[account_id]
    • Integration Used as a join key to connect with the accounts table
    • Output Columns:
      • account_id: Directly copied to the output from the joined accounts table
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[account_id]
    • Integration Used as a join key to connect with the accounts table
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[account_id]
    • Integration Used as a key to join with the accounts table
    • Output Columns:
      • account_id: Indirectly mapped through the join with accounts table
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[account_id]
    • Integration Used as a key to join with the accounts table
    • Output Columns:
      • account_id: Indirectly mapped through the join with accounts table
Column Lineage
%3 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp impressions 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad impressions 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report impressions 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->1. model.facebook_ads.facebook_ads__account_report:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report impressions 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report impressions 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report impressions 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report impressions 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[impressions]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • impressions: Directly mapped
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[impressions]
    • Aggregation Summed up in the SELECT clause
    • Output Columns:
      • impressions: Aggregated into the output column
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[impressions]
    • Aggregation The column is summed up in the SELECT statement
    • Output Columns:
      • impressions: Aggregated sum in the output
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[impressions]
    • Aggregation The column is summed up in the SELECT statement
    • Output Columns:
      • impressions: Aggregated sum in the output
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[impressions]
    • Aggregation The column is aggregated using SUM function
    • Output Columns:
      • impressions: Aggregated sum in the output
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[impressions]
    • Aggregation Summed up in the SELECT clause
    • Output Columns:
      • impressions: Aggregated sum in the output
Column Lineage
%3 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad 14. model.facebook_ads_source.stg_facebook_ads__basic_ad spend 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp:f0->14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0 1. model.facebook_ads.facebook_ads__account_report 1. model.facebook_ads.facebook_ads__account_report spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->1. model.facebook_ads.facebook_ads__account_report:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report spend 14. model.facebook_ads_source.stg_facebook_ads__basic_ad:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
14. model.facebook_ads_source.stg_facebook_ads__basic_ad
  • Input Column: 15. model.facebook_ads_source.stg_facebook_ads__basic_ad_tmp[spend]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • spend: Directly mapped
1. model.facebook_ads.facebook_ads__account_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[spend]
    • Aggregation Summed up in the SELECT clause
    • Output Columns:
      • spend: Aggregated into the output column
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[spend]
    • Aggregation The column is summed up in the SELECT statement
    • Output Columns:
      • spend: Aggregated sum in the output
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[spend]
    • Aggregation The column is summed up in the SELECT statement
    • Output Columns:
      • spend: Aggregated sum in the output
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[spend]
    • Aggregation The column is aggregated using SUM function
    • Output Columns:
      • spend: Aggregated sum in the output
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 14. model.facebook_ads_source.stg_facebook_ads__basic_ad[spend]
    • Aggregation Summed up in the SELECT clause
    • Output Columns:
      • spend: Aggregated sum in the output
16. model.facebook_ads_source.stg_facebook_ads__campaign_history

This SQL query stages data from a temporary Facebook Ads campaign history table. It casts columns to specific data types, renames some columns, and adds a flag to identify the most recent record for each campaign. The query also includes a source relation column, though it's set to an empty string in this example.

CleaningDeduplicationOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__campaign_history_tmp
), fields AS (
  SELECT
    CAST(NULL AS TIMESTAMP) AS updated_time,
    CAST(NULL AS TIMESTAMP) AS created_time,
    CAST(NULL AS INT) AS account_id,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS TEXT) AS name,
    CAST(NULL AS TIMESTAMP) AS start_time,
    CAST(NULL AS TIMESTAMP) AS stop_time,
    CAST(NULL AS TEXT) AS status,
    CAST(NULL AS INT) AS daily_budget,
    CAST(NULL AS INT) AS lifetime_budget,
    CAST(NULL AS FLOAT) AS budget_remaining,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    source_relation,
    updated_time AS updated_at,
    created_time AS created_at,
    CAST(account_id AS BIGINT) AS account_id,
    CAST(id AS BIGINT) AS campaign_id,
    name AS campaign_name,
    start_time AS start_at,
    stop_time AS end_at,
    status,
    daily_budget,
    lifetime_budget,
    budget_remaining,
    CASE
      WHEN id IS NULL AND updated_time IS NULL
      THEN ROW_NUMBER() OVER (PARTITION BY source_relation ORDER BY source_relation)
      ELSE ROW_NUMBER() OVER (PARTITION BY source_relation, id ORDER BY updated_time DESC)
    END = 1 AS is_most_recent_record
  FROM fields
)
SELECT
  *
FROM final
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history source_relation campaign_id account_id campaign_name is_most_recent_record updated_at created_at start_at end_at daily_budget budget_remaining lifetime_budget status 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp id account_id name updated_time 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f0->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f1 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f1->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f2 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f2->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f3 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f3->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f5
Name Type Comment
source_relation text The source of the record if the unioning functionality is being used. If not this field will be empty.
campaign_id bigint The ID of the campaign.
account_id bigint The ID of the ad account that this campaign belongs to.
campaign_name text The name of the campaign.
is_most_recent_record boolean Boolean representing whether a record is the most recent version of that record. All records should have this value set to True given we filter on it.
updated_at timestamp without time zone The timestamp of the last update of a record.
created_at timestamp without time zone The time the campaign was created.
start_at timestamp without time zone Timestamp of designated campaign start time.
end_at timestamp without time zone Timestamp of designated campaign end time.
daily_budget integer Daily budget of campaign.
budget_remaining double precision Remaining budget of campaign.
lifetime_budget integer Lifetime budget of the campaign.
status text Status values are - 'ACTIVE', 'PAUSED', 'DELETED', 'ARCHIVED'.
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history source_relation 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report source_relation 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report source_relation 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report source_relation 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:header
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[source_relation]
    • Integration used to join with other tables
    • Direct directly copied to the output
    • Output Columns:
      • source_relation: directly copied
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[source_relation]
    • Integration used as part of the join condition with other tables
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[source_relation]
    • Integration used as part of the join condition with other tables
    • Direct directly copied to the output
    • Output Columns:
      • source_relation: directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[source_relation]
    • Integration used to join with other tables
    • Filtering used in the WHERE clause to ensure consistency across joins
    • Output Columns:
      • source_relation: directly copied to output
Column Lineage
%3 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp id 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history campaign_id 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f0->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report campaign_id 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report campaign_id 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report campaign_id 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report campaign_id 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
16. model.facebook_ads_source.stg_facebook_ads__campaign_history
  • Input Column: 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp[id]
    • Cleaning Cast to BIGINT data type
    • Deduplication Used in the ROW_NUMBER() window function to identify the most recent record
    • Output Columns:
      • campaign_id: Directly mapped after casting to BIGINT
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_id]
    • Integration used to join with the ads table
    • Direct directly copied to the output
    • Output Columns:
      • campaign_id: directly copied
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_id]
    • Integration used as the key to join with the ads table
    • Direct directly copied to the output
    • Output Columns:
      • campaign_id: directly copied
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_id]
    • Integration used as the key to join with the ads table
    • Direct directly copied to the output
    • Output Columns:
      • campaign_id: directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_id]
    • Integration used to join with the ads table
    • Filtering used in the WHERE clause to ensure consistency across joins
    • Output Columns:
      • campaign_id: directly copied to output
Column Lineage
%3 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp account_id 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history account_id 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f0->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:header
16. model.facebook_ads_source.stg_facebook_ads__campaign_history
  • Input Column: 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp[account_id]
    • Cleaning Cast to BIGINT data type
    • Output Columns:
      • account_id: Directly mapped after casting to BIGINT
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[account_id]
    • Integration indirectly used in joining through the ads table
Column Lineage
%3 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp name 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history campaign_name 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f0->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report campaign_name 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report campaign_name 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report campaign_name 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report campaign_name 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
16. model.facebook_ads_source.stg_facebook_ads__campaign_history
  • Input Column: 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp[name]
    • Direct Copied without transformation
    • Output Columns:
      • campaign_name: Directly mapped
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_name]
    • Direct directly copied to the output
    • Output Columns:
      • campaign_name: directly copied
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_name]
    • Direct directly copied to the output
    • Output Columns:
      • campaign_name: directly copied
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_name]
    • Direct directly copied to the output
    • Output Columns:
      • campaign_name: directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_name]
    • Direct copied without transformation
    • Output Columns:
      • campaign_name: directly copied to output
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history is_most_recent_record 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:header 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->5. model.facebook_ads.facebook_ads__url_report:header 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->2. model.facebook_ads.facebook_ads__ad_report:header 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:header
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[is_most_recent_record]
    • Filtering used to filter for the most recent records
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[is_most_recent_record]
    • Filtering used to filter for the most recent records
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[is_most_recent_record]
    • Filtering used to filter only the most recent records
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[is_most_recent_record]
    • Filtering used to select only the most recent records (WHERE is_most_recent_record = TRUE)
Column Lineage
%3 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp updated_time 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history updated_at 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f0->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0
16. model.facebook_ads_source.stg_facebook_ads__campaign_history
  • Input Column: 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp[updated_time]
    • Deduplication Used in the ROW_NUMBER() window function to order and identify the most recent record
    • Direct Copied without transformation
    • Output Columns:
      • updated_at: Directly mapped
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history start_at 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report start_at 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[start_at]
    • Direct directly copied to the output
    • Output Columns:
      • start_at: directly copied
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history end_at 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report end_at 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[end_at]
    • Direct directly copied to the output
    • Output Columns:
      • end_at: directly copied
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history daily_budget 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report daily_budget 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[daily_budget]
    • Direct directly copied to the output
    • Output Columns:
      • daily_budget: directly copied
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history budget_remaining 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report budget_remaining 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[budget_remaining]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the ads table
    • Output Columns:
      • budget_remaining: Directly copied to the output
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history lifetime_budget 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report lifetime_budget 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[lifetime_budget]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the ads table
    • Output Columns:
      • lifetime_budget: Directly copied to the output
Column Lineage
%3 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history status 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report status 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->5. model.facebook_ads.facebook_ads__url_report:header 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:header
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[status]
    • Filtering The column is used to filter for the most recent record with the condition 'is_most_recent_record = TRUE'
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[status]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the ads table
    • Output Columns:
      • status: Directly copied to the output
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[status]
    • Filtering The column is used to filter for the most recent records with the condition 'is_most_recent_record = TRUE'
17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, which is set to NULL. The query is limited to 0 rows, effectively creating a schema-only representation of the table without any actual data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp id account_id name _fivetran_synced updated_time 24. source.facebook_ads_source.facebook_ads.campaign_history 24. source.facebook_ads_source.facebook_ads.campaign_history
Name Type Comment
id bigint None
account_id bigint None
name text None
_fivetran_synced timestamp without time zone None
updated_time timestamp without time zone None
Column Lineage
%3 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp id 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history campaign_id 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f0->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report campaign_id 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report campaign_id 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report campaign_id 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report campaign_id 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
16. model.facebook_ads_source.stg_facebook_ads__campaign_history
  • Input Column: 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp[id]
    • Cleaning Cast to BIGINT data type
    • Deduplication Used in the ROW_NUMBER() window function to identify the most recent record
    • Output Columns:
      • campaign_id: Directly mapped after casting to BIGINT
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_id]
    • Integration used to join with the ads table
    • Direct directly copied to the output
    • Output Columns:
      • campaign_id: directly copied
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_id]
    • Integration used as the key to join with the ads table
    • Direct directly copied to the output
    • Output Columns:
      • campaign_id: directly copied
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_id]
    • Integration used as the key to join with the ads table
    • Direct directly copied to the output
    • Output Columns:
      • campaign_id: directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_id]
    • Integration used to join with the ads table
    • Filtering used in the WHERE clause to ensure consistency across joins
    • Output Columns:
      • campaign_id: directly copied to output
Column Lineage
%3 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp account_id 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history account_id 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f0->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:header
16. model.facebook_ads_source.stg_facebook_ads__campaign_history
  • Input Column: 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp[account_id]
    • Cleaning Cast to BIGINT data type
    • Output Columns:
      • account_id: Directly mapped after casting to BIGINT
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[account_id]
    • Integration indirectly used in joining through the ads table
Column Lineage
%3 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp name 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history campaign_name 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f0->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0 4. model.facebook_ads.facebook_ads__campaign_report 4. model.facebook_ads.facebook_ads__campaign_report campaign_name 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->4. model.facebook_ads.facebook_ads__campaign_report:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report campaign_name 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 2. model.facebook_ads.facebook_ads__ad_report 2. model.facebook_ads.facebook_ads__ad_report campaign_name 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->2. model.facebook_ads.facebook_ads__ad_report:f0 3. model.facebook_ads.facebook_ads__ad_set_report 3. model.facebook_ads.facebook_ads__ad_set_report campaign_name 16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0->3. model.facebook_ads.facebook_ads__ad_set_report:f0
16. model.facebook_ads_source.stg_facebook_ads__campaign_history
  • Input Column: 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp[name]
    • Direct Copied without transformation
    • Output Columns:
      • campaign_name: Directly mapped
2. model.facebook_ads.facebook_ads__ad_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_name]
    • Direct directly copied to the output
    • Output Columns:
      • campaign_name: directly copied
3. model.facebook_ads.facebook_ads__ad_set_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_name]
    • Direct directly copied to the output
    • Output Columns:
      • campaign_name: directly copied
4. model.facebook_ads.facebook_ads__campaign_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_name]
    • Direct directly copied to the output
    • Output Columns:
      • campaign_name: directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 16. model.facebook_ads_source.stg_facebook_ads__campaign_history[campaign_name]
    • Direct copied without transformation
    • Output Columns:
      • campaign_name: directly copied to output
Column Lineage
%3 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp updated_time 16. model.facebook_ads_source.stg_facebook_ads__campaign_history 16. model.facebook_ads_source.stg_facebook_ads__campaign_history updated_at 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp:f0->16. model.facebook_ads_source.stg_facebook_ads__campaign_history:f0
16. model.facebook_ads_source.stg_facebook_ads__campaign_history
  • Input Column: 17. model.facebook_ads_source.stg_facebook_ads__campaign_history_tmp[updated_time]
    • Deduplication Used in the ROW_NUMBER() window function to order and identify the most recent record
    • Direct Copied without transformation
    • Output Columns:
      • updated_at: Directly mapped
18. model.facebook_ads_source.stg_facebook_ads__creative_history

This SQL query performs several data transformations on the Facebook Ads creative history data. It starts by selecting all columns from a temporary table, then casts various fields to specific data types. The query renames some columns, such as changing 'id' to 'creative_id'. It also adds a 'source_relation' column and creates an 'is_most_recent_record' flag using window functions to identify the most recent record for each creative ID. Finally, it selects all columns from the transformed data.

CleaningDeduplicationOther
SQL Query
WITH base AS (
  SELECT
    *
  FROM TEST.PUBLIC_facebook_ads_source.stg_facebook_ads__creative_history_tmp
), fields AS (
  SELECT
    CAST(NULL AS TEXT) AS _fivetran_id,
    CAST(NULL AS TIMESTAMP) AS _fivetran_synced,
    CAST(NULL AS INT) AS id,
    CAST(NULL AS INT) AS account_id,
    CAST(NULL AS TEXT) AS name,
    CAST(NULL AS TEXT) AS page_link,
    CAST(NULL AS TEXT) AS template_page_link,
    CAST(NULL AS TEXT) AS url_tags,
    CAST(NULL AS TEXT) AS asset_feed_spec_link_urls,
    CAST(NULL AS TEXT) AS object_story_link_data_child_attachments,
    CAST(NULL AS TEXT) AS object_story_link_data_caption,
    CAST(NULL AS TEXT) AS object_story_link_data_description,
    CAST(NULL AS TEXT) AS object_story_link_data_link,
    CAST(NULL AS TEXT) AS object_story_link_data_message,
    CAST(NULL AS TEXT) AS template_app_link_spec_android,
    CAST(NULL AS TEXT) AS template_app_link_spec_ios,
    CAST(NULL AS TEXT) AS template_app_link_spec_ipad,
    CAST(NULL AS TEXT) AS template_app_link_spec_iphone,
    CAST('' AS TEXT) AS source_relation
  FROM base
), final AS (
  SELECT
    source_relation,
    _fivetran_id,
    _fivetran_synced,
    CAST(id AS BIGINT) AS creative_id,
    CAST(account_id AS BIGINT) AS account_id,
    name AS creative_name,
    page_link,
    template_page_link,
    url_tags,
    asset_feed_spec_link_urls,
    object_story_link_data_child_attachments,
    object_story_link_data_caption,
    object_story_link_data_description,
    object_story_link_data_link,
    object_story_link_data_message,
    template_app_link_spec_ios,
    template_app_link_spec_ipad,
    template_app_link_spec_android,
    template_app_link_spec_iphone,
    CASE
      WHEN id IS NULL AND _fivetran_synced IS NULL
      THEN ROW_NUMBER() OVER (PARTITION BY source_relation ORDER BY source_relation)
      ELSE ROW_NUMBER() OVER (PARTITION BY source_relation, id ORDER BY _fivetran_synced DESC)
    END = 1 AS is_most_recent_record
  FROM fields
)
SELECT
  *
FROM final
%3 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history source_relation _fivetran_id _fivetran_synced creative_id account_id creative_name url_tags is_most_recent_record page_link template_page_link asset_feed_spec_link_urls object_story_link_data_child_attachments object_story_link_data_caption object_story_link_data_description object_story_link_data_link object_story_link_data_message template_app_link_spec_ios template_app_link_spec_ipad template_app_link_spec_android template_app_link_spec_iphone 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp page_link template_page_link id account_id name url_tags _fivetran_synced asset_feed_spec_link_urls object_story_link_data_child_attachments object_story_link_data_caption object_story_link_data_description object_story_link_data_link object_story_link_data_message template_app_link_spec_ios _fivetran_id 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f8 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f1->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f9 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f2->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f3->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f4 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f4->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f5 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f5->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f6 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f6->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f2 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f7->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f10 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f8->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f11 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f9->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f12 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f10->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f13 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f11->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f14 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f12->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f15 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f13->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f16 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f14->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f14->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f7
Name Type Comment
source_relation text The source of the record if the unioning functionality is being used. If not this field will be empty.
_fivetran_id text Unique record identifier
_fivetran_synced timestamp without time zone When the record was last synced by Fivetran.
creative_id bigint Unique ID for an ad creative.
account_id bigint Ad account ID for the account this ad creative belongs to.
creative_name text Name of this ad creative as seen in the ad account's library.
url_tags text A set of query string parameters which will replace or be appended to urls clicked from page post ads, message of the post, and canvas app install creatives only.
is_most_recent_record boolean Indicates whether a record is the most recent version of that record.
page_link character varying Link for the page.
template_page_link character varying URL destination of Facebook dynamic ads.
asset_feed_spec_link_urls text Link to the asset feed spec
object_story_link_data_child_attachments text Link of the object story child attachments
object_story_link_data_caption text Link of the object story caption
object_story_link_data_description text Link of the object story description
object_story_link_data_link text Link of the object story link
object_story_link_data_message text Link of the object story message
template_app_link_spec_ios text Link of the object story spec for ios
template_app_link_spec_ipad text Link of the template app spec for ipad
template_app_link_spec_android text Link of the template app for android
template_app_link_spec_iphone text Link of the template app for iphone
Column Lineage
%3 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history source_relation 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags source_relation 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f0 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history source_relation 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report source_relation 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[source_relation]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • source_relation: Directly copied
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[source_relation]
    • Integration Used to join with the base table
    • Direct Directly selected in the final output
    • Output Columns:
      • source_relation: Directly copied to the output
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[source_relation]
    • Direct The column is directly copied without transformation
    • Integration Used as part of the join condition with other tables
    • Output Columns:
      • source_relation: Directly copied to the output
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp _fivetran_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history _fivetran_id is_most_recent_record 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags _fivetran_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f0 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history _fivetran_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:header
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[_fivetran_id]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Deduplication This column is used in the window function to determine the most recent record
    • Output Columns:
      • _fivetran_id: Directly mapped to this output column
      • is_most_recent_record: Indirectly used to determine this flag
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[_fivetran_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_id: Directly copied
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[_fivetran_id]
    • Integration Used to join with the base table
    • Aggregation Used in GROUP BY clause
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp _fivetran_synced 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history _fivetran_synced 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Deduplication Used in the window function to determine the most recent record
    • Output Columns:
      • _fivetran_synced: Directly mapped
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp id 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history creative_id 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags creative_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f0 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history creative_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report creative_id 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[id]
    • Cleaning The column is cast as BIGINT
    • Deduplication Used in the window function to determine the most recent record
    • Output Columns:
      • creative_id: Mapped after casting to BIGINT
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[creative_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • creative_id: Directly copied
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[creative_id]
    • Integration Used to join with the base table
    • Aggregation Used in GROUP BY clause
    • Output Columns:
      • creative_id: Directly copied to the output
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[creative_id]
    • Direct The column is directly copied without transformation
    • Integration Used as the key to join with the ads table
    • Output Columns:
      • creative_id: Directly copied to the output
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp account_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history account_id 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history account_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[account_id]
    • Cleaning The column is cast as BIGINT
    • Output Columns:
      • account_id: Mapped after casting to BIGINT
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[account_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • account_id: Directly copied
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp name 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history creative_name 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history creative_name 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report creative_name 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[name]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • creative_name: Renamed and directly mapped
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[creative_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • creative_name: Directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[creative_name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • creative_name: Directly copied to the output
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp url_tags 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history url_tags 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags key type value 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f1 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history utm_campaign utm_content utm_medium utm_source utm_term 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report utm_campaign utm_content utm_medium utm_source utm_term 7. model.facebook_ads.int_facebook_ads__creative_history:f3->5. model.facebook_ads.facebook_ads__url_report:f3 7. model.facebook_ads.int_facebook_ads__creative_history:f2->5. model.facebook_ads.facebook_ads__url_report:f2 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 7. model.facebook_ads.int_facebook_ads__creative_history:f1->5. model.facebook_ads.facebook_ads__url_report:f1 7. model.facebook_ads.int_facebook_ads__creative_history:f4->5. model.facebook_ads.facebook_ads__url_report:f4
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[url_tags]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • url_tags: Directly mapped
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[key]
    • Featurization Used to pivot the data, extracting different UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[value]
    • Featurization Used as the value for the pivoted UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_source]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • utm_source: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_medium]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_medium: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_campaign]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_campaign: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_content]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_content: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_term]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_term: Directly copied to the output
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp _fivetran_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history _fivetran_id is_most_recent_record 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->6. model.facebook_ads.facebook_ads__url_tags:header 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:header
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[_fivetran_id]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Deduplication This column is used in the window function to determine the most recent record
    • Output Columns:
      • _fivetran_id: Directly mapped to this output column
      • is_most_recent_record: Indirectly used to determine this flag
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[is_most_recent_record]
    • Filtering The column is used to filter for the most recent records
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[is_most_recent_record]
    • Filtering The column is used to filter for the most recent records
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp page_link 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history page_link 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report base_url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 7. model.facebook_ads.int_facebook_ads__creative_history:f1->5. model.facebook_ads.facebook_ads__url_report:header 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 7. model.facebook_ads.int_facebook_ads__creative_history:f2->5. model.facebook_ads.facebook_ads__url_report:f1 7. model.facebook_ads.int_facebook_ads__creative_history:f3->5. model.facebook_ads.facebook_ads__url_report:f2 7. model.facebook_ads.int_facebook_ads__creative_history:f7->5. model.facebook_ads.facebook_ads__url_report:f6 7. model.facebook_ads.int_facebook_ads__creative_history:f6->5. model.facebook_ads.facebook_ads__url_report:f5 7. model.facebook_ads.int_facebook_ads__creative_history:f4->5. model.facebook_ads.facebook_ads__url_report:f3 7. model.facebook_ads.int_facebook_ads__creative_history:f5->5. model.facebook_ads.facebook_ads__url_report:f4 7. model.facebook_ads.int_facebook_ads__creative_history:f8->5. model.facebook_ads.facebook_ads__url_report:f7
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url]
    • Filtering Used in the WHERE clause to filter out null URLs
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[base_url]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • base_url: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url_host]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • url_host: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url_path]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • url_path: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_source]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • utm_source: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_medium]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_medium: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_campaign]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_campaign: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_content]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_content: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_term]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_term: Directly copied to the output
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp template_page_link 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history template_page_link 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report base_url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 7. model.facebook_ads.int_facebook_ads__creative_history:f1->5. model.facebook_ads.facebook_ads__url_report:header 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 7. model.facebook_ads.int_facebook_ads__creative_history:f2->5. model.facebook_ads.facebook_ads__url_report:f1 7. model.facebook_ads.int_facebook_ads__creative_history:f3->5. model.facebook_ads.facebook_ads__url_report:f2 7. model.facebook_ads.int_facebook_ads__creative_history:f7->5. model.facebook_ads.facebook_ads__url_report:f6 7. model.facebook_ads.int_facebook_ads__creative_history:f6->5. model.facebook_ads.facebook_ads__url_report:f5 7. model.facebook_ads.int_facebook_ads__creative_history:f4->5. model.facebook_ads.facebook_ads__url_report:f3 7. model.facebook_ads.int_facebook_ads__creative_history:f5->5. model.facebook_ads.facebook_ads__url_report:f4 7. model.facebook_ads.int_facebook_ads__creative_history:f8->5. model.facebook_ads.facebook_ads__url_report:f7
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url]
    • Filtering Used in the WHERE clause to filter out null URLs
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[base_url]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • base_url: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url_host]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • url_host: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url_path]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • url_path: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_source]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • utm_source: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_medium]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_medium: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_campaign]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_campaign: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_content]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_content: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_term]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_term: Directly copied to the output
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_child_attachments 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_child_attachments 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_child_attachments]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • object_story_link_data_child_attachments: Directly mapped
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_caption 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_caption 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_caption]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • object_story_link_data_caption: Directly mapped
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_description 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_description 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_description]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_description: Directly mapped to this output column
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report base_url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 7. model.facebook_ads.int_facebook_ads__creative_history:f1->5. model.facebook_ads.facebook_ads__url_report:header 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 7. model.facebook_ads.int_facebook_ads__creative_history:f2->5. model.facebook_ads.facebook_ads__url_report:f1 7. model.facebook_ads.int_facebook_ads__creative_history:f3->5. model.facebook_ads.facebook_ads__url_report:f2 7. model.facebook_ads.int_facebook_ads__creative_history:f7->5. model.facebook_ads.facebook_ads__url_report:f6 7. model.facebook_ads.int_facebook_ads__creative_history:f6->5. model.facebook_ads.facebook_ads__url_report:f5 7. model.facebook_ads.int_facebook_ads__creative_history:f4->5. model.facebook_ads.facebook_ads__url_report:f3 7. model.facebook_ads.int_facebook_ads__creative_history:f5->5. model.facebook_ads.facebook_ads__url_report:f4 7. model.facebook_ads.int_facebook_ads__creative_history:f8->5. model.facebook_ads.facebook_ads__url_report:f7
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url]
    • Filtering Used in the WHERE clause to filter out null URLs
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[base_url]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • base_url: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url_host]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • url_host: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url_path]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • url_path: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_source]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • utm_source: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_medium]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_medium: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_campaign]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_campaign: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_content]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_content: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_term]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_term: Directly copied to the output
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_message 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_message 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_message]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_message: Directly mapped to this output column
19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT, initialized to NULL. The query is likely used as a placeholder or template for further development, or to establish the structure of a table without populating it with data.

Other
SQL Query
SELECT
  CAST(NULL AS TEXT) AS _dbt_source_relation
LIMIT 0
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp page_link template_page_link id account_id name url_tags _fivetran_synced asset_feed_spec_link_urls object_story_link_data_child_attachments object_story_link_data_caption object_story_link_data_description object_story_link_data_link object_story_link_data_message template_app_link_spec_ios _fivetran_id 25. source.facebook_ads_source.facebook_ads.creative_history 25. source.facebook_ads_source.facebook_ads.creative_history
Name Type Comment
page_link character varying None
template_page_link character varying None
id bigint None
account_id bigint None
name text None
url_tags text None
_fivetran_synced timestamp without time zone None
asset_feed_spec_link_urls text None
object_story_link_data_child_attachments text None
object_story_link_data_caption text None
object_story_link_data_description text None
object_story_link_data_link text None
object_story_link_data_message text None
template_app_link_spec_ios text None
_fivetran_id text None
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp page_link 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history page_link 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report base_url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 7. model.facebook_ads.int_facebook_ads__creative_history:f1->5. model.facebook_ads.facebook_ads__url_report:header 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 7. model.facebook_ads.int_facebook_ads__creative_history:f2->5. model.facebook_ads.facebook_ads__url_report:f1 7. model.facebook_ads.int_facebook_ads__creative_history:f3->5. model.facebook_ads.facebook_ads__url_report:f2 7. model.facebook_ads.int_facebook_ads__creative_history:f7->5. model.facebook_ads.facebook_ads__url_report:f6 7. model.facebook_ads.int_facebook_ads__creative_history:f6->5. model.facebook_ads.facebook_ads__url_report:f5 7. model.facebook_ads.int_facebook_ads__creative_history:f4->5. model.facebook_ads.facebook_ads__url_report:f3 7. model.facebook_ads.int_facebook_ads__creative_history:f5->5. model.facebook_ads.facebook_ads__url_report:f4 7. model.facebook_ads.int_facebook_ads__creative_history:f8->5. model.facebook_ads.facebook_ads__url_report:f7
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • page_link: Directly mapped
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[page_link]
    • Cleaning Used in COALESCE with template_page_link
    • Featurization Various URL components and UTM parameters are extracted from this column
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted
      • utm_medium: Extracted if not found in url_tags_pivoted
      • utm_campaign: Extracted if not found in url_tags_pivoted
      • utm_content: Extracted if not found in url_tags_pivoted
      • utm_term: Extracted if not found in url_tags_pivoted
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url]
    • Filtering Used in the WHERE clause to filter out null URLs
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[base_url]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • base_url: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url_host]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • url_host: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url_path]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • url_path: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_source]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • utm_source: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_medium]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_medium: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_campaign]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_campaign: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_content]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_content: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_term]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_term: Directly copied to the output
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp template_page_link 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history template_page_link 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report base_url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 7. model.facebook_ads.int_facebook_ads__creative_history:f1->5. model.facebook_ads.facebook_ads__url_report:header 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 7. model.facebook_ads.int_facebook_ads__creative_history:f2->5. model.facebook_ads.facebook_ads__url_report:f1 7. model.facebook_ads.int_facebook_ads__creative_history:f3->5. model.facebook_ads.facebook_ads__url_report:f2 7. model.facebook_ads.int_facebook_ads__creative_history:f7->5. model.facebook_ads.facebook_ads__url_report:f6 7. model.facebook_ads.int_facebook_ads__creative_history:f6->5. model.facebook_ads.facebook_ads__url_report:f5 7. model.facebook_ads.int_facebook_ads__creative_history:f4->5. model.facebook_ads.facebook_ads__url_report:f3 7. model.facebook_ads.int_facebook_ads__creative_history:f5->5. model.facebook_ads.facebook_ads__url_report:f4 7. model.facebook_ads.int_facebook_ads__creative_history:f8->5. model.facebook_ads.facebook_ads__url_report:f7
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[template_page_link]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • template_page_link: Directly mapped
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[template_page_link]
    • Cleaning Used in COALESCE with page_link
    • Featurization Various URL components and UTM parameters are extracted from this column if page_link is null
    • Output Columns:
      • url: COALESCE(page_link, template_page_link)
      • base_url: Extracted from page_link or template_page_link
      • url_host: Extracted from page_link or template_page_link
      • url_path: Extracted from page_link or template_page_link
      • utm_source: Extracted if not found in url_tags_pivoted and page_link
      • utm_medium: Extracted if not found in url_tags_pivoted and page_link
      • utm_campaign: Extracted if not found in url_tags_pivoted and page_link
      • utm_content: Extracted if not found in url_tags_pivoted and page_link
      • utm_term: Extracted if not found in url_tags_pivoted and page_link
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url]
    • Filtering Used in the WHERE clause to filter out null URLs
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[base_url]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • base_url: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url_host]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • url_host: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url_path]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • url_path: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_source]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • utm_source: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_medium]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_medium: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_campaign]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_campaign: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_content]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_content: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_term]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_term: Directly copied to the output
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp id 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history creative_id 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags creative_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f0 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history creative_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report creative_id 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[id]
    • Cleaning The column is cast as BIGINT
    • Deduplication Used in the window function to determine the most recent record
    • Output Columns:
      • creative_id: Mapped after casting to BIGINT
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[creative_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • creative_id: Directly copied
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[creative_id]
    • Integration Used to join with the base table
    • Aggregation Used in GROUP BY clause
    • Output Columns:
      • creative_id: Directly copied to the output
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[creative_id]
    • Direct The column is directly copied without transformation
    • Integration Used as the key to join with the ads table
    • Output Columns:
      • creative_id: Directly copied to the output
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp account_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history account_id 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history account_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[account_id]
    • Cleaning The column is cast as BIGINT
    • Output Columns:
      • account_id: Mapped after casting to BIGINT
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[account_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • account_id: Directly copied
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp name 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history creative_name 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history creative_name 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report creative_name 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[name]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • creative_name: Renamed and directly mapped
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[creative_name]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • creative_name: Directly copied
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[creative_name]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • creative_name: Directly copied to the output
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp url_tags 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history url_tags 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags key type value 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f1 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history utm_campaign utm_content utm_medium utm_source utm_term 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f3 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f2 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f0 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f1 6. model.facebook_ads.facebook_ads__url_tags:f2->7. model.facebook_ads.int_facebook_ads__creative_history:f4 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report utm_campaign utm_content utm_medium utm_source utm_term 7. model.facebook_ads.int_facebook_ads__creative_history:f3->5. model.facebook_ads.facebook_ads__url_report:f3 7. model.facebook_ads.int_facebook_ads__creative_history:f2->5. model.facebook_ads.facebook_ads__url_report:f2 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 7. model.facebook_ads.int_facebook_ads__creative_history:f1->5. model.facebook_ads.facebook_ads__url_report:f1 7. model.facebook_ads.int_facebook_ads__creative_history:f4->5. model.facebook_ads.facebook_ads__url_report:f4
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[url_tags]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • url_tags: Directly mapped
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[url_tags]
    • Filtering The column is filtered to include only non-null values
    • Cleaning The column is cleaned by parsing JSON
    • Other The column is flattened and its contents are extracted into separate columns
    • Output Columns:
      • key: Extracted from flattened url_tags
      • value: Extracted from flattened url_tags
      • type: Extracted from flattened url_tags
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[key]
    • Featurization Used to pivot the data, extracting different UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[value]
    • Featurization Used as the value for the pivoted UTM parameters
    • Output Columns:
      • utm_source: Mapped when key = 'utm_source'
      • utm_medium: Mapped when key = 'utm_medium'
      • utm_campaign: Mapped when key = 'utm_campaign'
      • utm_content: Mapped when key = 'utm_content'
      • utm_term: Mapped when key = 'utm_term'
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_source]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • utm_source: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_medium]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_medium: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_campaign]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_campaign: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_content]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_content: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_term]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_term: Directly copied to the output
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp _fivetran_synced 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history _fivetran_synced 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[_fivetran_synced]
    • Cleaning The column is cast as TIMESTAMP
    • Deduplication Used in the window function to determine the most recent record
    • Output Columns:
      • _fivetran_synced: Directly mapped
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_child_attachments 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_child_attachments 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_child_attachments]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • object_story_link_data_child_attachments: Directly mapped
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_caption 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_caption 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_caption]
    • Direct The column is directly copied without any transformation
    • Cleaning The column is cast as TEXT
    • Output Columns:
      • object_story_link_data_caption: Directly mapped
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_description 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_description 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_description]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_description: Directly mapped to this output column
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_link 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_link 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history base_url url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f1 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f2 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f3 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f7 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f6 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f4 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f5 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f8 5. model.facebook_ads.facebook_ads__url_report 5. model.facebook_ads.facebook_ads__url_report base_url url_host url_path utm_campaign utm_content utm_medium utm_source utm_term 7. model.facebook_ads.int_facebook_ads__creative_history:f1->5. model.facebook_ads.facebook_ads__url_report:header 7. model.facebook_ads.int_facebook_ads__creative_history:f0->5. model.facebook_ads.facebook_ads__url_report:f0 7. model.facebook_ads.int_facebook_ads__creative_history:f2->5. model.facebook_ads.facebook_ads__url_report:f1 7. model.facebook_ads.int_facebook_ads__creative_history:f3->5. model.facebook_ads.facebook_ads__url_report:f2 7. model.facebook_ads.int_facebook_ads__creative_history:f7->5. model.facebook_ads.facebook_ads__url_report:f6 7. model.facebook_ads.int_facebook_ads__creative_history:f6->5. model.facebook_ads.facebook_ads__url_report:f5 7. model.facebook_ads.int_facebook_ads__creative_history:f4->5. model.facebook_ads.facebook_ads__url_report:f3 7. model.facebook_ads.int_facebook_ads__creative_history:f5->5. model.facebook_ads.facebook_ads__url_report:f4 7. model.facebook_ads.int_facebook_ads__creative_history:f8->5. model.facebook_ads.facebook_ads__url_report:f7
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_link]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_link: Directly mapped to this output column
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[object_story_link_data_link]
    • Cleaning This column is likely used in the COALESCE function with template_page_link to create the 'url' column.
    • Featurization Various parts of the URL are extracted from this column to create different features.
    • Output Columns:
      • url: Potentially used in COALESCE(page_link, template_page_link)
      • base_url: Extracted from this column
      • url_host: Extracted and cleaned from this column
      • url_path: Extracted and cleaned from this column
      • utm_source: Potentially extracted from this column if not found in url_tags
      • utm_medium: Potentially extracted from this column if not found in url_tags
      • utm_campaign: Potentially extracted from this column if not found in url_tags
      • utm_content: Potentially extracted from this column if not found in url_tags
      • utm_term: Potentially extracted from this column if not found in url_tags
5. model.facebook_ads.facebook_ads__url_report
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url]
    • Filtering Used in the WHERE clause to filter out null URLs
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[base_url]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • base_url: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url_host]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • url_host: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[url_path]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • url_path: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_source]
    • Direct The column is directly copied without transformation
    • Output Columns:
      • utm_source: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_medium]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_medium: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_campaign]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_campaign: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_content]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_content: Directly copied to the output
  • Input Column: 7. model.facebook_ads.int_facebook_ads__creative_history[utm_term]
    • Direct The column is directly copied without any transformation
    • Integration The column is used as part of the join condition with the creatives table
    • Output Columns:
      • utm_term: Directly copied to the output
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp object_story_link_data_message 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history object_story_link_data_message 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[object_story_link_data_message]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Output Columns:
      • object_story_link_data_message: Directly mapped to this output column
Column Lineage
%3 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp _fivetran_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history 18. model.facebook_ads_source.stg_facebook_ads__creative_history _fivetran_id is_most_recent_record 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp:f0->18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1 6. model.facebook_ads.facebook_ads__url_tags 6. model.facebook_ads.facebook_ads__url_tags _fivetran_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->6. model.facebook_ads.facebook_ads__url_tags:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->6. model.facebook_ads.facebook_ads__url_tags:header 7. model.facebook_ads.int_facebook_ads__creative_history 7. model.facebook_ads.int_facebook_ads__creative_history _fivetran_id 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f0->7. model.facebook_ads.int_facebook_ads__creative_history:f0 18. model.facebook_ads_source.stg_facebook_ads__creative_history:f1->7. model.facebook_ads.int_facebook_ads__creative_history:header 6. model.facebook_ads.facebook_ads__url_tags:f0->7. model.facebook_ads.int_facebook_ads__creative_history:header
18. model.facebook_ads_source.stg_facebook_ads__creative_history
  • Input Column: 19. model.facebook_ads_source.stg_facebook_ads__creative_history_tmp[_fivetran_id]
    • Direct This column is directly copied without any transformation
    • Cleaning The column is cast as TEXT in the 'fields' CTE
    • Deduplication This column is used in the window function to determine the most recent record
    • Output Columns:
      • _fivetran_id: Directly mapped to this output column
      • is_most_recent_record: Indirectly used to determine this flag
6. model.facebook_ads.facebook_ads__url_tags
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[_fivetran_id]
    • Direct The column is directly copied without any transformation
    • Output Columns:
      • _fivetran_id: Directly copied
  • Input Column: 18. model.facebook_ads_source.stg_facebook_ads__creative_history[is_most_recent_record]
    • Filtering The column is used to filter for the most recent records
7. model.facebook_ads.int_facebook_ads__creative_history
  • Input Column: 6. model.facebook_ads.facebook_ads__url_tags[_fivetran_id]
    • Integration Used to join with the base table
    • Aggregation Used in GROUP BY clause
20. source.facebook_ads_source.facebook_ads.account_history
The model details are not provided
21. source.facebook_ads_source.facebook_ads.ad_history
The model details are not provided
22. source.facebook_ads_source.facebook_ads.ad_set_history
The model details are not provided
23. source.facebook_ads_source.facebook_ads.basic_ad
The model details are not provided
24. source.facebook_ads_source.facebook_ads.campaign_history
The model details are not provided
25. source.facebook_ads_source.facebook_ads.creative_history
The model details are not provided