%3 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history->2. model.amazon_ads.amazon_ads__ad_group_report 8. model.amazon_ads.int_amazon_ads__portfolio_history->3. model.amazon_ads.amazon_ads__ad_report 8. model.amazon_ads.int_amazon_ads__portfolio_history->4. model.amazon_ads.amazon_ads__campaign_report 8. model.amazon_ads.int_amazon_ads__portfolio_history->5. model.amazon_ads.amazon_ads__keyword_report 8. model.amazon_ads.int_amazon_ads__portfolio_history->7. model.amazon_ads.amazon_ads__search_report 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history->2. model.amazon_ads.amazon_ads__ad_group_report 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history->3. model.amazon_ads.amazon_ads__ad_report 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history->5. model.amazon_ads.amazon_ads__keyword_report 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history->7. model.amazon_ads.amazon_ads__search_report 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report->2. model.amazon_ads.amazon_ads__ad_group_report 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report->3. model.amazon_ads.amazon_ads__ad_report 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history->1. model.amazon_ads.amazon_ads__account_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history->2. model.amazon_ads.amazon_ads__ad_group_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history->3. model.amazon_ads.amazon_ads__ad_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history->4. model.amazon_ads.amazon_ads__campaign_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history->5. model.amazon_ads.amazon_ads__keyword_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history->6. model.amazon_ads.amazon_ads__portfolio_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history->7. model.amazon_ads.amazon_ads__search_report 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp->15. model.amazon_ads_source.stg_amazon_ads__campaign_history 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report->1. model.amazon_ads.amazon_ads__account_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report->4. model.amazon_ads.amazon_ads__campaign_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report->6. model.amazon_ads.amazon_ads__portfolio_report 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history->5. model.amazon_ads.amazon_ads__keyword_report 19. model.amazon_ads_source.stg_amazon_ads__keyword_history->7. model.amazon_ads.amazon_ads__search_report 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp->19. model.amazon_ads_source.stg_amazon_ads__keyword_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history->6. model.amazon_ads.amazon_ads__portfolio_report 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history->8. model.amazon_ads.int_amazon_ads__portfolio_history 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history->3. model.amazon_ads.amazon_ads__ad_report 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile->1. model.amazon_ads.amazon_ads__account_report 25. model.amazon_ads_source.stg_amazon_ads__profile->2. model.amazon_ads.amazon_ads__ad_group_report 25. model.amazon_ads_source.stg_amazon_ads__profile->3. model.amazon_ads.amazon_ads__ad_report 25. model.amazon_ads_source.stg_amazon_ads__profile->4. model.amazon_ads.amazon_ads__campaign_report 25. model.amazon_ads_source.stg_amazon_ads__profile->5. model.amazon_ads.amazon_ads__keyword_report 25. model.amazon_ads_source.stg_amazon_ads__profile->6. model.amazon_ads.amazon_ads__portfolio_report 25. model.amazon_ads_source.stg_amazon_ads__profile->7. model.amazon_ads.amazon_ads__search_report 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp->25. model.amazon_ads_source.stg_amazon_ads__profile 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report->7. model.amazon_ads.amazon_ads__search_report 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report->5. model.amazon_ads.amazon_ads__keyword_report 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 31. source.amazon_ads_source.amazon_ads.ad_group_history 31. source.amazon_ads_source.amazon_ads.ad_group_history 31. source.amazon_ads_source.amazon_ads.ad_group_history->10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 32. source.amazon_ads_source.amazon_ads.ad_group_level_report 32. source.amazon_ads_source.amazon_ads.ad_group_level_report 32. source.amazon_ads_source.amazon_ads.ad_group_level_report->12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 33. source.amazon_ads_source.amazon_ads.advertised_product_report 33. source.amazon_ads_source.amazon_ads.advertised_product_report 33. source.amazon_ads_source.amazon_ads.advertised_product_report->14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 34. source.amazon_ads_source.amazon_ads.campaign_history 34. source.amazon_ads_source.amazon_ads.campaign_history 34. source.amazon_ads_source.amazon_ads.campaign_history->16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 35. source.amazon_ads_source.amazon_ads.campaign_level_report 35. source.amazon_ads_source.amazon_ads.campaign_level_report 35. source.amazon_ads_source.amazon_ads.campaign_level_report->18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 36. source.amazon_ads_source.amazon_ads.keyword_history 36. source.amazon_ads_source.amazon_ads.keyword_history 36. source.amazon_ads_source.amazon_ads.keyword_history->20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 37. source.amazon_ads_source.amazon_ads.portfolio_history 37. source.amazon_ads_source.amazon_ads.portfolio_history 37. source.amazon_ads_source.amazon_ads.portfolio_history->22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 38. source.amazon_ads_source.amazon_ads.product_ad_history 38. source.amazon_ads_source.amazon_ads.product_ad_history 38. source.amazon_ads_source.amazon_ads.product_ad_history->24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 39. source.amazon_ads_source.amazon_ads.profile 39. source.amazon_ads_source.amazon_ads.profile 39. source.amazon_ads_source.amazon_ads.profile->26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 40. source.amazon_ads_source.amazon_ads.search_term_ad_keyword_report 40. source.amazon_ads_source.amazon_ads.search_term_ad_keyword_report 40. source.amazon_ads_source.amazon_ads.search_term_ad_keyword_report->28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 41. source.amazon_ads_source.amazon_ads.targeting_keyword_report 41. source.amazon_ads_source.amazon_ads.targeting_keyword_report 41. source.amazon_ads_source.amazon_ads.targeting_keyword_report->30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp
1. model.amazon_ads.amazon_ads__account_report

This SQL query combines data from three sources: campaign level reports, profile information, and campaign history. It filters for non-deleted profiles and the most recent campaign records. The query then joins these tables to create a summarized account-level report, aggregating metrics like cost, clicks, and impressions by account, date, and location. The result provides a daily overview of advertising performance for each Amazon account.

FilteringIntegrationAggregation
SQL Query
with report as (
    select *
    --use campaign report since account report not provided
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__campaign_level_report
), 

account_info as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__profile
    where _fivetran_deleted = False
),

campaigns as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__campaign_history
    where is_most_recent_record = True
),

fields as (
    select
        report.source_relation,
        report.date_day,
        account_info.account_name,
        account_info.account_id,
        account_info.country_code,
        account_info.profile_id,
        sum(report.cost) as cost,
        sum(report.clicks) as clicks,
        sum(report.impressions) as impressions 

        --use campaign report since portfolio report not provided
        





    from report

    left join campaigns
        on campaigns.campaign_id = report.campaign_id
        and campaigns.source_relation = report.source_relation
    left join account_info
        on account_info.profile_id = campaigns.profile_id
        and account_info.source_relation = campaigns.source_relation
    

    group by 1,2,3,4,5,6
)

select *
from fields
%3 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report date_day account_name account_id country_code profile_id cost clicks impressions 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_id profile_id is_most_recent_record 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f1->1. model.amazon_ads.amazon_ads__account_report:f4 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_id clicks cost date_day impressions 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f1->1. model.amazon_ads.amazon_ads__account_report:f6 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f2->1. model.amazon_ads.amazon_ads__account_report:f5 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f3->1. model.amazon_ads.amazon_ads__account_report:f0 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f4->1. model.amazon_ads.amazon_ads__account_report:f7 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile profile_id account_id account_name country_code _fivetran_deleted 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->1. model.amazon_ads.amazon_ads__account_report:f4 25. model.amazon_ads_source.stg_amazon_ads__profile:f1->1. model.amazon_ads.amazon_ads__account_report:f2 25. model.amazon_ads_source.stg_amazon_ads__profile:f2->1. model.amazon_ads.amazon_ads__account_report:f1 25. model.amazon_ads_source.stg_amazon_ads__profile:f3->1. model.amazon_ads.amazon_ads__account_report:f3
Name Type Comment
date_day date None
account_name text None
account_id text None
country_code text None
profile_id text None
cost double precision None
clicks bigint None
impressions bigint None
Column Lineage
%3 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report date_day 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report date_day 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->1. model.amazon_ads.amazon_ads__account_report:f0 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp date 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[date]
    • Cleaning: The column is renamed to date_day in the final output
    • Output Columns:
      • date_day: Directly mapped and renamed
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[date_day]
    • Direct: Copied without transformation
    • Aggregation: Used in the GROUP BY clause
    • Output Columns:
      • date_day: Directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_name 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->1. model.amazon_ads.amazon_ads__account_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_name 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_name]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • account_name: Directly copied
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • account_name: Directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_id 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->1. model.amazon_ads.amazon_ads__account_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_id]
    • Cleaning: The column is cast to TEXT
    • Output Columns:
      • account_id: Directly mapped after casting to TEXT
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: Directly copied to the output
    • Output Columns:
      • account_id: Directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile country_code 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->1. model.amazon_ads.amazon_ads__account_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp country_code 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[country_code]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • country_code: Directly copied
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: Directly copied to the output
    • Output Columns:
      • country_code: Directly copied
Column Lineage
%3 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history profile_id 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report profile_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->1. model.amazon_ads.amazon_ads__account_report:f0 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->1. model.amazon_ads.amazon_ads__account_report:f0 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp profile_id 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[profile_id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • profile_id: Directly mapped after casting to TEXT
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[id]
    • Cleaning: The column is cast to TEXT and renamed to profile_id
    • Output Columns:
      • profile_id: Directly mapped after casting to TEXT
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[profile_id]
    • Integration: used as a key to join with the account_info table
    • Output Columns:
      • profile_id: Directly copied to the output
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: Used as a key to join with other tables
    • Direct: Directly copied to the output
    • Output Columns:
      • profile_id: Directly copied
Column Lineage
%3 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report cost 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report cost 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->1. model.amazon_ads.amazon_ads__account_report:f0 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp cost 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[cost]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • cost: Directly mapped
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[cost]
    • Aggregation: Summed up in the fields CTE
    • Output Columns:
      • cost: Directly mapped after aggregation
Column Lineage
%3 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report clicks 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report clicks 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->1. model.amazon_ads.amazon_ads__account_report:f0 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp clicks 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[clicks]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • clicks: Directly mapped
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[clicks]
    • Aggregation: Summed up in the fields CTE
    • Output Columns:
      • clicks: Directly mapped after aggregation
Column Lineage
%3 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report impressions 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report impressions 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->1. model.amazon_ads.amazon_ads__account_report:f0 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp impressions 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[impressions]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • impressions: Directly mapped
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[impressions]
    • Aggregation: Summed up in the fields CTE
    • Output Columns:
      • impressions: Directly mapped after aggregation
2. model.amazon_ads.amazon_ads__ad_group_report

This query integrates data from multiple Amazon Ads-related tables, including ad group reports, account information, portfolios, campaigns, and ad groups. It joins these tables to create a comprehensive view of ad performance metrics (cost, clicks, impressions) at the ad group level, including associated account, portfolio, and campaign details. The query filters for the most recent records in some tables and aggregates the performance metrics.

FilteringIntegrationAggregation
SQL Query
with report as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__ad_group_level_report
), 

account_info as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__profile
    where _fivetran_deleted = False
),

portfolios as (
    select *
    from TEST.PUBLIC_amazon_ads.int_amazon_ads__portfolio_history
), 

campaigns as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__campaign_history
    where is_most_recent_record = True
),

ad_groups as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__ad_group_history
    where is_most_recent_record = True
), 

fields as (
    select
        report.source_relation,
        report.date_day,
        account_info.account_name,
        account_info.account_id,
        account_info.country_code,
        account_info.profile_id,
        portfolios.portfolio_name,
        portfolios.portfolio_id,
        campaigns.campaign_name,
        campaigns.campaign_id,
        ad_groups.ad_group_name,
        report.ad_group_id,
        ad_groups.serving_status,
        ad_groups.state,
        ad_groups.default_bid,
        report.campaign_bidding_strategy,
        sum(report.cost) as cost,
        sum(report.clicks) as clicks,
        sum(report.impressions) as impressions 

        





    from report

    left join ad_groups
        on ad_groups.ad_group_id = report.ad_group_id
        and ad_groups.source_relation = report.source_relation
    left join campaigns
        on campaigns.campaign_id = ad_groups.campaign_id
        and campaigns.source_relation = ad_groups.source_relation
    left join portfolios
        on portfolios.portfolio_id = campaigns.portfolio_id
        and portfolios.source_relation = campaigns.source_relation
    left join account_info
        on account_info.profile_id = campaigns.profile_id
        and account_info.source_relation = campaigns.source_relation

    group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
)

select *
from fields
%3 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report date_day account_name account_id country_code profile_id portfolio_name portfolio_id campaign_name campaign_id ad_group_name ad_group_id serving_status state default_bid campaign_bidding_strategy cost clicks impressions 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_id portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f6 8. model.amazon_ads.int_amazon_ads__portfolio_history:f1->2. model.amazon_ads.amazon_ads__ad_group_report:f5 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history ad_group_id campaign_id default_bid ad_group_name serving_status state is_most_recent_record 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f10 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f2->2. model.amazon_ads.amazon_ads__ad_group_report:f13 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f3->2. model.amazon_ads.amazon_ads__ad_group_report:f9 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f4->2. model.amazon_ads.amazon_ads__ad_group_report:f11 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f5->2. model.amazon_ads.amazon_ads__ad_group_report:f12 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report ad_group_id campaign_bidding_strategy clicks cost date_day impressions 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f10 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f1->2. model.amazon_ads.amazon_ads__ad_group_report:f14 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f2->2. model.amazon_ads.amazon_ads__ad_group_report:f16 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f3->2. model.amazon_ads.amazon_ads__ad_group_report:f15 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f4->2. model.amazon_ads.amazon_ads__ad_group_report:f0 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f5->2. model.amazon_ads.amazon_ads__ad_group_report:f17 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_id campaign_name portfolio_id profile_id is_most_recent_record 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f8 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f1->2. model.amazon_ads.amazon_ads__ad_group_report:f7 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile profile_id account_id account_name country_code _fivetran_deleted 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f4 25. model.amazon_ads_source.stg_amazon_ads__profile:f1->2. model.amazon_ads.amazon_ads__ad_group_report:f2 25. model.amazon_ads_source.stg_amazon_ads__profile:f2->2. model.amazon_ads.amazon_ads__ad_group_report:f1 25. model.amazon_ads_source.stg_amazon_ads__profile:f3->2. model.amazon_ads.amazon_ads__ad_group_report:f3
Name Type Comment
date_day date None
account_name text None
account_id text None
country_code text None
profile_id text None
portfolio_name text None
portfolio_id text None
campaign_name text None
campaign_id text None
ad_group_name text None
ad_group_id text None
serving_status text None
state text None
default_bid double precision None
campaign_bidding_strategy text None
cost double precision None
clicks bigint None
impressions bigint None
Column Lineage
%3 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report date_day 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report date_day 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp date 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report
  • Input Column: 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp[date]
    • Cleaning: The column is cast to DATE type and renamed
    • Output Columns:
      • date_day: Directly mapped after casting to DATE
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report[date_day]
    • Direct: directly selected in the output without transformation
    • Aggregation: used in the GROUP BY clause
    • Output Columns:
      • date_day: directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_name 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_name 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_name]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • account_name: Directly copied
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • account_name: Directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_id 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_id]
    • Cleaning: The column is cast to TEXT
    • Output Columns:
      • account_id: Directly mapped after casting to TEXT
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: Directly copied to the output
    • Output Columns:
      • account_id: Directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile country_code 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp country_code 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[country_code]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • country_code: Directly copied
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: Directly copied to the output
    • Output Columns:
      • country_code: Directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile profile_id 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[id]
    • Cleaning: The column is cast to TEXT and renamed to profile_id
    • Output Columns:
      • profile_id: Directly mapped after casting to TEXT
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: Used as a key to join with the campaigns table
    • Direct: Directly copied to the output
    • Output Columns:
      • profile_id: Directly copied
Column Lineage
%3 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_name 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_name 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp name 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[name]
    • Direct: Copied without transformation
    • Output Columns:
      • portfolio_name: Directly copied and renamed
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_name]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • portfolio_name: Directly copied
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: directly copied to the output
    • Output Columns:
      • portfolio_name: directly copied
Column Lineage
%3 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_id 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_id 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp id 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • portfolio_id: Directly mapped after casting
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_id]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • portfolio_id: Directly copied
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Integration: used as a key to join with the campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • portfolio_id: directly copied
Column Lineage
%3 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_name 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report campaign_name 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp name 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[name]
    • Direct: Copied without transformation
    • Output Columns:
      • campaign_name: Directly copied and renamed
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_name]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_name: Directly copied
Column Lineage
%3 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_id 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report campaign_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp id 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Deduplication: Used in the window function to identify the most recent record
    • Output Columns:
      • campaign_id: Directly mapped after casting to TEXT
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Direct: The column is directly copied without any transformation
    • Integration: The column is used as a key to join with ad_groups table
    • Output Columns:
      • campaign_id: Directly copied
Column Lineage
%3 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history ad_group_name 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report ad_group_name 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp name 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[name]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • ad_group_name: directly copied after casting and renaming
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_name]
    • Direct: directly copied to the output
    • Output Columns:
      • ad_group_name: directly copied
Column Lineage
%3 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history ad_group_id 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report ad_group_id 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report ad_group_id 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp id 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp ad_group_id 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[id]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • ad_group_id: directly copied after casting
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report
  • Input Column: 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp[ad_group_id]
    • Cleaning: The column is cast to TEXT in the final selection
    • Output Columns:
      • ad_group_id: Directly mapped after casting to TEXT
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_id]
    • Integration: used as a key to join with the report table
    • Direct: directly copied to the output
    • Output Columns:
      • ad_group_id: directly copied
  • Input Column: 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report[ad_group_id]
    • Integration: used as a key to join with the ad_groups table
    • Aggregation: used in the GROUP BY clause
    • Output Columns:
      • ad_group_id: directly copied
Column Lineage
%3 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history serving_status 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report serving_status 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp serving_status 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[serving_status]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • serving_status: directly copied after casting
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[serving_status]
    • Direct: directly copied to the output
    • Output Columns:
      • serving_status: directly copied
Column Lineage
%3 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history state 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report state 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp state 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[state]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • state: directly copied after casting
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[state]
    • Direct: directly copied to the output
    • Output Columns:
      • state: directly copied
Column Lineage
%3 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history default_bid 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report default_bid 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp default_bid 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[default_bid]
    • Cleaning: cast to float data type
    • Output Columns:
      • default_bid: directly copied after casting
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[default_bid]
    • Direct: directly copied to the output
    • Output Columns:
      • default_bid: directly copied
Column Lineage
%3 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report campaign_bidding_strategy 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report campaign_bidding_strategy 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp campaign_bidding_strategy 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report
  • Input Column: 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp[campaign_bidding_strategy]
    • Cleaning: The column is cast to TEXT
    • Output Columns:
      • campaign_bidding_strategy: Directly mapped after casting to TEXT
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report[campaign_bidding_strategy]
    • Direct: directly selected in the output without transformation
    • Aggregation: used in the GROUP BY clause
    • Output Columns:
      • campaign_bidding_strategy: directly copied
Column Lineage
%3 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report cost 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report cost 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp cost 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report
  • Input Column: 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp[cost]
    • Cleaning: The column is cast to FLOAT
    • Output Columns:
      • cost: Directly mapped after casting to FLOAT
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report[cost]
    • Aggregation: summed up in the SELECT clause
    • Output Columns:
      • cost: aggregated sum
Column Lineage
%3 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report clicks 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report clicks 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp clicks 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report
  • Input Column: 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp[clicks]
    • Cleaning: The column is cast to INTEGER
    • Output Columns:
      • clicks: Directly mapped after casting to INTEGER
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report[clicks]
    • Aggregation: summed up in the SELECT clause
    • Output Columns:
      • clicks: aggregated sum
Column Lineage
%3 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report impressions 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report impressions 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp impressions 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report
  • Input Column: 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp[impressions]
    • Cleaning: The column is cast to INTEGER
    • Output Columns:
      • impressions: Directly mapped after casting to INTEGER
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report[impressions]
    • Aggregation: summed up in the SELECT clause
    • Output Columns:
      • impressions: aggregated sum
3. model.amazon_ads.amazon_ads__ad_report

This SQL query integrates data from multiple Amazon Ads-related tables to create a comprehensive ad report. It joins information from advertised product reports, account profiles, portfolios, campaigns, ad groups, and product ads. The query filters for the most recent records in some tables, aggregates cost, clicks, and impressions data, and combines various attributes such as account details, campaign information, and ad specifics into a single result set.

FilteringIntegrationAggregation
SQL Query
with report as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__advertised_product_report
), 

account_info as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__profile
    where _fivetran_deleted = False
),

portfolios as (
    select *
    from TEST.PUBLIC_amazon_ads.int_amazon_ads__portfolio_history
), 

campaigns as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__campaign_history
    where is_most_recent_record = True
),

ad_groups as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__ad_group_history
    where is_most_recent_record = True
), 

ads as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__product_ad_history
    where is_most_recent_record = True
),

fields as (
    select
        report.source_relation,
        report.date_day,
        account_info.account_name,
        account_info.account_id,
        account_info.country_code,
        account_info.profile_id,
        portfolios.portfolio_name,
        portfolios.portfolio_id,
        campaigns.campaign_name,
        report.campaign_id,
        ad_groups.ad_group_name,
        report.ad_group_id,
        report.ad_id,
        ads.serving_status,
        ads.state,
        report.advertised_asin,
        report.advertised_sku,
        report.campaign_budget_amount,
        report.campaign_budget_currency_code,
        report.campaign_budget_type,
        sum(report.cost) as cost,
        sum(report.clicks) as clicks,
        sum(report.impressions) as impressions 

        





    from report
    
    left join ads
        on ads.ad_id = report.ad_id
        and ads.source_relation = report.source_relation
    left join ad_groups
        on ad_groups.ad_group_id = report.ad_group_id
        and ad_groups.source_relation = report.source_relation
    left join campaigns
        on campaigns.campaign_id = report.campaign_id
        and campaigns.source_relation = report.source_relation
    left join portfolios
        on portfolios.portfolio_id = campaigns.portfolio_id
        and portfolios.source_relation = campaigns.source_relation 
    left join account_info
        on account_info.profile_id = campaigns.profile_id
        and account_info.source_relation = campaigns.source_relation 

    group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20
)

select *
from fields
%3 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report date_day account_name account_id country_code profile_id portfolio_name portfolio_id campaign_name campaign_id ad_group_name ad_group_id ad_id serving_status state advertised_asin advertised_sku campaign_budget_amount campaign_budget_currency_code campaign_budget_type cost clicks impressions 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_id portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f6 8. model.amazon_ads.int_amazon_ads__portfolio_history:f1->3. model.amazon_ads.amazon_ads__ad_report:f5 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history ad_group_id ad_group_name is_most_recent_record 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f10 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f1->3. model.amazon_ads.amazon_ads__ad_report:f9 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report ad_id ad_group_id advertised_asin advertised_sku campaign_budget_amount campaign_budget_currency_code campaign_budget_type campaign_id clicks cost date_day impressions 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f11 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f1->3. model.amazon_ads.amazon_ads__ad_report:f10 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f2->3. model.amazon_ads.amazon_ads__ad_report:f14 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f3->3. model.amazon_ads.amazon_ads__ad_report:f15 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f4->3. model.amazon_ads.amazon_ads__ad_report:f16 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f5->3. model.amazon_ads.amazon_ads__ad_report:f17 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f6->3. model.amazon_ads.amazon_ads__ad_report:f18 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f7->3. model.amazon_ads.amazon_ads__ad_report:f8 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f8->3. model.amazon_ads.amazon_ads__ad_report:f20 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f9->3. model.amazon_ads.amazon_ads__ad_report:f19 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f10->3. model.amazon_ads.amazon_ads__ad_report:f0 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f11->3. model.amazon_ads.amazon_ads__ad_report:f21 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_id campaign_name portfolio_id profile_id is_most_recent_record 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f8 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f1->3. model.amazon_ads.amazon_ads__ad_report:f7 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history ad_id serving_status state is_most_recent_record 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f11 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f1->3. model.amazon_ads.amazon_ads__ad_report:f12 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f2->3. model.amazon_ads.amazon_ads__ad_report:f13 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile profile_id account_id account_name country_code _fivetran_deleted 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->3. model.amazon_ads.amazon_ads__ad_report:f4 25. model.amazon_ads_source.stg_amazon_ads__profile:f1->3. model.amazon_ads.amazon_ads__ad_report:f2 25. model.amazon_ads_source.stg_amazon_ads__profile:f2->3. model.amazon_ads.amazon_ads__ad_report:f1 25. model.amazon_ads_source.stg_amazon_ads__profile:f3->3. model.amazon_ads.amazon_ads__ad_report:f3
Name Type Comment
date_day date None
account_name text None
account_id text None
country_code text None
profile_id text None
portfolio_name text None
portfolio_id text None
campaign_name text None
campaign_id text None
ad_group_name text None
ad_group_id text None
ad_id text None
serving_status text None
state text None
advertised_asin integer None
advertised_sku integer None
campaign_budget_amount double precision None
campaign_budget_currency_code text None
campaign_budget_type text None
cost double precision None
clicks bigint None
impressions bigint None
Column Lineage
%3 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report date_day 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report date_day 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp date 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[date]
    • Cleaning: The column is cast to DATE type
    • Output Columns:
      • date_day: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[date_day]
    • Direct: The column is directly copied without any transformation
    • Aggregation: Used in the group by clause
    • Output Columns:
      • date_day: Directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_name 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_name 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_name]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • account_name: Directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: directly copied to the output
    • Output Columns:
      • account_name: directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_id 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_id]
    • Cleaning: The column is cast to TEXT
    • Output Columns:
      • account_id: Directly mapped after casting to TEXT
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: directly copied to the output
    • Output Columns:
      • account_id: directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile country_code 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp country_code 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[country_code]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • country_code: Directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: directly copied to the output
    • Output Columns:
      • country_code: directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile profile_id 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[id]
    • Cleaning: The column is cast to TEXT and renamed to profile_id
    • Output Columns:
      • profile_id: Directly mapped after casting to TEXT
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: used as a key to join with the campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • profile_id: directly copied
Column Lineage
%3 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_name 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_name 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp name 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[name]
    • Direct: Copied without transformation
    • Output Columns:
      • portfolio_name: Directly copied and renamed
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_name]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • portfolio_name: Directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • portfolio_name: Directly copied
Column Lineage
%3 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_id 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_id 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp id 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • portfolio_id: Directly mapped after casting
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_id]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • portfolio_id: Directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Direct: The column is directly copied without any transformation
    • Integration: The column is used as a key to join with the campaigns table
    • Output Columns:
      • portfolio_id: Directly copied
Column Lineage
%3 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_name 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report campaign_name 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp name 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[name]
    • Direct: Copied without transformation
    • Output Columns:
      • campaign_name: Directly copied and renamed
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_name]
    • Direct: directly copied to the output
    • Output Columns:
      • campaign_name: directly copied
Column Lineage
%3 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report campaign_id 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report campaign_id 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp campaign_id 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp id 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[campaign_id]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • campaign_id: Directly mapped after casting
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Deduplication: Used in the window function to identify the most recent record
    • Output Columns:
      • campaign_id: Directly mapped after casting to TEXT
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[campaign_id]
    • Direct: The column is directly copied without any transformation
    • Integration: Used as a key to join with the campaigns table
    • Output Columns:
      • campaign_id: Directly copied
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Integration: used to join with the report table
    • Direct: directly copied to the output
    • Output Columns:
      • campaign_id: directly copied
Column Lineage
%3 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history ad_group_name 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report ad_group_name 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp name 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[name]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • ad_group_name: directly copied after casting and renaming
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • ad_group_name: Directly copied
Column Lineage
%3 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history ad_group_id 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report ad_group_id 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report ad_group_id 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp id 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp ad_group_id 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[id]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • ad_group_id: directly copied after casting
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[ad_group_id]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • ad_group_id: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_id]
    • Integration: Used as a key to join with the report table
    • Direct: Directly copied to the output
    • Output Columns:
      • ad_group_id: Directly copied
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[ad_group_id]
    • Direct: The column is directly copied without any transformation
    • Integration: Used as a key to join with the ad_groups table
    • Output Columns:
      • ad_group_id: Directly copied
Column Lineage
%3 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report ad_id 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report ad_id 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history ad_id 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp ad_id 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp id 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[ad_id]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • ad_id: Directly mapped after casting
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Deduplication: Used in row_number() function for identifying the most recent record
    • Output Columns:
      • ad_id: Directly mapped after casting to TEXT
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[ad_id]
    • Direct: The column is directly copied without any transformation
    • Integration: Used as a key to join with the ads table
    • Output Columns:
      • ad_id: Directly copied
  • Input Column: 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history[ad_id]
    • Direct: The column is directly copied without any transformation
    • Integration: The column is used as a key to join with the report table
    • Output Columns:
      • ad_id: Directly mapped
Column Lineage
%3 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history serving_status 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report serving_status 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp serving_status 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[serving_status]
    • Direct: Copied without transformation
    • Output Columns:
      • serving_status: Directly mapped
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history[serving_status]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • serving_status: Directly mapped
Column Lineage
%3 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history state 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report state 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp state 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[state]
    • Direct: Copied without transformation
    • Output Columns:
      • state: Directly mapped
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history[state]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • state: Directly mapped
Column Lineage
%3 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report advertised_asin 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report advertised_asin 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp advertised_asin 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[advertised_asin]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • advertised_asin: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[advertised_asin]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • advertised_asin: Directly copied
Column Lineage
%3 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report advertised_sku 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report advertised_sku 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp advertised_sku 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[advertised_sku]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • advertised_sku: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[advertised_sku]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • advertised_sku: Directly copied
Column Lineage
%3 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report campaign_budget_amount 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report campaign_budget_amount 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp campaign_budget_amount 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[campaign_budget_amount]
    • Cleaning: The column is cast to FLOAT type
    • Output Columns:
      • campaign_budget_amount: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[campaign_budget_amount]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_budget_amount: Directly copied
Column Lineage
%3 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report campaign_budget_currency_code 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report campaign_budget_currency_code 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp campaign_budget_currency_code 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[campaign_budget_currency_code]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • campaign_budget_currency_code: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[campaign_budget_currency_code]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_budget_currency_code: Directly copied
Column Lineage
%3 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report campaign_budget_type 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report campaign_budget_type 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp campaign_budget_type 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[campaign_budget_type]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • campaign_budget_type: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[campaign_budget_type]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_budget_type: Directly copied
Column Lineage
%3 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report cost 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report cost 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp cost 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[cost]
    • Cleaning: The column is cast to FLOAT type
    • Output Columns:
      • cost: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[cost]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • cost: Aggregated sum
Column Lineage
%3 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report clicks 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report clicks 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp clicks 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[clicks]
    • Cleaning: The column is cast to INTEGER type
    • Output Columns:
      • clicks: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[clicks]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • clicks: Aggregated sum
Column Lineage
%3 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report impressions 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report impressions 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp impressions 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[impressions]
    • Cleaning: The column is cast to INTEGER type
    • Output Columns:
      • impressions: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[impressions]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • impressions: Aggregated sum
4. model.amazon_ads.amazon_ads__campaign_report

This SQL query integrates data from multiple Amazon Ads-related tables (campaign reports, account information, portfolios, and campaigns) to create a comprehensive campaign performance report. It joins these tables based on various ID fields and source relations, and then aggregates metrics such as cost, clicks, and impressions at the campaign level. The query also includes relevant information like account details, portfolio names, and campaign attributes.

IntegrationAggregationFiltering
SQL Query
with report as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__campaign_level_report
), 

account_info as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__profile
    where _fivetran_deleted = False
),

portfolios as (
    select *
    from TEST.PUBLIC_amazon_ads.int_amazon_ads__portfolio_history
), 

campaigns as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__campaign_history
    where is_most_recent_record = True
),

fields as (
    select
        report.source_relation,
        report.date_day,
        account_info.account_name,
        account_info.account_id,
        account_info.country_code,
        account_info.profile_id,
        portfolios.portfolio_name,
        portfolios.portfolio_id,
        campaigns.campaign_name,
        report.campaign_id,
        report.campaign_bidding_strategy,
        report.campaign_budget_amount,
        report.campaign_budget_currency_code,
        report.campaign_budget_type,
        sum(report.cost) as cost,
        sum(report.clicks) as clicks,
        sum(report.impressions) as impressions 

        





    from report

    left join campaigns
        on campaigns.campaign_id = report.campaign_id
        and campaigns.source_relation = report.source_relation
    left join portfolios
        on portfolios.portfolio_id = campaigns.portfolio_id
        and portfolios.source_relation = campaigns.source_relation 
    left join account_info
        on account_info.profile_id = campaigns.profile_id
        and account_info.source_relation = campaigns.source_relation 

    group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14
)

select *
from fields
%3 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report date_day account_name account_id country_code profile_id portfolio_name portfolio_id campaign_name campaign_id campaign_bidding_strategy campaign_budget_amount campaign_budget_currency_code campaign_budget_type cost clicks impressions 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_id portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:f6 8. model.amazon_ads.int_amazon_ads__portfolio_history:f1->4. model.amazon_ads.amazon_ads__campaign_report:f5 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_id campaign_name portfolio_id profile_id is_most_recent_record 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:f8 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f1->4. model.amazon_ads.amazon_ads__campaign_report:f7 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_bidding_strategy campaign_budget_amount campaign_budget_currency_code campaign_budget_type campaign_id clicks cost date_day impressions 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f9 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f1->4. model.amazon_ads.amazon_ads__campaign_report:f10 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f2->4. model.amazon_ads.amazon_ads__campaign_report:f11 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f3->4. model.amazon_ads.amazon_ads__campaign_report:f12 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f4->4. model.amazon_ads.amazon_ads__campaign_report:f8 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f5->4. model.amazon_ads.amazon_ads__campaign_report:f14 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f6->4. model.amazon_ads.amazon_ads__campaign_report:f13 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f7->4. model.amazon_ads.amazon_ads__campaign_report:f0 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f8->4. model.amazon_ads.amazon_ads__campaign_report:f15 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile profile_id account_id account_name country_code _fivetran_deleted 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->4. model.amazon_ads.amazon_ads__campaign_report:f4 25. model.amazon_ads_source.stg_amazon_ads__profile:f1->4. model.amazon_ads.amazon_ads__campaign_report:f2 25. model.amazon_ads_source.stg_amazon_ads__profile:f2->4. model.amazon_ads.amazon_ads__campaign_report:f1 25. model.amazon_ads_source.stg_amazon_ads__profile:f3->4. model.amazon_ads.amazon_ads__campaign_report:f3
Name Type Comment
date_day date None
account_name text None
account_id text None
country_code text None
profile_id text None
portfolio_name text None
portfolio_id text None
campaign_name text None
campaign_id text None
campaign_bidding_strategy text None
campaign_budget_amount double precision None
campaign_budget_currency_code text None
campaign_budget_type text None
cost double precision None
clicks bigint None
impressions bigint None
Column Lineage
%3 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report date_day 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report date_day 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp date 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[date]
    • Cleaning: The column is renamed to date_day in the final output
    • Output Columns:
      • date_day: Directly mapped and renamed
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[date_day]
    • Direct: The column is directly copied without any transformation
    • Aggregation: Used in the group by clause
    • Output Columns:
      • date_day: Directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_name 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_name 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_name]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • account_name: Directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • account_name: Directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_id 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_id]
    • Cleaning: The column is cast to TEXT
    • Output Columns:
      • account_id: Directly mapped after casting to TEXT
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: Directly copied to the output
    • Output Columns:
      • account_id: Directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile country_code 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp country_code 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[country_code]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • country_code: Directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: Directly copied to the output
    • Output Columns:
      • country_code: Directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile profile_id 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[id]
    • Cleaning: The column is cast to TEXT and renamed to profile_id
    • Output Columns:
      • profile_id: Directly mapped after casting to TEXT
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: Used as a key to join with the campaigns table
    • Direct: Directly copied to the output
    • Output Columns:
      • profile_id: Directly copied
Column Lineage
%3 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_name 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_name 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp name 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[name]
    • Direct: Copied without transformation
    • Output Columns:
      • portfolio_name: Directly copied and renamed
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_name]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • portfolio_name: Directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • portfolio_name: Directly copied
Column Lineage
%3 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_id 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_id 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp id 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • portfolio_id: Directly mapped after casting
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_id]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • portfolio_id: Directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Integration: Used as a key to join with the campaigns table
    • Direct: Directly copied to the output
    • Output Columns:
      • portfolio_id: Directly copied
Column Lineage
%3 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_name 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_name 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp name 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[name]
    • Direct: Copied without transformation
    • Output Columns:
      • campaign_name: Directly copied and renamed
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • campaign_name: Directly copied
Column Lineage
%3 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_id 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_id 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp id 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_id 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Deduplication: Used in the window function to identify the most recent record
    • Output Columns:
      • campaign_id: Directly mapped after casting to TEXT
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_id]
    • Cleaning: The column is cast as TEXT in the final output
    • Output Columns:
      • campaign_id: Directly mapped after casting to TEXT
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Integration: Used to join with the report table
    • Direct: Directly copied to the output
    • Output Columns:
      • campaign_id: Directly copied
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_id]
    • Direct: The column is directly copied without any transformation
    • Integration: Used as a key to join with the campaigns table
    • Output Columns:
      • campaign_id: Directly copied
Column Lineage
%3 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_bidding_strategy 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_bidding_strategy 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_bidding_strategy 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_bidding_strategy]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_bidding_strategy: Directly mapped
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_bidding_strategy]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_bidding_strategy: Directly copied
Column Lineage
%3 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_budget_amount 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_budget_amount 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_budget_amount 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_budget_amount]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_budget_amount: Directly mapped
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_budget_amount]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_budget_amount: Directly copied
Column Lineage
%3 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_budget_currency_code 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_budget_currency_code 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_budget_currency_code 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_budget_currency_code]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_budget_currency_code: Directly mapped
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_budget_currency_code]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_budget_currency_code: Directly copied
Column Lineage
%3 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_budget_type 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_budget_type 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_budget_type 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_budget_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_budget_type: Directly mapped
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_budget_type]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_budget_type: Directly copied
Column Lineage
%3 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report cost 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report cost 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp cost 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[cost]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • cost: Directly mapped
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[cost]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • cost: Aggregated sum
Column Lineage
%3 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report clicks 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report clicks 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp clicks 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[clicks]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • clicks: Directly mapped
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[clicks]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • clicks: Aggregated sum
Column Lineage
%3 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report impressions 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report impressions 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp impressions 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[impressions]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • impressions: Directly mapped
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[impressions]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • impressions: Aggregated sum
5. model.amazon_ads.amazon_ads__keyword_report

This SQL query combines data from multiple Amazon Ads-related tables to create a comprehensive keyword report. It joins keyword performance data with account, portfolio, campaign, ad group, and keyword information. The query filters for the most recent records in some tables, aggregates cost, clicks, and impressions data, and provides a detailed view of keyword performance across different levels of the advertising structure.

FilteringIntegrationAggregation
SQL Query
with report as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__targeting_keyword_report
), 

account_info as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__profile
    where _fivetran_deleted = False
),

portfolios as (
    select *
    from TEST.PUBLIC_amazon_ads.int_amazon_ads__portfolio_history
), 

campaigns as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__campaign_history
    where is_most_recent_record = True
),

ad_groups as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__ad_group_history
    where is_most_recent_record = True
), 

keywords as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__keyword_history
    where is_most_recent_record = True
), 

fields as (
    select
        report.source_relation,
        report.date_day,
        account_info.account_name,
        account_info.account_id,
        account_info.country_code,
        account_info.profile_id,
        portfolios.portfolio_name,
        portfolios.portfolio_id,
        campaigns.campaign_name,
        report.campaign_id,
        ad_groups.ad_group_name,
        report.ad_group_id,
        report.keyword_id,
        keywords.keyword_text,
        keywords.serving_status,
        keywords.state,
        report.keyword_bid,
        report.keyword_type,
        report.match_type,
        sum(report.cost) as cost,
        sum(report.clicks) as clicks,
        sum(report.impressions) as impressions 

        





    from report

    left join keywords
        on keywords.keyword_id = report.keyword_id
        and keywords.source_relation = report.source_relation
    left join ad_groups
        on ad_groups.ad_group_id = report.ad_group_id
        and ad_groups.source_relation = report.source_relation
    left join campaigns
        on campaigns.campaign_id = report.campaign_id
        and campaigns.source_relation = report.source_relation
    left join portfolios
        on portfolios.portfolio_id = campaigns.portfolio_id
        and portfolios.source_relation = campaigns.source_relation
    left join account_info
        on account_info.profile_id = campaigns.profile_id
        and account_info.source_relation = campaigns.source_relation

    group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
)

select *
from fields
%3 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report date_day account_name account_id country_code profile_id portfolio_name portfolio_id campaign_name campaign_id ad_group_name ad_group_id keyword_id keyword_text serving_status state keyword_bid keyword_type match_type cost clicks impressions 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_id portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f6 8. model.amazon_ads.int_amazon_ads__portfolio_history:f1->5. model.amazon_ads.amazon_ads__keyword_report:f5 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history ad_group_id campaign_id ad_group_name is_most_recent_record 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f10 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f2->5. model.amazon_ads.amazon_ads__keyword_report:f9 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_id campaign_name portfolio_id profile_id is_most_recent_record 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f8 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f1->5. model.amazon_ads.amazon_ads__keyword_report:f7 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history keyword_id keyword_text serving_status state is_most_recent_record 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f11 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f1->5. model.amazon_ads.amazon_ads__keyword_report:f12 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f2->5. model.amazon_ads.amazon_ads__keyword_report:f13 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f3->5. model.amazon_ads.amazon_ads__keyword_report:f14 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile profile_id account_id account_name country_code _fivetran_deleted 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->5. model.amazon_ads.amazon_ads__keyword_report:f4 25. model.amazon_ads_source.stg_amazon_ads__profile:f1->5. model.amazon_ads.amazon_ads__keyword_report:f2 25. model.amazon_ads_source.stg_amazon_ads__profile:f2->5. model.amazon_ads.amazon_ads__keyword_report:f1 25. model.amazon_ads_source.stg_amazon_ads__profile:f3->5. model.amazon_ads.amazon_ads__keyword_report:f3 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report ad_group_id campaign_id clicks cost date_day impressions keyword_bid keyword_id keyword_type match_type 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f10 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f1->5. model.amazon_ads.amazon_ads__keyword_report:f8 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f2->5. model.amazon_ads.amazon_ads__keyword_report:f19 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f3->5. model.amazon_ads.amazon_ads__keyword_report:f18 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f4->5. model.amazon_ads.amazon_ads__keyword_report:f0 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f5->5. model.amazon_ads.amazon_ads__keyword_report:f20 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f6->5. model.amazon_ads.amazon_ads__keyword_report:f15 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f7->5. model.amazon_ads.amazon_ads__keyword_report:f11 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f8->5. model.amazon_ads.amazon_ads__keyword_report:f16 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f9->5. model.amazon_ads.amazon_ads__keyword_report:f17
Name Type Comment
date_day date None
account_name text None
account_id text None
country_code text None
profile_id text None
portfolio_name text None
portfolio_id text None
campaign_name text None
campaign_id text None
ad_group_name text None
ad_group_id text None
keyword_id text None
keyword_text text None
serving_status text None
state text None
keyword_bid double precision None
keyword_type text None
match_type text None
cost double precision None
clicks bigint None
impressions bigint None
Column Lineage
%3 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report date_day 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report date_day 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp date 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[date]
    • Cleaning: The column is renamed in the final output
    • Output Columns:
      • date_day: Directly mapped and renamed
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[date_day]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • date_day: Directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_name 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_name 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_name]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • account_name: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: directly copied to the output
    • Output Columns:
      • account_name: directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_id 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_id]
    • Cleaning: The column is cast to TEXT
    • Output Columns:
      • account_id: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: directly copied to the output
    • Output Columns:
      • account_id: directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile country_code 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp country_code 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[country_code]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • country_code: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: directly copied to the output
    • Output Columns:
      • country_code: directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile profile_id 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[id]
    • Cleaning: The column is cast to TEXT and renamed to profile_id
    • Output Columns:
      • profile_id: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: used as a key to join with the campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • profile_id: directly copied
Column Lineage
%3 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_name 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_name 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp name 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[name]
    • Direct: Copied without transformation
    • Output Columns:
      • portfolio_name: Directly copied and renamed
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_name]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • portfolio_name: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • portfolio_name: Directly copied
Column Lineage
%3 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_id 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_id 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp id 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • portfolio_id: Directly mapped after casting
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_id]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • portfolio_id: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Integration: Used as a key to join with the campaigns table
    • Direct: Directly copied to the output
    • Output Columns:
      • portfolio_id: Directly copied
Column Lineage
%3 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_name 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report campaign_name 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp name 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[name]
    • Direct: Copied without transformation
    • Output Columns:
      • campaign_name: Directly copied and renamed
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_name]
    • Direct: directly copied to the output
    • Output Columns:
      • campaign_name: directly copied
Column Lineage
%3 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_id 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report campaign_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report campaign_id 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp id 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp campaign_id 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Deduplication: Used in the window function to identify the most recent record
    • Output Columns:
      • campaign_id: Directly mapped after casting to TEXT
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[campaign_id]
    • Cleaning: The column is cast to TEXT in the final output
    • Output Columns:
      • campaign_id: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Integration: used as a key to join with the report table
    • Direct: directly copied to the output
    • Output Columns:
      • campaign_id: directly copied
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[campaign_id]
    • Direct: The column is directly copied without transformation
    • Integration: Used as a key to join with the campaigns table
    • Output Columns:
      • campaign_id: Directly copied
Column Lineage
%3 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history ad_group_name 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report ad_group_name 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp name 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[name]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • ad_group_name: directly copied after casting and renaming
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_name]
    • Direct: directly copied to the output
    • Output Columns:
      • ad_group_name: directly copied
Column Lineage
%3 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history ad_group_id 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report ad_group_id 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report ad_group_id 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp id 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp ad_group_id 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[id]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • ad_group_id: directly copied after casting
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[ad_group_id]
    • Cleaning: The column is cast to TEXT in the final output
    • Output Columns:
      • ad_group_id: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_id]
    • Integration: used as a key to join with the report table
    • Direct: directly copied to the output
    • Output Columns:
      • ad_group_id: directly copied
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[ad_group_id]
    • Direct: The column is directly copied without transformation
    • Integration: Used as a key to join with the ad_groups table
    • Output Columns:
      • ad_group_id: Directly copied
Column Lineage
%3 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history keyword_id 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report keyword_id 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report keyword_id 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp id 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp keyword_id 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Deduplication: Used in the window function to identify the most recent record
    • Output Columns:
      • keyword_id: Directly mapped after casting to TEXT
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[keyword_id]
    • Cleaning: The column is cast to TEXT in the final output
    • Output Columns:
      • keyword_id: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[keyword_id]
    • Direct: The column is directly copied without any transformation
    • Integration: Used as a key to join with the report table
    • Output Columns:
      • keyword_id: Directly copied
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[keyword_id]
    • Direct: The column is directly copied without transformation
    • Integration: Used as a key to join with the keywords table
    • Output Columns:
      • keyword_id: Directly copied
Column Lineage
%3 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history keyword_text 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report keyword_text 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp keyword_text 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[keyword_text]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • keyword_text: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[keyword_text]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • keyword_text: Directly copied
Column Lineage
%3 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history serving_status 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report serving_status 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp serving_status 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[serving_status]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • serving_status: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[serving_status]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • serving_status: Directly copied
Column Lineage
%3 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history state 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report state 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp state 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[state]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • state: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[state]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • state: Directly copied
Column Lineage
%3 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report keyword_bid 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report keyword_bid 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp keyword_bid 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[keyword_bid]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • keyword_bid: Directly mapped
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[keyword_bid]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • keyword_bid: Directly copied
Column Lineage
%3 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report keyword_type 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report keyword_type 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp keyword_type 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[keyword_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • keyword_type: Directly mapped
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[keyword_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • keyword_type: Directly copied
Column Lineage
%3 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report match_type 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report match_type 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp match_type 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[match_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • match_type: Directly mapped
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[match_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • match_type: Directly copied
Column Lineage
%3 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report cost 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report cost 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp cost 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[cost]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • cost: Directly mapped
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[cost]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • cost: Aggregated sum
Column Lineage
%3 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report clicks 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report clicks 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp clicks 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[clicks]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • clicks: Directly mapped
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[clicks]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • clicks: Aggregated sum
Column Lineage
%3 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report impressions 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report impressions 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp impressions 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[impressions]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • impressions: Directly mapped
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[impressions]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • impressions: Aggregated sum
6. model.amazon_ads.amazon_ads__portfolio_report

This SQL query integrates data from multiple Amazon Ads-related tables to create a comprehensive portfolio report. It joins information from campaign reports, account profiles, portfolio history, and campaign history. The query filters for the most recent records in portfolio and campaign history, and aggregates metrics like cost, clicks, and impressions at the portfolio level. The result provides a detailed view of portfolio performance including budget details, serving status, and associated account information.

FilteringIntegrationAggregation
SQL Query
with report as (
    select *
    --use campaign report since portfolio report not provided
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__campaign_level_report
), 

account_info as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__profile
    where _fivetran_deleted = False
),

portfolios as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__portfolio_history
    where is_most_recent_record = True
), 

campaigns as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__campaign_history
    where is_most_recent_record = True
),

fields as (
    select
        report.source_relation,
        report.date_day,
        account_info.account_name,
        account_info.account_id,
        account_info.country_code,
        account_info.profile_id,
        portfolios.portfolio_name,
        portfolios.portfolio_id,
        portfolios.budget_amount,
        portfolios.budget_currency_code,
        portfolios.budget_start_date,
        portfolios.budget_end_date,
        portfolios.budget_policy,
        portfolios.in_budget,
        portfolios.serving_status,
        portfolios.state,
        sum(report.cost) as cost,
        sum(report.clicks) as clicks,
        sum(report.impressions) as impressions 

        --use campaign report since portfolio report not provided
        





    from portfolios

    left join campaigns
        on campaigns.portfolio_id = portfolios.portfolio_id
        and campaigns.source_relation = portfolios.source_relation
    left join account_info
        on account_info.profile_id = campaigns.profile_id
        and account_info.source_relation = campaigns.source_relation
    left join report
        on report.campaign_id = campaigns.campaign_id
        and report.source_relation = campaigns.source_relation

    group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
)

select *
from fields
%3 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report date_day account_name account_id country_code profile_id portfolio_name portfolio_id budget_amount budget_currency_code budget_start_date budget_end_date budget_policy in_budget serving_status state cost clicks impressions 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_id portfolio_id profile_id is_most_recent_record 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_id clicks cost date_day impressions 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f1->6. model.amazon_ads.amazon_ads__portfolio_report:f16 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f2->6. model.amazon_ads.amazon_ads__portfolio_report:f15 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f3->6. model.amazon_ads.amazon_ads__portfolio_report:f0 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f4->6. model.amazon_ads.amazon_ads__portfolio_report:f17 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_id budget_amount budget_currency_code budget_end_date budget_policy budget_start_date in_budget portfolio_name profile_id serving_status state is_most_recent_record 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f6 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f1->6. model.amazon_ads.amazon_ads__portfolio_report:f7 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f2->6. model.amazon_ads.amazon_ads__portfolio_report:f8 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f3->6. model.amazon_ads.amazon_ads__portfolio_report:f10 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f4->6. model.amazon_ads.amazon_ads__portfolio_report:f11 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f5->6. model.amazon_ads.amazon_ads__portfolio_report:f9 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f6->6. model.amazon_ads.amazon_ads__portfolio_report:f12 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f7->6. model.amazon_ads.amazon_ads__portfolio_report:f5 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f9->6. model.amazon_ads.amazon_ads__portfolio_report:f13 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f10->6. model.amazon_ads.amazon_ads__portfolio_report:f14 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile profile_id account_id account_name country_code _fivetran_deleted 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f4 25. model.amazon_ads_source.stg_amazon_ads__profile:f1->6. model.amazon_ads.amazon_ads__portfolio_report:f2 25. model.amazon_ads_source.stg_amazon_ads__profile:f2->6. model.amazon_ads.amazon_ads__portfolio_report:f1 25. model.amazon_ads_source.stg_amazon_ads__profile:f3->6. model.amazon_ads.amazon_ads__portfolio_report:f3
Name Type Comment
date_day date None
account_name text None
account_id text None
country_code text None
profile_id text None
portfolio_name text None
portfolio_id text None
budget_amount integer None
budget_currency_code integer None
budget_start_date integer None
budget_end_date integer None
budget_policy integer None
in_budget boolean None
serving_status text None
state text None
cost double precision None
clicks bigint None
impressions bigint None
Column Lineage
%3 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report date_day 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report date_day 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp date 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[date]
    • Cleaning: The column is renamed to date_day in the final output
    • Output Columns:
      • date_day: Directly mapped and renamed
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[date_day]
    • Direct: Directly selected in the final output
    • Output Columns:
      • date_day: Directly copied to output
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_name 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_name 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_name]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • account_name: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: directly copied to the output
    • Output Columns:
      • account_name: directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_id 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_id]
    • Cleaning: The column is cast to TEXT
    • Output Columns:
      • account_id: Directly mapped after casting to TEXT
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: directly copied to the output
    • Output Columns:
      • account_id: directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile country_code 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp country_code 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[country_code]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • country_code: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: directly copied to the output
    • Output Columns:
      • country_code: directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile profile_id 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[id]
    • Cleaning: The column is cast to TEXT and renamed to profile_id
    • Output Columns:
      • profile_id: Directly mapped after casting to TEXT
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: used as a key to join with the campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • profile_id: directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_name 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report portfolio_name 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp name 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[name]
    • Direct: Copied without transformation
    • Output Columns:
      • portfolio_name: Directly copied and renamed
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_name]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • portfolio_name: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_id 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report portfolio_id 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp id 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • portfolio_id: Directly mapped after casting
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_id]
    • Direct: The column is directly copied without any transformation
    • Integration: The column is used as a key to join with other tables
    • Output Columns:
      • portfolio_id: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_amount 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report budget_amount 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_amount 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_amount]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_amount: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_amount]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • budget_amount: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_currency_code 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report budget_currency_code 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_currency_code 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_currency_code]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_currency_code: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_currency_code]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • budget_currency_code: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_start_date 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report budget_start_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_start_date 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_start_date]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_start_date: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_start_date]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • budget_start_date: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_end_date 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report budget_end_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_end_date 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_end_date]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_end_date: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_end_date]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • budget_end_date: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_policy 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report budget_policy 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_policy 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_policy]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_policy: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_policy]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • budget_policy: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history in_budget 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report in_budget 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp in_budget 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[in_budget]
    • Direct: Copied without transformation
    • Output Columns:
      • in_budget: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[in_budget]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • in_budget: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history serving_status 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report serving_status 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp serving_status 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[serving_status]
    • Direct: Copied without transformation
    • Output Columns:
      • serving_status: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[serving_status]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • serving_status: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history state 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report state 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp state 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[state]
    • Direct: Copied without transformation
    • Output Columns:
      • state: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[state]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • state: Directly copied
Column Lineage
%3 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report cost 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report cost 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp cost 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[cost]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • cost: Directly mapped
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[cost]
    • Aggregation: Summed up in the final select statement
    • Output Columns:
      • cost: Aggregated sum of cost
Column Lineage
%3 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report clicks 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report clicks 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp clicks 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[clicks]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • clicks: Directly mapped
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[clicks]
    • Aggregation: Summed up in the final select statement
    • Output Columns:
      • clicks: Aggregated sum of clicks
Column Lineage
%3 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report impressions 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report impressions 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp impressions 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[impressions]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • impressions: Directly mapped
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[impressions]
    • Aggregation: Summed up in the final select statement
    • Output Columns:
      • impressions: Aggregated sum of impressions
7. model.amazon_ads.amazon_ads__search_report

This SQL query integrates data from multiple Amazon Ads-related tables to create a comprehensive search report. It joins information from search term reports, account profiles, portfolios, campaigns, ad groups, and keywords. The query filters for the most recent records in some tables, aggregates cost, clicks, and impressions, and provides a detailed view of search performance across various dimensions of the advertising structure.

FilteringIntegrationAggregation
SQL Query
with report as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
), 

account_info as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__profile
    where _fivetran_deleted = False
),

portfolios as (
    select *
    from TEST.PUBLIC_amazon_ads.int_amazon_ads__portfolio_history
), 

campaigns as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__campaign_history
    where is_most_recent_record = True
),

ad_groups as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__ad_group_history
    where is_most_recent_record = True
), 

keywords as (
    select *
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__keyword_history
    where is_most_recent_record = True
), 

fields as (
    select
        report.source_relation,
        report.date_day,
        account_info.account_name,
        account_info.account_id,
        account_info.country_code,
        account_info.profile_id,
        portfolios.portfolio_name,
        portfolios.portfolio_id,
        campaigns.campaign_name,
        report.campaign_id,
        ad_groups.ad_group_name,
        report.ad_group_id,
        report.keyword_id,
        keywords.keyword_text,
        keywords.match_type,
        keywords.serving_status,
        keywords.state,
        report.search_term,
        report.targeting,
        sum(report.cost) as cost,
        sum(report.clicks) as clicks,
        sum(report.impressions) as impressions 

        





    from report

    left join keywords
        on keywords.keyword_id = report.keyword_id
        and keywords.source_relation = report.source_relation
    left join ad_groups
        on ad_groups.ad_group_id = report.ad_group_id
        and ad_groups.source_relation = report.source_relation
    left join campaigns
        on campaigns.campaign_id = report.campaign_id
        and campaigns.source_relation = report.source_relation
    left join portfolios
        on portfolios.portfolio_id = campaigns.portfolio_id
        and portfolios.source_relation = campaigns.source_relation
    left join account_info
        on account_info.profile_id = campaigns.profile_id
        and account_info.source_relation = campaigns.source_relation

    group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
)

select *
from fields
%3 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report date_day account_name account_id country_code profile_id portfolio_name portfolio_id campaign_name campaign_id ad_group_name ad_group_id keyword_id keyword_text match_type serving_status state search_term targeting cost clicks impressions 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_id portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->7. model.amazon_ads.amazon_ads__search_report:f6 8. model.amazon_ads.int_amazon_ads__portfolio_history:f1->7. model.amazon_ads.amazon_ads__search_report:f5 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history ad_group_id campaign_id ad_group_name is_most_recent_record 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->7. model.amazon_ads.amazon_ads__search_report:f10 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f2->7. model.amazon_ads.amazon_ads__search_report:f9 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_id campaign_name portfolio_id profile_id is_most_recent_record 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->7. model.amazon_ads.amazon_ads__search_report:f8 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f1->7. model.amazon_ads.amazon_ads__search_report:f7 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history keyword_id keyword_text match_type serving_status state is_most_recent_record 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->7. model.amazon_ads.amazon_ads__search_report:f11 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f1->7. model.amazon_ads.amazon_ads__search_report:f12 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f2->7. model.amazon_ads.amazon_ads__search_report:f13 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f3->7. model.amazon_ads.amazon_ads__search_report:f14 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f4->7. model.amazon_ads.amazon_ads__search_report:f15 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile profile_id account_id account_name country_code _fivetran_deleted 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->7. model.amazon_ads.amazon_ads__search_report:f4 25. model.amazon_ads_source.stg_amazon_ads__profile:f1->7. model.amazon_ads.amazon_ads__search_report:f2 25. model.amazon_ads_source.stg_amazon_ads__profile:f2->7. model.amazon_ads.amazon_ads__search_report:f1 25. model.amazon_ads_source.stg_amazon_ads__profile:f3->7. model.amazon_ads.amazon_ads__search_report:f3 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report ad_group_id campaign_id clicks cost date_day impressions keyword_id search_term targeting 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f10 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f1->7. model.amazon_ads.amazon_ads__search_report:f8 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f2->7. model.amazon_ads.amazon_ads__search_report:f19 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f3->7. model.amazon_ads.amazon_ads__search_report:f18 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f4->7. model.amazon_ads.amazon_ads__search_report:f0 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f5->7. model.amazon_ads.amazon_ads__search_report:f20 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f6->7. model.amazon_ads.amazon_ads__search_report:f11 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f7->7. model.amazon_ads.amazon_ads__search_report:f16 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f8->7. model.amazon_ads.amazon_ads__search_report:f17
Name Type Comment
date_day date None
account_name text None
account_id text None
country_code text None
profile_id text None
portfolio_name text None
portfolio_id text None
campaign_name text None
campaign_id text None
ad_group_name text None
ad_group_id text None
keyword_id text None
keyword_text text None
match_type text None
serving_status text None
state text None
search_term text None
targeting text None
cost double precision None
clicks bigint None
impressions bigint None
Column Lineage
%3 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report date_day 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report date_day 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp date 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[date]
    • Cleaning: The column is cast to DATE data type
    • Output Columns:
      • date_day: Directly mapped after casting and renamed
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[date_day]
    • Direct: directly copied to the output
    • Output Columns:
      • date_day: directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_name 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->7. model.amazon_ads.amazon_ads__search_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_name 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_name]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • account_name: Directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: directly copied to the output
    • Output Columns:
      • account_name: directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_id 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->7. model.amazon_ads.amazon_ads__search_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_id]
    • Cleaning: The column is cast to TEXT
    • Output Columns:
      • account_id: Directly mapped after casting to TEXT
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: directly copied to the output
    • Output Columns:
      • account_id: directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile country_code 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->7. model.amazon_ads.amazon_ads__search_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp country_code 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[country_code]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • country_code: Directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: directly copied to the output
    • Output Columns:
      • country_code: directly copied
Column Lineage
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile profile_id 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->7. model.amazon_ads.amazon_ads__search_report:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[id]
    • Cleaning: The column is cast to TEXT and renamed to profile_id
    • Output Columns:
      • profile_id: Directly mapped after casting to TEXT
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: used as a key to join with the campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • profile_id: directly copied
Column Lineage
%3 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_name 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_name 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp name 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[name]
    • Direct: Copied without transformation
    • Output Columns:
      • portfolio_name: Directly copied and renamed
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_name]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • portfolio_name: Directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: directly copied to the output
    • Output Columns:
      • portfolio_name: directly copied
Column Lineage
%3 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_id 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_id 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp id 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • portfolio_id: Directly mapped after casting
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_id]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • portfolio_id: Directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Integration: used as a key to join with campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • portfolio_id: directly copied
Column Lineage
%3 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_name 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report campaign_name 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp name 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[name]
    • Direct: Copied without transformation
    • Output Columns:
      • campaign_name: Directly copied and renamed
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_name]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_name: Directly copied
Column Lineage
%3 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_id 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report campaign_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report campaign_id 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp id 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp campaign_id 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Deduplication: Used in the window function to identify the most recent record
    • Output Columns:
      • campaign_id: Directly mapped after casting to TEXT
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[campaign_id]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • campaign_id: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Direct: The column is directly copied without any transformation
    • Integration: Used as a key to join with other tables
    • Output Columns:
      • campaign_id: Directly copied
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[campaign_id]
    • Direct: directly copied to the output
    • Integration: used to join with campaigns table
    • Output Columns:
      • campaign_id: directly copied
Column Lineage
%3 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history ad_group_name 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report ad_group_name 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp name 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[name]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • ad_group_name: directly copied after casting and renaming
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_name]
    • Direct: directly copied to the output
    • Output Columns:
      • ad_group_name: directly copied
Column Lineage
%3 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history ad_group_id 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report ad_group_id 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report ad_group_id 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp id 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp ad_group_id 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[id]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • ad_group_id: directly copied after casting
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[ad_group_id]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • ad_group_id: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_id]
    • Integration: used as a key to join with the report table
    • Direct: directly copied to the output
    • Output Columns:
      • ad_group_id: directly copied
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[ad_group_id]
    • Direct: directly copied to the output
    • Integration: used to join with ad_groups table
    • Output Columns:
      • ad_group_id: directly copied
Column Lineage
%3 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history keyword_id 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report keyword_id 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report keyword_id 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp id 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp keyword_id 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Deduplication: Used in the window function to identify the most recent record
    • Output Columns:
      • keyword_id: Directly mapped after casting to TEXT
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[keyword_id]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • keyword_id: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[keyword_id]
    • Integration: used to join with the report table
    • Direct: directly copied to the output
    • Output Columns:
      • keyword_id: directly copied
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[keyword_id]
    • Direct: directly copied to the output
    • Integration: used to join with keywords table
    • Output Columns:
      • keyword_id: directly copied
Column Lineage
%3 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history keyword_text 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report keyword_text 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp keyword_text 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[keyword_text]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • keyword_text: Directly mapped after casting to TEXT
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[keyword_text]
    • Direct: directly copied to the output
    • Output Columns:
      • keyword_text: directly copied
Column Lineage
%3 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history match_type 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report match_type 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp match_type 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[match_type]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • match_type: Directly mapped after casting to TEXT
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[match_type]
    • Direct: directly copied to the output
    • Output Columns:
      • match_type: directly copied
Column Lineage
%3 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history serving_status 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report serving_status 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp serving_status 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[serving_status]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • serving_status: Directly mapped after casting to TEXT
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[serving_status]
    • Direct: directly copied to the output
    • Output Columns:
      • serving_status: directly copied
Column Lineage
%3 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history state 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report state 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp state 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[state]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • state: Directly mapped after casting to TEXT
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[state]
    • Direct: directly copied to the output
    • Output Columns:
      • state: directly copied
Column Lineage
%3 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report search_term 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report search_term 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp search_term 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[search_term]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • search_term: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[search_term]
    • Direct: directly copied to the output
    • Output Columns:
      • search_term: directly copied
Column Lineage
%3 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report targeting 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report targeting 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp targeting 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[targeting]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • targeting: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[targeting]
    • Direct: directly copied to the output
    • Output Columns:
      • targeting: directly copied
Column Lineage
%3 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report cost 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report cost 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp cost 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[cost]
    • Cleaning: The column is cast to FLOAT data type
    • Output Columns:
      • cost: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[cost]
    • Aggregation: summed up in the final select statement
    • Output Columns:
      • cost: aggregated sum
Column Lineage
%3 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report clicks 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report clicks 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp clicks 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[clicks]
    • Cleaning: The column is cast to INTEGER data type
    • Output Columns:
      • clicks: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[clicks]
    • Aggregation: summed up in the final select statement
    • Output Columns:
      • clicks: aggregated sum
Column Lineage
%3 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report impressions 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report impressions 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp impressions 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[impressions]
    • Cleaning: The column is cast to INTEGER data type
    • Output Columns:
      • impressions: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[impressions]
    • Aggregation: summed up in the final select statement
    • Output Columns:
      • impressions: aggregated sum
8. model.amazon_ads.int_amazon_ads__portfolio_history

This SQL query selects all columns from the most recent records in the amazon_ads_source.stg_amazon_ads__portfolio_history table. It filters the data to include only the rows where 'is_most_recent_record' is True, effectively retrieving the latest snapshot of portfolio data.

Filtering
SQL Query
with portfolios as (
    select
    
        *
        from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__portfolio_history
        where is_most_recent_record = True
    
)

select * 
from portfolios
%3 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_id budget_amount budget_currency_code budget_end_date budget_policy budget_start_date creation_date in_budget last_updated_date portfolio_name profile_id serving_status state is_most_recent_record 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_id budget_amount budget_currency_code budget_end_date budget_policy budget_start_date creation_date in_budget last_updated_date portfolio_name profile_id serving_status state is_most_recent_record 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f1->8. model.amazon_ads.int_amazon_ads__portfolio_history:f1 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f2->8. model.amazon_ads.int_amazon_ads__portfolio_history:f2 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f3->8. model.amazon_ads.int_amazon_ads__portfolio_history:f3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f4->8. model.amazon_ads.int_amazon_ads__portfolio_history:f4 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f5->8. model.amazon_ads.int_amazon_ads__portfolio_history:f5 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f6->8. model.amazon_ads.int_amazon_ads__portfolio_history:f6 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f7->8. model.amazon_ads.int_amazon_ads__portfolio_history:f7 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f8->8. model.amazon_ads.int_amazon_ads__portfolio_history:f8 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f9->8. model.amazon_ads.int_amazon_ads__portfolio_history:f9 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f10->8. model.amazon_ads.int_amazon_ads__portfolio_history:f10 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f11->8. model.amazon_ads.int_amazon_ads__portfolio_history:f11 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f12->8. model.amazon_ads.int_amazon_ads__portfolio_history:f12 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f13->8. model.amazon_ads.int_amazon_ads__portfolio_history:f13
Name Type Comment
portfolio_id text None
budget_amount integer None
budget_currency_code integer None
budget_end_date integer None
budget_policy integer None
budget_start_date integer None
creation_date text None
in_budget boolean None
last_updated_date text None
portfolio_name text None
profile_id text None
serving_status text None
state text None
is_most_recent_record boolean None
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_id 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp id 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • portfolio_id: Directly mapped after casting
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_id]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • portfolio_id: Directly copied
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Integration: used as a key to join with the campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • portfolio_id: directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Direct: The column is directly copied without any transformation
    • Integration: The column is used as a key to join with the campaigns table
    • Output Columns:
      • portfolio_id: Directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Integration: Used as a key to join with the campaigns table
    • Direct: Directly copied to the output
    • Output Columns:
      • portfolio_id: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Integration: Used as a key to join with the campaigns table
    • Direct: Directly copied to the output
    • Output Columns:
      • portfolio_id: Directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Integration: used as a key to join with campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • portfolio_id: directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_amount 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history budget_amount 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_amount 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_amount]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_amount: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_amount]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • budget_amount: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_currency_code 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history budget_currency_code 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_currency_code 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_currency_code]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_currency_code: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_currency_code]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • budget_currency_code: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_end_date 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history budget_end_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_end_date 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_end_date]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_end_date: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_end_date]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • budget_end_date: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_policy 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history budget_policy 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_policy 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_policy]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_policy: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_policy]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • budget_policy: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_start_date 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history budget_start_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_start_date 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_start_date]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_start_date: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_start_date]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • budget_start_date: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history creation_date 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history creation_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp creation_date 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[creation_date]
    • Direct: Copied without transformation
    • Output Columns:
      • creation_date: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[creation_date]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • creation_date: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history in_budget 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history in_budget 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp in_budget 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[in_budget]
    • Direct: Copied without transformation
    • Output Columns:
      • in_budget: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[in_budget]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • in_budget: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history is_most_recent_record last_updated_date 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history last_updated_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f1->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp last_updated_date 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f1 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[last_updated_date]
    • Direct: Copied without transformation
    • Deduplication: Used in window function to determine the most recent record
    • Output Columns:
      • last_updated_date: Directly copied
      • is_most_recent_record: Used in window function to determine this
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[last_updated_date]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • last_updated_date: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_name 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp name 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[name]
    • Direct: Copied without transformation
    • Output Columns:
      • portfolio_name: Directly copied and renamed
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_name]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • portfolio_name: Directly copied
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: directly copied to the output
    • Output Columns:
      • portfolio_name: directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • portfolio_name: Directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • portfolio_name: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • portfolio_name: Directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: directly copied to the output
    • Output Columns:
      • portfolio_name: directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history profile_id 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history profile_id 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp profile_id 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[profile_id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • profile_id: Directly mapped after casting
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[profile_id]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • profile_id: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history serving_status 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history serving_status 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp serving_status 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[serving_status]
    • Direct: Copied without transformation
    • Output Columns:
      • serving_status: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[serving_status]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • serving_status: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history state 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history state 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp state 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[state]
    • Direct: Copied without transformation
    • Output Columns:
      • state: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[state]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • state: Directly copied
Column Lineage
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history is_most_recent_record last_updated_date 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history is_most_recent_record 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp last_updated_date 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f1 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[last_updated_date]
    • Direct: Copied without transformation
    • Deduplication: Used in window function to determine the most recent record
    • Output Columns:
      • last_updated_date: Directly copied
      • is_most_recent_record: Used in window function to determine this
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[is_most_recent_record]
    • Filtering: This column is used to filter the data to include only the most recent records
    • Output Columns:
      • is_most_recent_record: Directly copied after filtering
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history

This SQL query stages data from an Amazon Ads source table, focusing on ad group history. It casts various fields to specific data types, renames some columns, and adds a source relation field. The query then selects and transforms these fields, including adding a flag to identify the most recent record for each ad group. This staging process prepares the data for further use in the data pipeline.

CleaningDeduplicationOther
SQL Query
with base as (

    select * 
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__ad_group_history_tmp
),

fields as (

    select
        
    cast(null as integer) as 
    
    campaign_id
    
 , 
    cast(null as timestamp) as 
    
    creation_date
    
 , 
    cast(null as float) as 
    
    default_bid
    
 , 
    cast(null as TEXT) as 
    
    id
    
 , 
    cast(null as timestamp) as 
    
    last_updated_date
    
 , 
    cast(null as TEXT) as 
    
    name
    
 , 
    cast(null as TEXT) as 
    
    serving_status
    
 , 
    cast(null as TEXT) as 
    
    state
    
 


    
        


, cast('' as TEXT) as source_relation




    from base
),

final as (

    select
        source_relation, 
        cast(id as TEXT) as ad_group_id,
        cast(campaign_id as TEXT) as campaign_id,
        creation_date,
        default_bid,
        last_updated_date,
        name as ad_group_name,
        serving_status,
        state,
        row_number() over (partition by source_relation, id order by last_updated_date desc) = 1 as is_most_recent_record
    from fields
)

select *
from final
%3 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history ad_group_id campaign_id creation_date default_bid last_updated_date ad_group_name serving_status state is_most_recent_record 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp id last_updated_date campaign_id creation_date default_bid name serving_status state 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f1->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f4 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f1->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f8 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f2->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f1 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f3->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f2 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f4->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f5->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f5 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f6->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f6 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f7->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f7
Name Type Comment
ad_group_id text None
campaign_id text None
creation_date text None
default_bid double precision None
last_updated_date text None
ad_group_name text None
serving_status text None
state text None
is_most_recent_record boolean None
Column Lineage
%3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp id 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history ad_group_id 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report ad_group_id 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report ad_group_id 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report ad_group_id 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report ad_group_id 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[id]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • ad_group_id: directly copied after casting
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_id]
    • Integration: used as a key to join with the report table
    • Direct: directly copied to the output
    • Output Columns:
      • ad_group_id: directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_id]
    • Integration: Used as a key to join with the report table
    • Direct: Directly copied to the output
    • Output Columns:
      • ad_group_id: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_id]
    • Integration: used as a key to join with the report table
    • Direct: directly copied to the output
    • Output Columns:
      • ad_group_id: directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_id]
    • Integration: used as a key to join with the report table
    • Direct: directly copied to the output
    • Output Columns:
      • ad_group_id: directly copied
Column Lineage
%3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp campaign_id 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history campaign_id 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:header 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->7. model.amazon_ads.amazon_ads__search_report:header 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:header
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[campaign_id]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • campaign_id: directly copied after casting
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[campaign_id]
    • Integration: used as a key to join with the campaigns table
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[campaign_id]
    • Integration: used as a key to join with the campaigns table
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[campaign_id]
    • Integration: used as a key to join with the campaigns table
Column Lineage
%3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp creation_date 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history creation_date 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[creation_date]
    • Cleaning: cast to timestamp data type
    • Output Columns:
      • creation_date: directly copied after casting
Column Lineage
%3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp default_bid 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history default_bid 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report default_bid 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[default_bid]
    • Cleaning: cast to float data type
    • Output Columns:
      • default_bid: directly copied after casting
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[default_bid]
    • Direct: directly copied to the output
    • Output Columns:
      • default_bid: directly copied
Column Lineage
%3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp last_updated_date 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history is_most_recent_record last_updated_date 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f1 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[last_updated_date]
    • Cleaning: cast to timestamp data type
    • Deduplication: used in window function to determine the most recent record
    • Output Columns:
      • last_updated_date: directly copied after casting
      • is_most_recent_record: used to determine this flag
Column Lineage
%3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp name 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history ad_group_name 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report ad_group_name 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report ad_group_name 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report ad_group_name 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report ad_group_name 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[name]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • ad_group_name: directly copied after casting and renaming
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_name]
    • Direct: directly copied to the output
    • Output Columns:
      • ad_group_name: directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • ad_group_name: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_name]
    • Direct: directly copied to the output
    • Output Columns:
      • ad_group_name: directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_name]
    • Direct: directly copied to the output
    • Output Columns:
      • ad_group_name: directly copied
Column Lineage
%3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp serving_status 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history serving_status 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report serving_status 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[serving_status]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • serving_status: directly copied after casting
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[serving_status]
    • Direct: directly copied to the output
    • Output Columns:
      • serving_status: directly copied
Column Lineage
%3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp state 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history state 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report state 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[state]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • state: directly copied after casting
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[state]
    • Direct: directly copied to the output
    • Output Columns:
      • state: directly copied
Column Lineage
%3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp last_updated_date 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history is_most_recent_record last_updated_date 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f1 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:header 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->7. model.amazon_ads.amazon_ads__search_report:header 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:header 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->3. model.amazon_ads.amazon_ads__ad_report:header
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[last_updated_date]
    • Cleaning: cast to timestamp data type
    • Deduplication: used in window function to determine the most recent record
    • Output Columns:
      • last_updated_date: directly copied after casting
      • is_most_recent_record: used to determine this flag
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[is_most_recent_record]
    • Filtering: used to filter for the most recent records (where is_most_recent_record = True)
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[is_most_recent_record]
    • Filtering: Used to filter for the most recent records (where is_most_recent_record = True)
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[is_most_recent_record]
    • Filtering: the column is filtered to include only the most recent records (where is_most_recent_record = True)
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[is_most_recent_record]
    • Filtering: the column is filtered to include only the most recent records
10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of TEXT data type. It's likely used as a placeholder or template for further development or testing purposes.

Other
SQL Query
    
    
        
        
        
         
            
        
    select 
        cast(null as TEXT) as _dbt_source_relation
    limit 0
%3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp id last_updated_date _fivetran_synced campaign_id creation_date default_bid name serving_status state 31. source.amazon_ads_source.amazon_ads.ad_group_history 31. source.amazon_ads_source.amazon_ads.ad_group_history
Name Type Comment
id integer None
last_updated_date text None
_fivetran_synced timestamp without time zone None
campaign_id integer None
creation_date text None
default_bid double precision None
name text None
serving_status text None
state text None
Column Lineage
%3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp id 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history ad_group_id 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report ad_group_id 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report ad_group_id 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report ad_group_id 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report ad_group_id 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[id]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • ad_group_id: directly copied after casting
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_id]
    • Integration: used as a key to join with the report table
    • Direct: directly copied to the output
    • Output Columns:
      • ad_group_id: directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_id]
    • Integration: Used as a key to join with the report table
    • Direct: Directly copied to the output
    • Output Columns:
      • ad_group_id: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_id]
    • Integration: used as a key to join with the report table
    • Direct: directly copied to the output
    • Output Columns:
      • ad_group_id: directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_id]
    • Integration: used as a key to join with the report table
    • Direct: directly copied to the output
    • Output Columns:
      • ad_group_id: directly copied
Column Lineage
%3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp last_updated_date 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history is_most_recent_record last_updated_date 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f1 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:header 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->7. model.amazon_ads.amazon_ads__search_report:header 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:header 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->3. model.amazon_ads.amazon_ads__ad_report:header
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[last_updated_date]
    • Cleaning: cast to timestamp data type
    • Deduplication: used in window function to determine the most recent record
    • Output Columns:
      • last_updated_date: directly copied after casting
      • is_most_recent_record: used to determine this flag
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[is_most_recent_record]
    • Filtering: used to filter for the most recent records (where is_most_recent_record = True)
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[is_most_recent_record]
    • Filtering: Used to filter for the most recent records (where is_most_recent_record = True)
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[is_most_recent_record]
    • Filtering: the column is filtered to include only the most recent records (where is_most_recent_record = True)
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[is_most_recent_record]
    • Filtering: the column is filtered to include only the most recent records
Column Lineage
%3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp campaign_id 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history campaign_id 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:header 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->7. model.amazon_ads.amazon_ads__search_report:header 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:header
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[campaign_id]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • campaign_id: directly copied after casting
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[campaign_id]
    • Integration: used as a key to join with the campaigns table
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[campaign_id]
    • Integration: used as a key to join with the campaigns table
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[campaign_id]
    • Integration: used as a key to join with the campaigns table
Column Lineage
%3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp creation_date 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history creation_date 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[creation_date]
    • Cleaning: cast to timestamp data type
    • Output Columns:
      • creation_date: directly copied after casting
Column Lineage
%3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp default_bid 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history default_bid 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report default_bid 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[default_bid]
    • Cleaning: cast to float data type
    • Output Columns:
      • default_bid: directly copied after casting
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[default_bid]
    • Direct: directly copied to the output
    • Output Columns:
      • default_bid: directly copied
Column Lineage
%3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp name 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history ad_group_name 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report ad_group_name 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report ad_group_name 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report ad_group_name 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report ad_group_name 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[name]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • ad_group_name: directly copied after casting and renaming
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_name]
    • Direct: directly copied to the output
    • Output Columns:
      • ad_group_name: directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • ad_group_name: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_name]
    • Direct: directly copied to the output
    • Output Columns:
      • ad_group_name: directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[ad_group_name]
    • Direct: directly copied to the output
    • Output Columns:
      • ad_group_name: directly copied
Column Lineage
%3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp serving_status 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history serving_status 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report serving_status 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[serving_status]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • serving_status: directly copied after casting
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[serving_status]
    • Direct: directly copied to the output
    • Output Columns:
      • serving_status: directly copied
Column Lineage
%3 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp state 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history state 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp:f0->9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report state 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0
9. model.amazon_ads_source.stg_amazon_ads__ad_group_history
  • Input Column: 10. model.amazon_ads_source.stg_amazon_ads__ad_group_history_tmp[state]
    • Cleaning: cast to TEXT data type
    • Output Columns:
      • state: directly copied after casting
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 9. model.amazon_ads_source.stg_amazon_ads__ad_group_history[state]
    • Direct: directly copied to the output
    • Output Columns:
      • state: directly copied
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report

This SQL query performs data type casting and column renaming for a staging table. It selects data from a temporary table, casts columns to specific data types (integer, text, float, date), and renames the 'date' column to 'date_day'. The query also adds a 'source_relation' column and casts the 'ad_group_id' to TEXT in the final selection.

CleaningOther
SQL Query
with base as (

    select * 
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp
),

fields as (

    select
        
    cast(null as integer) as 
    
    ad_group_id
    
 , 
    cast(null as TEXT) as 
    
    campaign_bidding_strategy
    
 , 
    cast(null as integer) as 
    
    clicks
    
 , 
    cast(null as float) as 
    
    cost
    
 , 
    cast(null as date) as 
    
    date
    
 , 
    cast(null as integer) as 
    
    impressions
    
 


    
        


, cast('' as TEXT) as source_relation




    from base
),

final as (

    select
        source_relation, 
        cast(ad_group_id as TEXT) as ad_group_id,
        campaign_bidding_strategy,
        clicks,
        cost,
        date as date_day,
        impressions

        




    from fields
)

select *
from final
%3 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report ad_group_id campaign_bidding_strategy clicks cost date_day impressions 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp ad_group_id date campaign_bidding_strategy clicks cost impressions 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f1->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f4 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f2->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f1 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f3->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f2 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f4->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f3 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f5->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f5
Name Type Comment
ad_group_id text None
campaign_bidding_strategy text None
clicks integer None
cost double precision None
date_day date None
impressions integer None
Column Lineage
%3 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp ad_group_id 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report ad_group_id 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report ad_group_id 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report
  • Input Column: 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp[ad_group_id]
    • Cleaning: The column is cast to TEXT in the final selection
    • Output Columns:
      • ad_group_id: Directly mapped after casting to TEXT
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report[ad_group_id]
    • Integration: used as a key to join with the ad_groups table
    • Aggregation: used in the GROUP BY clause
    • Output Columns:
      • ad_group_id: directly copied
Column Lineage
%3 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp campaign_bidding_strategy 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report campaign_bidding_strategy 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report campaign_bidding_strategy 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report
  • Input Column: 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp[campaign_bidding_strategy]
    • Cleaning: The column is cast to TEXT
    • Output Columns:
      • campaign_bidding_strategy: Directly mapped after casting to TEXT
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report[campaign_bidding_strategy]
    • Direct: directly selected in the output without transformation
    • Aggregation: used in the GROUP BY clause
    • Output Columns:
      • campaign_bidding_strategy: directly copied
Column Lineage
%3 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp clicks 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report clicks 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report clicks 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report
  • Input Column: 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp[clicks]
    • Cleaning: The column is cast to INTEGER
    • Output Columns:
      • clicks: Directly mapped after casting to INTEGER
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report[clicks]
    • Aggregation: summed up in the SELECT clause
    • Output Columns:
      • clicks: aggregated sum
Column Lineage
%3 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp cost 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report cost 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report cost 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report
  • Input Column: 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp[cost]
    • Cleaning: The column is cast to FLOAT
    • Output Columns:
      • cost: Directly mapped after casting to FLOAT
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report[cost]
    • Aggregation: summed up in the SELECT clause
    • Output Columns:
      • cost: aggregated sum
Column Lineage
%3 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp date 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report date_day 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report date_day 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report
  • Input Column: 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp[date]
    • Cleaning: The column is cast to DATE type and renamed
    • Output Columns:
      • date_day: Directly mapped after casting to DATE
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report[date_day]
    • Direct: directly selected in the output without transformation
    • Aggregation: used in the GROUP BY clause
    • Output Columns:
      • date_day: directly copied
Column Lineage
%3 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp impressions 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report impressions 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report impressions 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report
  • Input Column: 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp[impressions]
    • Cleaning: The column is cast to INTEGER
    • Output Columns:
      • impressions: Directly mapped after casting to INTEGER
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report[impressions]
    • Aggregation: summed up in the SELECT clause
    • Output Columns:
      • impressions: aggregated sum
12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of TEXT data type. The query doesn't select any actual data; it's used to define the structure of the result set without populating it with any rows.

Other
SQL Query
    
    
        
        
        
         
            
        
    select 
        cast(null as TEXT) as _dbt_source_relation
    limit 0
%3 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp ad_group_id date _fivetran_synced campaign_bidding_strategy clicks cost impressions 32. source.amazon_ads_source.amazon_ads.ad_group_level_report 32. source.amazon_ads_source.amazon_ads.ad_group_level_report
Name Type Comment
ad_group_id integer None
date date None
_fivetran_synced timestamp without time zone None
campaign_bidding_strategy text None
clicks integer None
cost double precision None
impressions integer None
Column Lineage
%3 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp ad_group_id 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report ad_group_id 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report ad_group_id 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report
  • Input Column: 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp[ad_group_id]
    • Cleaning: The column is cast to TEXT in the final selection
    • Output Columns:
      • ad_group_id: Directly mapped after casting to TEXT
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report[ad_group_id]
    • Integration: used as a key to join with the ad_groups table
    • Aggregation: used in the GROUP BY clause
    • Output Columns:
      • ad_group_id: directly copied
Column Lineage
%3 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp date 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report date_day 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report date_day 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report
  • Input Column: 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp[date]
    • Cleaning: The column is cast to DATE type and renamed
    • Output Columns:
      • date_day: Directly mapped after casting to DATE
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report[date_day]
    • Direct: directly selected in the output without transformation
    • Aggregation: used in the GROUP BY clause
    • Output Columns:
      • date_day: directly copied
Column Lineage
%3 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp campaign_bidding_strategy 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report campaign_bidding_strategy 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report campaign_bidding_strategy 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report
  • Input Column: 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp[campaign_bidding_strategy]
    • Cleaning: The column is cast to TEXT
    • Output Columns:
      • campaign_bidding_strategy: Directly mapped after casting to TEXT
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report[campaign_bidding_strategy]
    • Direct: directly selected in the output without transformation
    • Aggregation: used in the GROUP BY clause
    • Output Columns:
      • campaign_bidding_strategy: directly copied
Column Lineage
%3 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp clicks 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report clicks 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report clicks 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report
  • Input Column: 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp[clicks]
    • Cleaning: The column is cast to INTEGER
    • Output Columns:
      • clicks: Directly mapped after casting to INTEGER
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report[clicks]
    • Aggregation: summed up in the SELECT clause
    • Output Columns:
      • clicks: aggregated sum
Column Lineage
%3 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp cost 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report cost 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report cost 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report
  • Input Column: 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp[cost]
    • Cleaning: The column is cast to FLOAT
    • Output Columns:
      • cost: Directly mapped after casting to FLOAT
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report[cost]
    • Aggregation: summed up in the SELECT clause
    • Output Columns:
      • cost: aggregated sum
Column Lineage
%3 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp impressions 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report impressions 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp:f0->11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report impressions 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0
11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report
  • Input Column: 12. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report_tmp[impressions]
    • Cleaning: The column is cast to INTEGER
    • Output Columns:
      • impressions: Directly mapped after casting to INTEGER
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 11. model.amazon_ads_source.stg_amazon_ads__ad_group_level_report[impressions]
    • Aggregation: summed up in the SELECT clause
    • Output Columns:
      • impressions: aggregated sum
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report

This SQL query performs data cleaning and type casting operations on the 'stg_amazon_ads__advertised_product_report_tmp' table. It selects all columns from the base table, explicitly casts them to specific data types, and renames some columns. The query also adds a 'source_relation' column and performs final type casting on certain fields before selecting all columns in the final output.

Cleaning
SQL Query
with base as (

    select * 
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp
),

fields as (

    select
        
    cast(null as integer) as 
    
    ad_group_id
    
 , 
    cast(null as integer) as 
    
    ad_id
    
 , 
    cast(null as TEXT) as 
    
    advertised_asin
    
 , 
    cast(null as TEXT) as 
    
    advertised_sku
    
 , 
    cast(null as float) as 
    
    campaign_budget_amount
    
 , 
    cast(null as TEXT) as 
    
    campaign_budget_currency_code
    
 , 
    cast(null as TEXT) as 
    
    campaign_budget_type
    
 , 
    cast(null as integer) as 
    
    campaign_id
    
 , 
    cast(null as integer) as 
    
    clicks
    
 , 
    cast(null as float) as 
    
    cost
    
 , 
    cast(null as date) as 
    
    date
    
 , 
    cast(null as integer) as 
    
    impressions
    
 


    
        


, cast('' as TEXT) as source_relation




    from base
),

final as (

    select
        source_relation, 
        cast(ad_id as TEXT) as ad_id,
        cast(ad_group_id as TEXT) as ad_group_id,
        advertised_asin,
        advertised_sku,
        campaign_budget_amount,
        campaign_budget_currency_code,
        campaign_budget_type,
        cast(campaign_id as TEXT) as campaign_id,
        clicks,
        cost,
        date as date_day,
        impressions

        




    from fields
)

select *
from final
%3 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report ad_id ad_group_id advertised_asin advertised_sku campaign_budget_amount campaign_budget_currency_code campaign_budget_type campaign_id clicks cost date_day impressions 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp ad_group_id ad_id campaign_id date campaign_budget_amount campaign_budget_currency_code campaign_budget_type clicks cost impressions advertised_asin advertised_sku 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f1 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f1->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f2->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f7 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f3->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f10 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f4->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f4 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f5->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f5 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f6->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f6 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f7->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f8 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f8->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f9 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f9->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f11 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f10->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f2 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f11->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f3
Name Type Comment
ad_id text None
ad_group_id text None
advertised_asin integer None
advertised_sku integer None
campaign_budget_amount double precision None
campaign_budget_currency_code text None
campaign_budget_type text None
campaign_id text None
clicks integer None
cost double precision None
date_day date None
impressions integer None
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp ad_id 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report ad_id 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report ad_id 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[ad_id]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • ad_id: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[ad_id]
    • Direct: The column is directly copied without any transformation
    • Integration: Used as a key to join with the ads table
    • Output Columns:
      • ad_id: Directly copied
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp ad_group_id 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report ad_group_id 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report ad_group_id 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[ad_group_id]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • ad_group_id: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[ad_group_id]
    • Direct: The column is directly copied without any transformation
    • Integration: Used as a key to join with the ad_groups table
    • Output Columns:
      • ad_group_id: Directly copied
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp advertised_asin 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report advertised_asin 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report advertised_asin 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[advertised_asin]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • advertised_asin: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[advertised_asin]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • advertised_asin: Directly copied
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp advertised_sku 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report advertised_sku 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report advertised_sku 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[advertised_sku]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • advertised_sku: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[advertised_sku]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • advertised_sku: Directly copied
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp campaign_budget_amount 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report campaign_budget_amount 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report campaign_budget_amount 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[campaign_budget_amount]
    • Cleaning: The column is cast to FLOAT type
    • Output Columns:
      • campaign_budget_amount: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[campaign_budget_amount]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_budget_amount: Directly copied
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp campaign_budget_currency_code 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report campaign_budget_currency_code 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report campaign_budget_currency_code 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[campaign_budget_currency_code]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • campaign_budget_currency_code: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[campaign_budget_currency_code]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_budget_currency_code: Directly copied
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp campaign_budget_type 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report campaign_budget_type 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report campaign_budget_type 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[campaign_budget_type]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • campaign_budget_type: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[campaign_budget_type]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_budget_type: Directly copied
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp campaign_id 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report campaign_id 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report campaign_id 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[campaign_id]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • campaign_id: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[campaign_id]
    • Direct: The column is directly copied without any transformation
    • Integration: Used as a key to join with the campaigns table
    • Output Columns:
      • campaign_id: Directly copied
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp clicks 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report clicks 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report clicks 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[clicks]
    • Cleaning: The column is cast to INTEGER type
    • Output Columns:
      • clicks: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[clicks]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • clicks: Aggregated sum
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp cost 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report cost 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report cost 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[cost]
    • Cleaning: The column is cast to FLOAT type
    • Output Columns:
      • cost: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[cost]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • cost: Aggregated sum
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp date 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report date_day 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report date_day 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[date]
    • Cleaning: The column is cast to DATE type
    • Output Columns:
      • date_day: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[date_day]
    • Direct: The column is directly copied without any transformation
    • Aggregation: Used in the group by clause
    • Output Columns:
      • date_day: Directly copied
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp impressions 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report impressions 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report impressions 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[impressions]
    • Cleaning: The column is cast to INTEGER type
    • Output Columns:
      • impressions: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[impressions]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • impressions: Aggregated sum
14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. It doesn't perform any actual data manipulation or retrieval from the mentioned model. The query is likely used as a placeholder or template for further development.

Other
SQL Query
    
    
        
        
        
         
            
        
    select 
        cast(null as TEXT) as _dbt_source_relation
    limit 0
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp ad_group_id ad_id campaign_id date _fivetran_synced campaign_budget_amount campaign_budget_currency_code campaign_budget_type clicks cost impressions advertised_asin advertised_sku 33. source.amazon_ads_source.amazon_ads.advertised_product_report 33. source.amazon_ads_source.amazon_ads.advertised_product_report
Name Type Comment
ad_group_id integer None
ad_id integer None
campaign_id integer None
date date None
_fivetran_synced timestamp without time zone None
campaign_budget_amount double precision None
campaign_budget_currency_code text None
campaign_budget_type text None
clicks integer None
cost double precision None
impressions integer None
advertised_asin integer None
advertised_sku integer None
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp ad_group_id 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report ad_group_id 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report ad_group_id 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[ad_group_id]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • ad_group_id: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[ad_group_id]
    • Direct: The column is directly copied without any transformation
    • Integration: Used as a key to join with the ad_groups table
    • Output Columns:
      • ad_group_id: Directly copied
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp ad_id 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report ad_id 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report ad_id 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[ad_id]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • ad_id: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[ad_id]
    • Direct: The column is directly copied without any transformation
    • Integration: Used as a key to join with the ads table
    • Output Columns:
      • ad_id: Directly copied
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp campaign_id 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report campaign_id 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report campaign_id 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[campaign_id]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • campaign_id: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[campaign_id]
    • Direct: The column is directly copied without any transformation
    • Integration: Used as a key to join with the campaigns table
    • Output Columns:
      • campaign_id: Directly copied
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp date 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report date_day 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report date_day 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[date]
    • Cleaning: The column is cast to DATE type
    • Output Columns:
      • date_day: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[date_day]
    • Direct: The column is directly copied without any transformation
    • Aggregation: Used in the group by clause
    • Output Columns:
      • date_day: Directly copied
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp campaign_budget_amount 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report campaign_budget_amount 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report campaign_budget_amount 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[campaign_budget_amount]
    • Cleaning: The column is cast to FLOAT type
    • Output Columns:
      • campaign_budget_amount: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[campaign_budget_amount]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_budget_amount: Directly copied
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp campaign_budget_currency_code 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report campaign_budget_currency_code 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report campaign_budget_currency_code 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[campaign_budget_currency_code]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • campaign_budget_currency_code: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[campaign_budget_currency_code]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_budget_currency_code: Directly copied
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp campaign_budget_type 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report campaign_budget_type 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report campaign_budget_type 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[campaign_budget_type]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • campaign_budget_type: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[campaign_budget_type]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_budget_type: Directly copied
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp clicks 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report clicks 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report clicks 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[clicks]
    • Cleaning: The column is cast to INTEGER type
    • Output Columns:
      • clicks: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[clicks]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • clicks: Aggregated sum
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp cost 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report cost 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report cost 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[cost]
    • Cleaning: The column is cast to FLOAT type
    • Output Columns:
      • cost: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[cost]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • cost: Aggregated sum
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp impressions 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report impressions 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report impressions 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[impressions]
    • Cleaning: The column is cast to INTEGER type
    • Output Columns:
      • impressions: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[impressions]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • impressions: Aggregated sum
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp advertised_asin 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report advertised_asin 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report advertised_asin 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[advertised_asin]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • advertised_asin: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[advertised_asin]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • advertised_asin: Directly copied
Column Lineage
%3 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp advertised_sku 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report advertised_sku 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp:f0->13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report advertised_sku 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report
  • Input Column: 14. model.amazon_ads_source.stg_amazon_ads__advertised_product_report_tmp[advertised_sku]
    • Cleaning: The column is cast to TEXT type
    • Output Columns:
      • advertised_sku: Directly mapped after casting
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 13. model.amazon_ads_source.stg_amazon_ads__advertised_product_report[advertised_sku]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • advertised_sku: Directly copied
15. model.amazon_ads_source.stg_amazon_ads__campaign_history

This SQL query stages data from an Amazon Ads campaign history source. It casts various fields to specific data types, renames some columns, and adds a source relation column. The query also includes logic to identify the most recent record for each campaign using a window function. The final output includes all transformed columns along with a boolean flag indicating if each record is the most recent for that campaign.

CleaningDeduplicationOther
SQL Query
with base as (

    select * 
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__campaign_history_tmp
),

fields as (

    select
        
    cast(null as TEXT) as 
    
    bidding_strategy
    
 , 
    cast(null as timestamp) as 
    
    creation_date
    
 , 
    cast(null as date) as 
    
    end_date
    
 , 
    cast(null as TEXT) as 
    
    id
    
 , 
    cast(null as timestamp) as 
    
    last_updated_date
    
 , 
    cast(null as TEXT) as 
    
    name
    
 , 
    cast(null as integer) as 
    
    portfolio_id
    
 , 
    cast(null as integer) as 
    
    profile_id
    
 , 
    cast(null as TEXT) as 
    
    serving_status
    
 , 
    cast(null as date) as 
    
    start_date
    
 , 
    cast(null as TEXT) as 
    
    state
    
 , 
    cast(null as TEXT) as 
    
    targeting_type
    
 , 
    cast(null as float) as 
    
    budget
    
 , 
    cast(null as TEXT) as 
    
    budget_type
    
 , 
    cast(null as float) as 
    
    effective_budget
    
 


    
        


, cast('' as TEXT) as source_relation




    from base
),

final as (

    select
        source_relation, 
        cast(id as TEXT) as campaign_id,
        last_updated_date,
        bidding_strategy,
        creation_date,
        end_date,
        name as campaign_name,
        cast(portfolio_id as TEXT) as portfolio_id,
        cast(profile_id as TEXT) as profile_id,
        serving_status,
        start_date,
        state,
        targeting_type,
        budget,
        budget_type,
        effective_budget,
        row_number() over (partition by source_relation, id order by last_updated_date desc) = 1 as is_most_recent_record
    from fields
)

select *
from final
%3 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_id last_updated_date bidding_strategy creation_date end_date campaign_name portfolio_id profile_id serving_status start_date state targeting_type budget budget_type effective_budget is_most_recent_record 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp id last_updated_date bidding_strategy creation_date budget end_date name portfolio_id profile_id serving_status start_date state targeting_type budget_type effective_budget 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f1->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f1 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f2->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f2 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f3->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f4->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f12 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f5->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f4 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f6->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f5 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f7->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f6 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f8->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f7 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f9->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f8 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f10->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f9 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f11->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f10 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f12->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f11 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f13->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f13 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f14->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f14
Name Type Comment
campaign_id text None
last_updated_date text None
bidding_strategy text None
creation_date text None
end_date integer None
campaign_name text None
portfolio_id text None
profile_id text None
serving_status text None
start_date date None
state text None
targeting_type text None
budget integer None
budget_type text None
effective_budget integer None
is_most_recent_record boolean None
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_id 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report campaign_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:header 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->1. model.amazon_ads.amazon_ads__account_report:header 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report campaign_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report campaign_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report campaign_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Deduplication: Used in the window function to identify the most recent record
    • Output Columns:
      • campaign_id: Directly mapped after casting to TEXT
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Integration: used as a key to join with the report table
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Direct: The column is directly copied without any transformation
    • Integration: The column is used as a key to join with ad_groups table
    • Output Columns:
      • campaign_id: Directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Integration: used to join with the report table
    • Direct: directly copied to the output
    • Output Columns:
      • campaign_id: directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Integration: Used to join with the report table
    • Direct: Directly copied to the output
    • Output Columns:
      • campaign_id: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Integration: used as a key to join with the report table
    • Direct: directly copied to the output
    • Output Columns:
      • campaign_id: directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Integration: used to join with the report table
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Direct: The column is directly copied without any transformation
    • Integration: Used as a key to join with other tables
    • Output Columns:
      • campaign_id: Directly copied
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp last_updated_date 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history last_updated_date 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[last_updated_date]
    • Direct: Copied without transformation
    • Deduplication: Used in the window function to order and identify the most recent record
    • Output Columns:
      • last_updated_date: Directly copied
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp bidding_strategy 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history bidding_strategy 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[bidding_strategy]
    • Direct: Copied without transformation
    • Output Columns:
      • bidding_strategy: Directly copied
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp creation_date 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history creation_date 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[creation_date]
    • Direct: Copied without transformation
    • Output Columns:
      • creation_date: Directly copied
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp end_date 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history end_date 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[end_date]
    • Cleaning: Cast to date data type
    • Output Columns:
      • end_date: Directly mapped after casting to date
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp name 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_name 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report campaign_name 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report campaign_name 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report campaign_name 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_name 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report campaign_name 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[name]
    • Direct: Copied without transformation
    • Output Columns:
      • campaign_name: Directly copied and renamed
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_name]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_name: Directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_name]
    • Direct: directly copied to the output
    • Output Columns:
      • campaign_name: directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • campaign_name: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_name]
    • Direct: directly copied to the output
    • Output Columns:
      • campaign_name: directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_name]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_name: Directly copied
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp portfolio_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history portfolio_id 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:header 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:header 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->7. model.amazon_ads.amazon_ads__search_report:header 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:header 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:header 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->3. model.amazon_ads.amazon_ads__ad_report:header
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[portfolio_id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • portfolio_id: Directly mapped after casting to TEXT
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[portfolio_id]
    • Integration: The column is used as a key to join with portfolios table
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[portfolio_id]
    • Integration: used to join with the portfolios table
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[portfolio_id]
    • Integration: Used to join with the portfolios table
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[portfolio_id]
    • Integration: used as a key to join with the portfolios table
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[portfolio_id]
    • Integration: used to join with the portfolios table
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[portfolio_id]
    • Integration: Used as a key to join with the portfolios table
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp profile_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history profile_id 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:header 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:header 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report profile_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->1. model.amazon_ads.amazon_ads__account_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->7. model.amazon_ads.amazon_ads__search_report:header 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:header 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:header 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->3. model.amazon_ads.amazon_ads__ad_report:header
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[profile_id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • profile_id: Directly mapped after casting to TEXT
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[profile_id]
    • Integration: used as a key to join with the account_info table
    • Output Columns:
      • profile_id: Directly copied to the output
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[profile_id]
    • Integration: The column is used as a key to join with account_info table
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[profile_id]
    • Integration: used to join with the account_info table
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[profile_id]
    • Integration: Used to join with the account_info table
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[profile_id]
    • Integration: used as a key to join with the account_info table
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[profile_id]
    • Integration: used to join with the account_info table
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[profile_id]
    • Integration: Used as a key to join with the account_info table
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp serving_status 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history serving_status 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[serving_status]
    • Direct: Copied without transformation
    • Output Columns:
      • serving_status: Directly copied
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp start_date 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history start_date 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[start_date]
    • Cleaning: Cast to date data type
    • Output Columns:
      • start_date: Directly mapped after casting to date
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp state 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history state 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[state]
    • Direct: Copied without transformation
    • Output Columns:
      • state: Directly copied
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp targeting_type 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history targeting_type 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[targeting_type]
    • Direct: Copied without transformation
    • Output Columns:
      • targeting_type: Directly copied
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp budget 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history budget 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[budget]
    • Cleaning: Cast to float data type
    • Output Columns:
      • budget: Directly mapped after casting to float
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp budget_type 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history budget_type 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[budget_type]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_type: Directly copied
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp effective_budget 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history effective_budget 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[effective_budget]
    • Cleaning: Cast to float data type
    • Output Columns:
      • effective_budget: Directly mapped after casting to float
Column Lineage
%3 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history is_most_recent_record 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:header 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:header 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->1. model.amazon_ads.amazon_ads__account_report:header 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->7. model.amazon_ads.amazon_ads__search_report:header 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:header 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:header 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->3. model.amazon_ads.amazon_ads__ad_report:header
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[is_most_recent_record]
    • Filtering: the column is filtered to include only the most recent records (where is_most_recent_record = True)
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[is_most_recent_record]
    • Filtering: The column is filtered to select only the most recent records (where is_most_recent_record = True)
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[is_most_recent_record]
    • Filtering: only records where is_most_recent_record = True are included
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[is_most_recent_record]
    • Filtering: The query filters for the most recent record (where is_most_recent_record = True)
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[is_most_recent_record]
    • Filtering: used to filter for the most recent records (where is_most_recent_record = True)
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[is_most_recent_record]
    • Filtering: the column is filtered to select only the most recent records
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[is_most_recent_record]
    • Filtering: The column is filtered to include only the most recent records (where is_most_recent_record = True)
16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of TEXT data type. It doesn't retrieve any actual data from the 'model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp' model, as it limits the results to 0 rows. This query appears to be a placeholder or template for generating a schema without any data.

Other
SQL Query
    
    
        
        
        
         
            
        
    select 
        cast(null as TEXT) as _dbt_source_relation
    limit 0
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp id last_updated_date _fivetran_synced bidding_strategy creation_date budget end_date name portfolio_id profile_id serving_status start_date state targeting_type budget_type effective_budget 34. source.amazon_ads_source.amazon_ads.campaign_history 34. source.amazon_ads_source.amazon_ads.campaign_history
Name Type Comment
id integer None
last_updated_date text None
_fivetran_synced timestamp without time zone None
bidding_strategy text None
creation_date text None
budget integer None
end_date integer None
name text None
portfolio_id integer None
profile_id integer None
serving_status text None
start_date date None
state text None
targeting_type text None
budget_type text None
effective_budget integer None
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_id 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report campaign_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:header 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->1. model.amazon_ads.amazon_ads__account_report:header 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report campaign_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report campaign_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report campaign_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Deduplication: Used in the window function to identify the most recent record
    • Output Columns:
      • campaign_id: Directly mapped after casting to TEXT
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Integration: used as a key to join with the report table
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Direct: The column is directly copied without any transformation
    • Integration: The column is used as a key to join with ad_groups table
    • Output Columns:
      • campaign_id: Directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Integration: used to join with the report table
    • Direct: directly copied to the output
    • Output Columns:
      • campaign_id: directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Integration: Used to join with the report table
    • Direct: Directly copied to the output
    • Output Columns:
      • campaign_id: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Integration: used as a key to join with the report table
    • Direct: directly copied to the output
    • Output Columns:
      • campaign_id: directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Integration: used to join with the report table
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_id]
    • Direct: The column is directly copied without any transformation
    • Integration: Used as a key to join with other tables
    • Output Columns:
      • campaign_id: Directly copied
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp last_updated_date 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history last_updated_date 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[last_updated_date]
    • Direct: Copied without transformation
    • Deduplication: Used in the window function to order and identify the most recent record
    • Output Columns:
      • last_updated_date: Directly copied
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp bidding_strategy 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history bidding_strategy 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[bidding_strategy]
    • Direct: Copied without transformation
    • Output Columns:
      • bidding_strategy: Directly copied
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp creation_date 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history creation_date 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[creation_date]
    • Direct: Copied without transformation
    • Output Columns:
      • creation_date: Directly copied
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp budget 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history budget 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[budget]
    • Cleaning: Cast to float data type
    • Output Columns:
      • budget: Directly mapped after casting to float
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp end_date 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history end_date 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[end_date]
    • Cleaning: Cast to date data type
    • Output Columns:
      • end_date: Directly mapped after casting to date
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp name 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history campaign_name 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report campaign_name 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report campaign_name 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report campaign_name 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_name 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report campaign_name 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[name]
    • Direct: Copied without transformation
    • Output Columns:
      • campaign_name: Directly copied and renamed
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_name]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_name: Directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_name]
    • Direct: directly copied to the output
    • Output Columns:
      • campaign_name: directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • campaign_name: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_name]
    • Direct: directly copied to the output
    • Output Columns:
      • campaign_name: directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[campaign_name]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_name: Directly copied
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp portfolio_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history portfolio_id 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:header 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:header 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->7. model.amazon_ads.amazon_ads__search_report:header 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:header 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:header 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->3. model.amazon_ads.amazon_ads__ad_report:header
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[portfolio_id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • portfolio_id: Directly mapped after casting to TEXT
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[portfolio_id]
    • Integration: The column is used as a key to join with portfolios table
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[portfolio_id]
    • Integration: used to join with the portfolios table
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[portfolio_id]
    • Integration: Used to join with the portfolios table
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[portfolio_id]
    • Integration: used as a key to join with the portfolios table
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[portfolio_id]
    • Integration: used to join with the portfolios table
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[portfolio_id]
    • Integration: Used as a key to join with the portfolios table
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp profile_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history profile_id 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:header 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:header 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report profile_id 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->1. model.amazon_ads.amazon_ads__account_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->7. model.amazon_ads.amazon_ads__search_report:header 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:header 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:header 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report 15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0->3. model.amazon_ads.amazon_ads__ad_report:header
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[profile_id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • profile_id: Directly mapped after casting to TEXT
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[profile_id]
    • Integration: used as a key to join with the account_info table
    • Output Columns:
      • profile_id: Directly copied to the output
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[profile_id]
    • Integration: The column is used as a key to join with account_info table
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[profile_id]
    • Integration: used to join with the account_info table
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[profile_id]
    • Integration: Used to join with the account_info table
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[profile_id]
    • Integration: used as a key to join with the account_info table
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[profile_id]
    • Integration: used to join with the account_info table
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 15. model.amazon_ads_source.stg_amazon_ads__campaign_history[profile_id]
    • Integration: Used as a key to join with the account_info table
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp serving_status 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history serving_status 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[serving_status]
    • Direct: Copied without transformation
    • Output Columns:
      • serving_status: Directly copied
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp start_date 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history start_date 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[start_date]
    • Cleaning: Cast to date data type
    • Output Columns:
      • start_date: Directly mapped after casting to date
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp state 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history state 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[state]
    • Direct: Copied without transformation
    • Output Columns:
      • state: Directly copied
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp targeting_type 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history targeting_type 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[targeting_type]
    • Direct: Copied without transformation
    • Output Columns:
      • targeting_type: Directly copied
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp budget_type 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history budget_type 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[budget_type]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_type: Directly copied
Column Lineage
%3 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp effective_budget 15. model.amazon_ads_source.stg_amazon_ads__campaign_history 15. model.amazon_ads_source.stg_amazon_ads__campaign_history effective_budget 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp:f0->15. model.amazon_ads_source.stg_amazon_ads__campaign_history:f0
15. model.amazon_ads_source.stg_amazon_ads__campaign_history
  • Input Column: 16. model.amazon_ads_source.stg_amazon_ads__campaign_history_tmp[effective_budget]
    • Cleaning: Cast to float data type
    • Output Columns:
      • effective_budget: Directly mapped after casting to float
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report

This SQL query stages data from a temporary table, casts various fields to specific data types, and prepares a final selection of columns for the Amazon Ads campaign-level report. It primarily focuses on cleaning and standardizing the data structure.

CleaningOther
SQL Query
with base as (

    select * 
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp
),

fields as (

    select
        
    cast(null as TEXT) as 
    
    campaign_applicable_budget_rule_id
    
 , 
    cast(null as TEXT) as 
    
    campaign_applicable_budget_rule_name
    
 , 
    cast(null as TEXT) as 
    
    campaign_bidding_strategy
    
 , 
    cast(null as float) as 
    
    campaign_budget_amount
    
 , 
    cast(null as TEXT) as 
    
    campaign_budget_currency_code
    
 , 
    cast(null as TEXT) as 
    
    campaign_budget_type
    
 , 
    cast(null as integer) as 
    
    campaign_id
    
 , 
    cast(null as float) as 
    
    campaign_rule_based_budget_amount
    
 , 
    cast(null as integer) as 
    
    clicks
    
 , 
    cast(null as float) as 
    
    cost
    
 , 
    cast(null as date) as 
    
    date
    
 , 
    cast(null as integer) as 
    
    impressions
    
 


    
        


, cast('' as TEXT) as source_relation




    from base
),

final as (

    select
        source_relation, 
        campaign_applicable_budget_rule_id,
        campaign_applicable_budget_rule_name,
        campaign_bidding_strategy,
        campaign_budget_amount,
        campaign_budget_currency_code,
        campaign_budget_type,
        cast(campaign_id as TEXT) as campaign_id,
        campaign_rule_based_budget_amount,
        clicks,
        cost,
        date as date_day,
        impressions

        




    from fields
)

select *
from final
%3 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_applicable_budget_rule_id campaign_applicable_budget_rule_name campaign_bidding_strategy campaign_budget_amount campaign_budget_currency_code campaign_budget_type campaign_id campaign_rule_based_budget_amount clicks cost date_day impressions 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_id date campaign_applicable_budget_rule_id campaign_applicable_budget_rule_name campaign_bidding_strategy campaign_budget_amount campaign_budget_currency_code campaign_budget_type clicks cost impressions campaign_rule_based_budget_amount 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f6 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f1->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f10 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f2->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f3->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f1 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f4->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f2 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f5->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f6->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f4 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f7->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f5 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f8->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f8 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f9->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f9 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f10->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f11 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f11->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f7
Name Type Comment
campaign_applicable_budget_rule_id integer None
campaign_applicable_budget_rule_name integer None
campaign_bidding_strategy text None
campaign_budget_amount double precision None
campaign_budget_currency_code text None
campaign_budget_type text None
campaign_id text None
campaign_rule_based_budget_amount integer None
clicks integer None
cost double precision None
date_day date None
impressions integer None
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_applicable_budget_rule_id 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_applicable_budget_rule_id 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_applicable_budget_rule_id]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_applicable_budget_rule_id: Directly mapped
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_applicable_budget_rule_name 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_applicable_budget_rule_name 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_applicable_budget_rule_name]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_applicable_budget_rule_name: Directly mapped
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_bidding_strategy 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_bidding_strategy 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_bidding_strategy 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_bidding_strategy]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_bidding_strategy: Directly mapped
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_bidding_strategy]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_bidding_strategy: Directly copied
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_budget_amount 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_budget_amount 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_budget_amount 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_budget_amount]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_budget_amount: Directly mapped
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_budget_amount]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_budget_amount: Directly copied
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_budget_currency_code 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_budget_currency_code 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_budget_currency_code 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_budget_currency_code]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_budget_currency_code: Directly mapped
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_budget_currency_code]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_budget_currency_code: Directly copied
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_budget_type 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_budget_type 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_budget_type 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_budget_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_budget_type: Directly mapped
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_budget_type]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_budget_type: Directly copied
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_id 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_id 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->6. model.amazon_ads.amazon_ads__portfolio_report:header 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->1. model.amazon_ads.amazon_ads__account_report:header 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_id 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_id]
    • Cleaning: The column is cast as TEXT in the final output
    • Output Columns:
      • campaign_id: Directly mapped after casting to TEXT
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_id]
    • Integration: Used as a key to join with the campaigns table
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_id]
    • Direct: The column is directly copied without any transformation
    • Integration: Used as a key to join with the campaigns table
    • Output Columns:
      • campaign_id: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_id]
    • Integration: Used as a key to join with the campaigns table
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_rule_based_budget_amount 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_rule_based_budget_amount 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_rule_based_budget_amount]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_rule_based_budget_amount: Directly mapped
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp clicks 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report clicks 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report clicks 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report clicks 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->1. model.amazon_ads.amazon_ads__account_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report clicks 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[clicks]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • clicks: Directly mapped
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[clicks]
    • Aggregation: Summed up in the fields CTE
    • Output Columns:
      • clicks: Directly mapped after aggregation
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[clicks]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • clicks: Aggregated sum
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[clicks]
    • Aggregation: Summed up in the final select statement
    • Output Columns:
      • clicks: Aggregated sum of clicks
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp cost 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report cost 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report cost 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report cost 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->1. model.amazon_ads.amazon_ads__account_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report cost 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[cost]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • cost: Directly mapped
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[cost]
    • Aggregation: Summed up in the fields CTE
    • Output Columns:
      • cost: Directly mapped after aggregation
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[cost]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • cost: Aggregated sum
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[cost]
    • Aggregation: Summed up in the final select statement
    • Output Columns:
      • cost: Aggregated sum of cost
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp date 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report date_day 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report date_day 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report date_day 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->1. model.amazon_ads.amazon_ads__account_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report date_day 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[date]
    • Cleaning: The column is renamed to date_day in the final output
    • Output Columns:
      • date_day: Directly mapped and renamed
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[date_day]
    • Direct: Copied without transformation
    • Aggregation: Used in the GROUP BY clause
    • Output Columns:
      • date_day: Directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[date_day]
    • Direct: The column is directly copied without any transformation
    • Aggregation: Used in the group by clause
    • Output Columns:
      • date_day: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[date_day]
    • Direct: Directly selected in the final output
    • Output Columns:
      • date_day: Directly copied to output
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp impressions 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report impressions 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report impressions 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report impressions 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->1. model.amazon_ads.amazon_ads__account_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report impressions 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[impressions]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • impressions: Directly mapped
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[impressions]
    • Aggregation: Summed up in the fields CTE
    • Output Columns:
      • impressions: Directly mapped after aggregation
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[impressions]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • impressions: Aggregated sum
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[impressions]
    • Aggregation: Summed up in the final select statement
    • Output Columns:
      • impressions: Aggregated sum of impressions
18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of TEXT data type. It's likely used as a placeholder or template for further development or testing purposes.

Other
SQL Query
    
    
        
        
        
         
            
        
    select 
        cast(null as TEXT) as _dbt_source_relation
    limit 0
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_id date _fivetran_synced campaign_applicable_budget_rule_id campaign_applicable_budget_rule_name campaign_bidding_strategy campaign_budget_amount campaign_budget_currency_code campaign_budget_type clicks cost impressions campaign_rule_based_budget_amount 35. source.amazon_ads_source.amazon_ads.campaign_level_report 35. source.amazon_ads_source.amazon_ads.campaign_level_report
Name Type Comment
campaign_id integer None
date date None
_fivetran_synced timestamp without time zone None
campaign_applicable_budget_rule_id integer None
campaign_applicable_budget_rule_name integer None
campaign_bidding_strategy text None
campaign_budget_amount double precision None
campaign_budget_currency_code text None
campaign_budget_type text None
clicks integer None
cost double precision None
impressions integer None
campaign_rule_based_budget_amount integer None
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_id 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_id 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->6. model.amazon_ads.amazon_ads__portfolio_report:header 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->1. model.amazon_ads.amazon_ads__account_report:header 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_id 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_id]
    • Cleaning: The column is cast as TEXT in the final output
    • Output Columns:
      • campaign_id: Directly mapped after casting to TEXT
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_id]
    • Integration: Used as a key to join with the campaigns table
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_id]
    • Direct: The column is directly copied without any transformation
    • Integration: Used as a key to join with the campaigns table
    • Output Columns:
      • campaign_id: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_id]
    • Integration: Used as a key to join with the campaigns table
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp date 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report date_day 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report date_day 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report date_day 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->1. model.amazon_ads.amazon_ads__account_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report date_day 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[date]
    • Cleaning: The column is renamed to date_day in the final output
    • Output Columns:
      • date_day: Directly mapped and renamed
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[date_day]
    • Direct: Copied without transformation
    • Aggregation: Used in the GROUP BY clause
    • Output Columns:
      • date_day: Directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[date_day]
    • Direct: The column is directly copied without any transformation
    • Aggregation: Used in the group by clause
    • Output Columns:
      • date_day: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[date_day]
    • Direct: Directly selected in the final output
    • Output Columns:
      • date_day: Directly copied to output
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_applicable_budget_rule_id 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_applicable_budget_rule_id 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_applicable_budget_rule_id]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_applicable_budget_rule_id: Directly mapped
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_applicable_budget_rule_name 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_applicable_budget_rule_name 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_applicable_budget_rule_name]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_applicable_budget_rule_name: Directly mapped
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_bidding_strategy 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_bidding_strategy 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_bidding_strategy 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_bidding_strategy]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_bidding_strategy: Directly mapped
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_bidding_strategy]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_bidding_strategy: Directly copied
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_budget_amount 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_budget_amount 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_budget_amount 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_budget_amount]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_budget_amount: Directly mapped
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_budget_amount]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_budget_amount: Directly copied
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_budget_currency_code 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_budget_currency_code 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_budget_currency_code 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_budget_currency_code]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_budget_currency_code: Directly mapped
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_budget_currency_code]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_budget_currency_code: Directly copied
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_budget_type 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_budget_type 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report campaign_budget_type 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_budget_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_budget_type: Directly mapped
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[campaign_budget_type]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • campaign_budget_type: Directly copied
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp clicks 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report clicks 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report clicks 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report clicks 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->1. model.amazon_ads.amazon_ads__account_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report clicks 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[clicks]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • clicks: Directly mapped
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[clicks]
    • Aggregation: Summed up in the fields CTE
    • Output Columns:
      • clicks: Directly mapped after aggregation
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[clicks]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • clicks: Aggregated sum
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[clicks]
    • Aggregation: Summed up in the final select statement
    • Output Columns:
      • clicks: Aggregated sum of clicks
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp cost 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report cost 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report cost 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report cost 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->1. model.amazon_ads.amazon_ads__account_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report cost 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[cost]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • cost: Directly mapped
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[cost]
    • Aggregation: Summed up in the fields CTE
    • Output Columns:
      • cost: Directly mapped after aggregation
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[cost]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • cost: Aggregated sum
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[cost]
    • Aggregation: Summed up in the final select statement
    • Output Columns:
      • cost: Aggregated sum of cost
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp impressions 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report impressions 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report impressions 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report impressions 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->1. model.amazon_ads.amazon_ads__account_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report impressions 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[impressions]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • impressions: Directly mapped
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[impressions]
    • Aggregation: Summed up in the fields CTE
    • Output Columns:
      • impressions: Directly mapped after aggregation
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[impressions]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • impressions: Aggregated sum
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report[impressions]
    • Aggregation: Summed up in the final select statement
    • Output Columns:
      • impressions: Aggregated sum of impressions
Column Lineage
%3 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp campaign_rule_based_budget_amount 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report 17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report campaign_rule_based_budget_amount 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp:f0->17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report:f0
17. model.amazon_ads_source.stg_amazon_ads__campaign_level_report
  • Input Column: 18. model.amazon_ads_source.stg_amazon_ads__campaign_level_report_tmp[campaign_rule_based_budget_amount]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_rule_based_budget_amount: Directly mapped
19. model.amazon_ads_source.stg_amazon_ads__keyword_history

This SQL query processes data from a staging table for Amazon Ads keyword history. It casts various fields to specific data types, renames some columns, and adds a source relation field. The query also includes a window function to identify the most recent record for each keyword across different source relations. Finally, it selects all fields from the processed data.

CleaningDeduplicationOther
SQL Query
with base as (

    select * 
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__keyword_history_tmp
),

fields as (

    select
        
    cast(null as integer) as 
    
    ad_group_id
    
 , 
    cast(null as float) as 
    
    bid
    
 , 
    cast(null as integer) as 
    
    campaign_id
    
 , 
    cast(null as timestamp) as 
    
    creation_date
    
 , 
    cast(null as TEXT) as 
    
    id
    
 , 
    cast(null as TEXT) as 
    
    keyword_text
    
 , 
    cast(null as timestamp) as 
    
    last_updated_date
    
 , 
    cast(null as TEXT) as 
    
    match_type
    
 , 
    cast(null as TEXT) as 
    
    native_language_keyword
    
 , 
    cast(null as TEXT) as 
    
    serving_status
    
 , 
    cast(null as TEXT) as 
    
    state
    
 , 
    cast(null as TEXT) as 
    
    native_language_locale
    
 


    
        


, cast('' as TEXT) as source_relation




    from base
),

final as (

    select
        source_relation, 
        cast(id as TEXT) as keyword_id,
        cast(ad_group_id as TEXT) as ad_group_id,
        bid,
        cast(campaign_id as TEXT) as campaign_id,
        creation_date,
        keyword_text,
        last_updated_date,
        match_type,
        native_language_keyword,
        serving_status,
        state,
        native_language_locale,
        row_number() over (partition by source_relation, id order by last_updated_date desc) = 1 as is_most_recent_record
    from fields
)

select *
from final
%3 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history keyword_id ad_group_id bid campaign_id creation_date keyword_text last_updated_date match_type native_language_keyword serving_status state native_language_locale is_most_recent_record 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp id last_updated_date ad_group_id bid campaign_id creation_date keyword_text match_type native_language_keyword serving_status state native_language_locale 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f1->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f6 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f2->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f1 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f3->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f2 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f4->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f5->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f4 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f6->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f5 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f7->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f7 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f8->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f8 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f9->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f9 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f10->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f10 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f11->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f11
Name Type Comment
keyword_id text None
ad_group_id text None
bid double precision None
campaign_id text None
creation_date text None
keyword_text text None
last_updated_date text None
match_type text None
native_language_keyword integer None
serving_status text None
state text None
native_language_locale integer None
is_most_recent_record boolean None
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp id 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history keyword_id 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report keyword_id 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report keyword_id 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Deduplication: Used in the window function to identify the most recent record
    • Output Columns:
      • keyword_id: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[keyword_id]
    • Direct: The column is directly copied without any transformation
    • Integration: Used as a key to join with the report table
    • Output Columns:
      • keyword_id: Directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[keyword_id]
    • Integration: used to join with the report table
    • Direct: directly copied to the output
    • Output Columns:
      • keyword_id: directly copied
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp ad_group_id 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history ad_group_id 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[ad_group_id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • ad_group_id: Directly mapped after casting to TEXT
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp bid 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history bid 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[bid]
    • Cleaning: Cast to float data type
    • Output Columns:
      • bid: Directly mapped after casting to float
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp campaign_id 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history campaign_id 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[campaign_id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • campaign_id: Directly mapped after casting to TEXT
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp creation_date 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history creation_date 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[creation_date]
    • Cleaning: Cast to timestamp data type
    • Output Columns:
      • creation_date: Directly mapped after casting to timestamp
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp keyword_text 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history keyword_text 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report keyword_text 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report keyword_text 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[keyword_text]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • keyword_text: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[keyword_text]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • keyword_text: Directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[keyword_text]
    • Direct: directly copied to the output
    • Output Columns:
      • keyword_text: directly copied
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp last_updated_date 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history last_updated_date 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[last_updated_date]
    • Cleaning: Cast to timestamp data type
    • Deduplication: Used in the window function to order and identify the most recent record
    • Output Columns:
      • last_updated_date: Directly mapped after casting to timestamp
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp match_type 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history match_type 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report match_type 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[match_type]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • match_type: Directly mapped after casting to TEXT
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[match_type]
    • Direct: directly copied to the output
    • Output Columns:
      • match_type: directly copied
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp native_language_keyword 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history native_language_keyword 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[native_language_keyword]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • native_language_keyword: Directly mapped after casting to TEXT
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp serving_status 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history serving_status 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report serving_status 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report serving_status 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[serving_status]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • serving_status: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[serving_status]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • serving_status: Directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[serving_status]
    • Direct: directly copied to the output
    • Output Columns:
      • serving_status: directly copied
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp state 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history state 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report state 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report state 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[state]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • state: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[state]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • state: Directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[state]
    • Direct: directly copied to the output
    • Output Columns:
      • state: directly copied
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp native_language_locale 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history native_language_locale 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[native_language_locale]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • native_language_locale: Directly mapped after casting to TEXT
Column Lineage
%3 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history is_most_recent_record 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:header 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->7. model.amazon_ads.amazon_ads__search_report:header
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[is_most_recent_record]
    • Filtering: The column is filtered to include only the most recent records
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[is_most_recent_record]
    • Filtering: the query filters for the most recent records (where is_most_recent_record = True)
20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of TEXT data type. It doesn't perform any actual data manipulation or retrieval from the 'model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp' model. The query is likely used as a placeholder or for testing purposes.

Other
SQL Query
    
    
        
        
        
         
            
        
    select 
        cast(null as TEXT) as _dbt_source_relation
    limit 0
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp id last_updated_date _fivetran_synced ad_group_id bid campaign_id creation_date keyword_text match_type native_language_keyword serving_status state native_language_locale 36. source.amazon_ads_source.amazon_ads.keyword_history 36. source.amazon_ads_source.amazon_ads.keyword_history
Name Type Comment
id integer None
last_updated_date text None
_fivetran_synced timestamp without time zone None
ad_group_id integer None
bid double precision None
campaign_id integer None
creation_date text None
keyword_text text None
match_type text None
native_language_keyword integer None
serving_status text None
state text None
native_language_locale integer None
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp id 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history keyword_id 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report keyword_id 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report keyword_id 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Deduplication: Used in the window function to identify the most recent record
    • Output Columns:
      • keyword_id: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[keyword_id]
    • Direct: The column is directly copied without any transformation
    • Integration: Used as a key to join with the report table
    • Output Columns:
      • keyword_id: Directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[keyword_id]
    • Integration: used to join with the report table
    • Direct: directly copied to the output
    • Output Columns:
      • keyword_id: directly copied
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp last_updated_date 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history last_updated_date 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[last_updated_date]
    • Cleaning: Cast to timestamp data type
    • Deduplication: Used in the window function to order and identify the most recent record
    • Output Columns:
      • last_updated_date: Directly mapped after casting to timestamp
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp ad_group_id 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history ad_group_id 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[ad_group_id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • ad_group_id: Directly mapped after casting to TEXT
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp bid 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history bid 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[bid]
    • Cleaning: Cast to float data type
    • Output Columns:
      • bid: Directly mapped after casting to float
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp campaign_id 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history campaign_id 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[campaign_id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • campaign_id: Directly mapped after casting to TEXT
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp creation_date 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history creation_date 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[creation_date]
    • Cleaning: Cast to timestamp data type
    • Output Columns:
      • creation_date: Directly mapped after casting to timestamp
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp keyword_text 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history keyword_text 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report keyword_text 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report keyword_text 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[keyword_text]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • keyword_text: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[keyword_text]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • keyword_text: Directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[keyword_text]
    • Direct: directly copied to the output
    • Output Columns:
      • keyword_text: directly copied
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp match_type 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history match_type 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report match_type 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[match_type]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • match_type: Directly mapped after casting to TEXT
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[match_type]
    • Direct: directly copied to the output
    • Output Columns:
      • match_type: directly copied
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp native_language_keyword 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history native_language_keyword 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[native_language_keyword]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • native_language_keyword: Directly mapped after casting to TEXT
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp serving_status 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history serving_status 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report serving_status 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report serving_status 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[serving_status]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • serving_status: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[serving_status]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • serving_status: Directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[serving_status]
    • Direct: directly copied to the output
    • Output Columns:
      • serving_status: directly copied
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp state 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history state 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report state 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report state 19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[state]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • state: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[state]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • state: Directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 19. model.amazon_ads_source.stg_amazon_ads__keyword_history[state]
    • Direct: directly copied to the output
    • Output Columns:
      • state: directly copied
Column Lineage
%3 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp native_language_locale 19. model.amazon_ads_source.stg_amazon_ads__keyword_history 19. model.amazon_ads_source.stg_amazon_ads__keyword_history native_language_locale 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp:f0->19. model.amazon_ads_source.stg_amazon_ads__keyword_history:f0
19. model.amazon_ads_source.stg_amazon_ads__keyword_history
  • Input Column: 20. model.amazon_ads_source.stg_amazon_ads__keyword_history_tmp[native_language_locale]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • native_language_locale: Directly mapped after casting to TEXT
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history

This SQL query stages data from a temporary table, casts columns to specific data types, renames some columns, and adds a source_relation column. It then creates a final table with transformed columns, including a new column to identify the most recent record for each portfolio. The query focuses on preparing Amazon Ads portfolio history data for further analysis or integration.

CleaningDeduplicationOther
SQL Query
with base as (

    select * 
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__portfolio_history_tmp
),

fields as (

    select
        
    cast(null as float) as 
    
    budget_amount
    
 , 
    cast(null as TEXT) as 
    
    budget_currency_code
    
 , 
    cast(null as date) as 
    
    budget_end_date
    
 , 
    cast(null as TEXT) as 
    
    budget_policy
    
 , 
    cast(null as date) as 
    
    budget_start_date
    
 , 
    cast(null as timestamp) as 
    
    creation_date
    
 , 
    cast(null as integer) as 
    
    id
    
 , 
    cast(null as boolean) as 
    
    in_budget
    
 , 
    cast(null as timestamp) as 
    
    last_updated_date
    
 , 
    cast(null as TEXT) as 
    
    name
    
 , 
    cast(null as integer) as 
    
    profile_id
    
 , 
    cast(null as TEXT) as 
    
    serving_status
    
 , 
    cast(null as TEXT) as 
    
    state
    
 


    
        


, cast('' as TEXT) as source_relation




    from base
),

final as (

    select
        source_relation, 
        cast(id as TEXT) as portfolio_id,
        budget_amount,
        budget_currency_code,
        budget_end_date,
        budget_policy,
        budget_start_date,
        creation_date,
        in_budget,
        last_updated_date,
        name as portfolio_name,
        cast(profile_id as TEXT) as profile_id,
        serving_status,
        state,
        row_number() over (partition by source_relation, id order by last_updated_date desc) = 1 as is_most_recent_record
    from fields
)

select *
from final
%3 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_id budget_amount budget_currency_code budget_end_date budget_policy budget_start_date creation_date in_budget last_updated_date portfolio_name profile_id serving_status state is_most_recent_record 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp id last_updated_date budget_amount budget_currency_code budget_end_date budget_policy budget_start_date creation_date in_budget name profile_id serving_status state 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f1->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f8 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f1->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f13 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f2->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f1 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f3->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f2 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f4->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f5->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f4 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f6->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f5 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f7->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f6 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f8->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f7 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f9->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f9 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f10->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f10 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f11->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f11 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f12->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f12
Name Type Comment
portfolio_id text None
budget_amount integer None
budget_currency_code integer None
budget_end_date integer None
budget_policy integer None
budget_start_date integer None
creation_date text None
in_budget boolean None
last_updated_date text None
portfolio_name text None
profile_id text None
serving_status text None
state text None
is_most_recent_record boolean None
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp id 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_id 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report portfolio_id 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_id 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • portfolio_id: Directly mapped after casting
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_id]
    • Direct: The column is directly copied without any transformation
    • Integration: The column is used as a key to join with other tables
    • Output Columns:
      • portfolio_id: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_id]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • portfolio_id: Directly copied
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Integration: used as a key to join with the campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • portfolio_id: directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Direct: The column is directly copied without any transformation
    • Integration: The column is used as a key to join with the campaigns table
    • Output Columns:
      • portfolio_id: Directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Integration: Used as a key to join with the campaigns table
    • Direct: Directly copied to the output
    • Output Columns:
      • portfolio_id: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Integration: Used as a key to join with the campaigns table
    • Direct: Directly copied to the output
    • Output Columns:
      • portfolio_id: Directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Integration: used as a key to join with campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • portfolio_id: directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_amount 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_amount 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report budget_amount 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history budget_amount 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_amount]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_amount: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_amount]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • budget_amount: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_amount]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • budget_amount: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_currency_code 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_currency_code 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report budget_currency_code 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history budget_currency_code 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_currency_code]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_currency_code: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_currency_code]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • budget_currency_code: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_currency_code]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • budget_currency_code: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_end_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_end_date 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report budget_end_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history budget_end_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_end_date]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_end_date: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_end_date]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • budget_end_date: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_end_date]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • budget_end_date: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_policy 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_policy 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report budget_policy 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history budget_policy 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_policy]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_policy: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_policy]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • budget_policy: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_policy]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • budget_policy: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_start_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_start_date 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report budget_start_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history budget_start_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_start_date]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_start_date: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_start_date]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • budget_start_date: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_start_date]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • budget_start_date: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp creation_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history creation_date 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history creation_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[creation_date]
    • Direct: Copied without transformation
    • Output Columns:
      • creation_date: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[creation_date]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • creation_date: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp in_budget 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history in_budget 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report in_budget 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history in_budget 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[in_budget]
    • Direct: Copied without transformation
    • Output Columns:
      • in_budget: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[in_budget]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • in_budget: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[in_budget]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • in_budget: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp last_updated_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history is_most_recent_record last_updated_date 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f1 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history last_updated_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f1->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[last_updated_date]
    • Direct: Copied without transformation
    • Deduplication: Used in window function to determine the most recent record
    • Output Columns:
      • last_updated_date: Directly copied
      • is_most_recent_record: Used in window function to determine this
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[last_updated_date]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • last_updated_date: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp name 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_name 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report portfolio_name 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_name 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[name]
    • Direct: Copied without transformation
    • Output Columns:
      • portfolio_name: Directly copied and renamed
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_name]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • portfolio_name: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_name]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • portfolio_name: Directly copied
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: directly copied to the output
    • Output Columns:
      • portfolio_name: directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • portfolio_name: Directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • portfolio_name: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • portfolio_name: Directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: directly copied to the output
    • Output Columns:
      • portfolio_name: directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp profile_id 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history profile_id 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:header 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history profile_id 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[profile_id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • profile_id: Directly mapped after casting
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[profile_id]
    • Integration: The column is used indirectly for joining with other tables
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[profile_id]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • profile_id: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp serving_status 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history serving_status 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report serving_status 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history serving_status 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[serving_status]
    • Direct: Copied without transformation
    • Output Columns:
      • serving_status: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[serving_status]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • serving_status: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[serving_status]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • serving_status: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp state 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history state 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report state 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history state 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[state]
    • Direct: Copied without transformation
    • Output Columns:
      • state: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[state]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • state: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[state]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • state: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp last_updated_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history is_most_recent_record last_updated_date 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f1 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:header 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history is_most_recent_record 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[last_updated_date]
    • Direct: Copied without transformation
    • Deduplication: Used in window function to determine the most recent record
    • Output Columns:
      • last_updated_date: Directly copied
      • is_most_recent_record: Used in window function to determine this
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[is_most_recent_record]
    • Filtering: The column is used to filter for the most recent records
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[is_most_recent_record]
    • Filtering: This column is used to filter the data to include only the most recent records
    • Output Columns:
      • is_most_recent_record: Directly copied after filtering
22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp

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

Other
SQL Query
    
    
        
        
        
         
            
        
    select 
        cast(null as TEXT) as _dbt_source_relation
    limit 0
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp id last_updated_date _fivetran_synced budget_amount budget_currency_code budget_end_date budget_policy budget_start_date creation_date in_budget name profile_id serving_status state 37. source.amazon_ads_source.amazon_ads.portfolio_history 37. source.amazon_ads_source.amazon_ads.portfolio_history
Name Type Comment
id integer None
last_updated_date text None
_fivetran_synced timestamp without time zone None
budget_amount integer None
budget_currency_code integer None
budget_end_date integer None
budget_policy integer None
budget_start_date integer None
creation_date text None
in_budget boolean None
name text None
profile_id integer None
serving_status text None
state text None
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp id 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_id 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report portfolio_id 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_id 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report portfolio_id 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • portfolio_id: Directly mapped after casting
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_id]
    • Direct: The column is directly copied without any transformation
    • Integration: The column is used as a key to join with other tables
    • Output Columns:
      • portfolio_id: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_id]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • portfolio_id: Directly copied
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Integration: used as a key to join with the campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • portfolio_id: directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Direct: The column is directly copied without any transformation
    • Integration: The column is used as a key to join with the campaigns table
    • Output Columns:
      • portfolio_id: Directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Integration: Used as a key to join with the campaigns table
    • Direct: Directly copied to the output
    • Output Columns:
      • portfolio_id: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Integration: Used as a key to join with the campaigns table
    • Direct: Directly copied to the output
    • Output Columns:
      • portfolio_id: Directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_id]
    • Integration: used as a key to join with campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • portfolio_id: directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp last_updated_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history is_most_recent_record last_updated_date 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f1 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history is_most_recent_record last_updated_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f1->8. model.amazon_ads.int_amazon_ads__portfolio_history:f1 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:header
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[last_updated_date]
    • Direct: Copied without transformation
    • Deduplication: Used in window function to determine the most recent record
    • Output Columns:
      • last_updated_date: Directly copied
      • is_most_recent_record: Used in window function to determine this
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[is_most_recent_record]
    • Filtering: The column is used to filter for the most recent records
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[last_updated_date]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • last_updated_date: Directly copied
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[is_most_recent_record]
    • Filtering: This column is used to filter the data to include only the most recent records
    • Output Columns:
      • is_most_recent_record: Directly copied after filtering
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_amount 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_amount 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report budget_amount 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history budget_amount 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_amount]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_amount: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_amount]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • budget_amount: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_amount]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • budget_amount: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_currency_code 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_currency_code 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report budget_currency_code 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history budget_currency_code 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_currency_code]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_currency_code: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_currency_code]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • budget_currency_code: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_currency_code]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • budget_currency_code: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_end_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_end_date 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report budget_end_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history budget_end_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_end_date]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_end_date: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_end_date]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • budget_end_date: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_end_date]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • budget_end_date: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_policy 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_policy 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report budget_policy 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history budget_policy 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_policy]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_policy: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_policy]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • budget_policy: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_policy]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • budget_policy: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp budget_start_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history budget_start_date 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report budget_start_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history budget_start_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[budget_start_date]
    • Direct: Copied without transformation
    • Output Columns:
      • budget_start_date: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_start_date]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • budget_start_date: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[budget_start_date]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • budget_start_date: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp creation_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history creation_date 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history creation_date 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[creation_date]
    • Direct: Copied without transformation
    • Output Columns:
      • creation_date: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[creation_date]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • creation_date: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp in_budget 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history in_budget 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report in_budget 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history in_budget 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[in_budget]
    • Direct: Copied without transformation
    • Output Columns:
      • in_budget: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[in_budget]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • in_budget: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[in_budget]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • in_budget: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp name 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history portfolio_name 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report portfolio_name 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history portfolio_name 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report portfolio_name 8. model.amazon_ads.int_amazon_ads__portfolio_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[name]
    • Direct: Copied without transformation
    • Output Columns:
      • portfolio_name: Directly copied and renamed
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_name]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • portfolio_name: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[portfolio_name]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • portfolio_name: Directly copied
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: directly copied to the output
    • Output Columns:
      • portfolio_name: directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • portfolio_name: Directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • portfolio_name: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • portfolio_name: Directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 8. model.amazon_ads.int_amazon_ads__portfolio_history[portfolio_name]
    • Direct: directly copied to the output
    • Output Columns:
      • portfolio_name: directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp profile_id 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history profile_id 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:header 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history profile_id 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[profile_id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • profile_id: Directly mapped after casting
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[profile_id]
    • Integration: The column is used indirectly for joining with other tables
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[profile_id]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • profile_id: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp serving_status 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history serving_status 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report serving_status 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history serving_status 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[serving_status]
    • Direct: Copied without transformation
    • Output Columns:
      • serving_status: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[serving_status]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • serving_status: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[serving_status]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • serving_status: Directly copied
Column Lineage
%3 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp state 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history state 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp:f0->21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report state 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 8. model.amazon_ads.int_amazon_ads__portfolio_history 8. model.amazon_ads.int_amazon_ads__portfolio_history state 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history:f0->8. model.amazon_ads.int_amazon_ads__portfolio_history:f0
21. model.amazon_ads_source.stg_amazon_ads__portfolio_history
  • Input Column: 22. model.amazon_ads_source.stg_amazon_ads__portfolio_history_tmp[state]
    • Direct: Copied without transformation
    • Output Columns:
      • state: Directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[state]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • state: Directly copied
8. model.amazon_ads.int_amazon_ads__portfolio_history
  • Input Column: 21. model.amazon_ads_source.stg_amazon_ads__portfolio_history[state]
    • Direct: This column is directly copied without any transformation
    • Output Columns:
      • state: Directly copied
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history

This SQL query processes data from a staging table for Amazon Ads product ad history. It casts various fields to specific data types, renames some columns, adds a source_relation column, and creates a flag for the most recent record for each ad ID. The query also structures the data into a final format with selected columns.

CleaningDeduplicationOther
SQL Query
with base as (

    select * 
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__product_ad_history_tmp
),

fields as (

    select
        
    cast(null as integer) as 
    
    ad_group_id
    
 , 
    cast(null as TEXT) as 
    
    asin
    
 , 
    cast(null as integer) as 
    
    campaign_id
    
 , 
    cast(null as timestamp) as 
    
    creation_date
    
 , 
    cast(null as TEXT) as 
    
    id
    
 , 
    cast(null as timestamp) as 
    
    last_updated_date
    
 , 
    cast(null as TEXT) as 
    
    serving_status
    
 , 
    cast(null as TEXT) as 
    
    sku
    
 , 
    cast(null as TEXT) as 
    
    state
    
 


    
        


, cast('' as TEXT) as source_relation




    from base
),

final as (

    select
        source_relation, 
        cast(id as TEXT) as ad_id,
        cast(ad_group_id as TEXT) as ad_group_id,
        asin,
        cast(campaign_id as TEXT) as campaign_id,
        creation_date,
        last_updated_date,
        serving_status,
        sku,
        state,
        row_number() over (partition by source_relation, id order by last_updated_date desc) = 1 as is_most_recent_record
    from fields
)

select *
from final
%3 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history ad_id ad_group_id asin campaign_id creation_date last_updated_date serving_status sku state is_most_recent_record 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp id last_updated_date ad_group_id asin campaign_id creation_date serving_status sku state 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f1->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f5 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f2->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f1 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f3->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f2 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f4->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f5->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f4 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f6->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f6 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f7->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f7 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f8->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f8
Name Type Comment
ad_id text None
ad_group_id text None
asin text None
campaign_id text None
creation_date text None
last_updated_date text None
serving_status text None
sku integer None
state text None
is_most_recent_record boolean None
Column Lineage
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp id 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history ad_id 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report ad_id 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Deduplication: Used in row_number() function for identifying the most recent record
    • Output Columns:
      • ad_id: Directly mapped after casting to TEXT
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history[ad_id]
    • Direct: The column is directly copied without any transformation
    • Integration: The column is used as a key to join with the report table
    • Output Columns:
      • ad_id: Directly mapped
Column Lineage
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp ad_group_id 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history ad_group_id 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[ad_group_id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • ad_group_id: Directly mapped after casting to TEXT
Column Lineage
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp asin 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history asin 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[asin]
    • Direct: Copied without transformation
    • Output Columns:
      • asin: Directly mapped
Column Lineage
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp campaign_id 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history campaign_id 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[campaign_id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • campaign_id: Directly mapped after casting to TEXT
Column Lineage
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp creation_date 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history creation_date 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[creation_date]
    • Cleaning: Cast to timestamp data type
    • Output Columns:
      • creation_date: Directly mapped after casting to timestamp
Column Lineage
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp last_updated_date 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history last_updated_date 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[last_updated_date]
    • Cleaning: Cast to timestamp data type
    • Deduplication: Used in row_number() function for ordering and identifying the most recent record
    • Output Columns:
      • last_updated_date: Directly mapped after casting to timestamp
Column Lineage
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp serving_status 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history serving_status 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report serving_status 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[serving_status]
    • Direct: Copied without transformation
    • Output Columns:
      • serving_status: Directly mapped
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history[serving_status]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • serving_status: Directly mapped
Column Lineage
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp sku 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history sku 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[sku]
    • Direct: Copied without transformation
    • Output Columns:
      • sku: Directly mapped
Column Lineage
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp state 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history state 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report state 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[state]
    • Direct: Copied without transformation
    • Output Columns:
      • state: Directly mapped
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history[state]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • state: Directly mapped
Column Lineage
%3 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history is_most_recent_record 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0->3. model.amazon_ads.amazon_ads__ad_report:header
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history[is_most_recent_record]
    • Filtering: The column is filtered to include only the most recent records (where is_most_recent_record = True)
24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of TEXT data type. It doesn't perform any actual data manipulation or retrieval from the 'model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp' model. The query is likely used as a placeholder or template for future development.

Other
SQL Query
    
    
        
        
        
         
            
        
    select 
        cast(null as TEXT) as _dbt_source_relation
    limit 0
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp id last_updated_date _fivetran_synced ad_group_id asin campaign_id creation_date serving_status sku state 38. source.amazon_ads_source.amazon_ads.product_ad_history 38. source.amazon_ads_source.amazon_ads.product_ad_history
Name Type Comment
id integer None
last_updated_date text None
_fivetran_synced timestamp without time zone None
ad_group_id integer None
asin text None
campaign_id integer None
creation_date text None
serving_status text None
sku integer None
state text None
Column Lineage
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp id 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history ad_id 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report ad_id 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[id]
    • Cleaning: Cast to TEXT data type
    • Deduplication: Used in row_number() function for identifying the most recent record
    • Output Columns:
      • ad_id: Directly mapped after casting to TEXT
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history[ad_id]
    • Direct: The column is directly copied without any transformation
    • Integration: The column is used as a key to join with the report table
    • Output Columns:
      • ad_id: Directly mapped
Column Lineage
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp last_updated_date 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history last_updated_date 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[last_updated_date]
    • Cleaning: Cast to timestamp data type
    • Deduplication: Used in row_number() function for ordering and identifying the most recent record
    • Output Columns:
      • last_updated_date: Directly mapped after casting to timestamp
Column Lineage
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp ad_group_id 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history ad_group_id 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[ad_group_id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • ad_group_id: Directly mapped after casting to TEXT
Column Lineage
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp asin 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history asin 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[asin]
    • Direct: Copied without transformation
    • Output Columns:
      • asin: Directly mapped
Column Lineage
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp campaign_id 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history campaign_id 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[campaign_id]
    • Cleaning: Cast to TEXT data type
    • Output Columns:
      • campaign_id: Directly mapped after casting to TEXT
Column Lineage
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp creation_date 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history creation_date 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[creation_date]
    • Cleaning: Cast to timestamp data type
    • Output Columns:
      • creation_date: Directly mapped after casting to timestamp
Column Lineage
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp serving_status 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history serving_status 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report serving_status 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[serving_status]
    • Direct: Copied without transformation
    • Output Columns:
      • serving_status: Directly mapped
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history[serving_status]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • serving_status: Directly mapped
Column Lineage
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp sku 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history sku 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[sku]
    • Direct: Copied without transformation
    • Output Columns:
      • sku: Directly mapped
Column Lineage
%3 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp state 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history state 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp:f0->23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report state 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
23. model.amazon_ads_source.stg_amazon_ads__product_ad_history
  • Input Column: 24. model.amazon_ads_source.stg_amazon_ads__product_ad_history_tmp[state]
    • Direct: Copied without transformation
    • Output Columns:
      • state: Directly mapped
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 23. model.amazon_ads_source.stg_amazon_ads__product_ad_history[state]
    • Direct: The column is directly copied without any transformation
    • Output Columns:
      • state: Directly mapped
25. model.amazon_ads_source.stg_amazon_ads__profile

This SQL query stages data from a temporary table, casts all fields to specific data types (mostly to null or empty values), and then formats the final output by renaming some columns and casting certain fields. It appears to be preparing a standardized structure for Amazon Ads profile data.

CleaningOther
SQL Query
with base as (

    select * 
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__profile_tmp
),

fields as (

    select
        
    cast(null as integer) as 
    
    id
    
 , 
    cast(null as TEXT) as 
    
    account_id
    
 , 
    cast(null as TEXT) as 
    
    account_marketplace_string_id
    
 , 
    cast(null as TEXT) as 
    
    account_name
    
 , 
    cast(null as TEXT) as 
    
    account_sub_type
    
 , 
    cast(null as TEXT) as 
    
    account_type
    
 , 
    cast(null as boolean) as 
    
    account_valid_payment_method
    
 , 
    cast(null as TEXT) as 
    
    country_code
    
 , 
    cast(null as TEXT) as 
    
    currency_code
    
 , 
    cast(null as integer) as 
    
    daily_budget
    
 , 
    cast(null as TEXT) as 
    
    timezone
    
 , 
    cast(null as boolean) as 
    
    _fivetran_deleted
    
 


    
        


, cast('' as TEXT) as source_relation




    from base
),

final as (

    select
        source_relation, 
        cast(id as TEXT) as profile_id,
        cast(account_id as TEXT) as account_id,
        account_marketplace_string_id,
        account_name,
        account_sub_type,
        account_type,
        account_valid_payment_method,
        country_code,
        currency_code,
        daily_budget,
        timezone,
        _fivetran_deleted
    from fields
)

select *
from final
%3 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile profile_id account_id account_marketplace_string_id account_name account_sub_type account_type account_valid_payment_method country_code currency_code daily_budget timezone _fivetran_deleted 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp id _fivetran_deleted account_id account_marketplace_string_id account_name account_sub_type account_type account_valid_payment_method country_code currency_code daily_budget timezone 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f1->25. model.amazon_ads_source.stg_amazon_ads__profile:f11 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f2->25. model.amazon_ads_source.stg_amazon_ads__profile:f1 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f3->25. model.amazon_ads_source.stg_amazon_ads__profile:f2 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f4->25. model.amazon_ads_source.stg_amazon_ads__profile:f3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f5->25. model.amazon_ads_source.stg_amazon_ads__profile:f4 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f6->25. model.amazon_ads_source.stg_amazon_ads__profile:f5 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f7->25. model.amazon_ads_source.stg_amazon_ads__profile:f6 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f8->25. model.amazon_ads_source.stg_amazon_ads__profile:f7 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f9->25. model.amazon_ads_source.stg_amazon_ads__profile:f8 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f10->25. model.amazon_ads_source.stg_amazon_ads__profile:f9 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f11->25. model.amazon_ads_source.stg_amazon_ads__profile:f10
Name Type Comment
profile_id text None
account_id text None
account_marketplace_string_id text None
account_name text None
account_sub_type integer None
account_type text None
account_valid_payment_method boolean None
country_code text None
currency_code text None
daily_budget integer None
timezone text None
_fivetran_deleted boolean None
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp id 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile profile_id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->1. model.amazon_ads.amazon_ads__account_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[id]
    • Cleaning: The column is cast to TEXT and renamed to profile_id
    • Output Columns:
      • profile_id: Directly mapped after casting to TEXT
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: Used as a key to join with other tables
    • Direct: Directly copied to the output
    • Output Columns:
      • profile_id: Directly copied
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: Used as a key to join with the campaigns table
    • Direct: Directly copied to the output
    • Output Columns:
      • profile_id: Directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: used as a key to join with the campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • profile_id: directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: Used as a key to join with the campaigns table
    • Direct: Directly copied to the output
    • Output Columns:
      • profile_id: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: used as a key to join with the campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • profile_id: directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: used as a key to join with the campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • profile_id: directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: used as a key to join with the campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • profile_id: directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_id 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->1. model.amazon_ads.amazon_ads__account_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_id]
    • Cleaning: The column is cast to TEXT
    • Output Columns:
      • account_id: Directly mapped after casting to TEXT
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: Directly copied to the output
    • Output Columns:
      • account_id: Directly copied
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: Directly copied to the output
    • Output Columns:
      • account_id: Directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: directly copied to the output
    • Output Columns:
      • account_id: directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: Directly copied to the output
    • Output Columns:
      • account_id: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: directly copied to the output
    • Output Columns:
      • account_id: directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: directly copied to the output
    • Output Columns:
      • account_id: directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: directly copied to the output
    • Output Columns:
      • account_id: directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_marketplace_string_id 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_marketplace_string_id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_marketplace_string_id]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • account_marketplace_string_id: Directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_name 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_name 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->1. model.amazon_ads.amazon_ads__account_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_name]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • account_name: Directly copied
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • account_name: Directly copied
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • account_name: Directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: directly copied to the output
    • Output Columns:
      • account_name: directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • account_name: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: directly copied to the output
    • Output Columns:
      • account_name: directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: directly copied to the output
    • Output Columns:
      • account_name: directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: directly copied to the output
    • Output Columns:
      • account_name: directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_sub_type 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_sub_type 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_sub_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • account_sub_type: Directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_type 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_type 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • account_type: Directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_valid_payment_method 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_valid_payment_method 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_valid_payment_method]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • account_valid_payment_method: Directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp country_code 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile country_code 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->1. model.amazon_ads.amazon_ads__account_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[country_code]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • country_code: Directly copied
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: Directly copied to the output
    • Output Columns:
      • country_code: Directly copied
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: Directly copied to the output
    • Output Columns:
      • country_code: Directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: directly copied to the output
    • Output Columns:
      • country_code: directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: Directly copied to the output
    • Output Columns:
      • country_code: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: directly copied to the output
    • Output Columns:
      • country_code: directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: directly copied to the output
    • Output Columns:
      • country_code: directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: directly copied to the output
    • Output Columns:
      • country_code: directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp currency_code 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile currency_code 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[currency_code]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • currency_code: Directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp daily_budget 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile daily_budget 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[daily_budget]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • daily_budget: Directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp timezone 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile timezone 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[timezone]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • timezone: Directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp _fivetran_deleted 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile _fivetran_deleted 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->5. model.amazon_ads.amazon_ads__keyword_report:header 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->6. model.amazon_ads.amazon_ads__portfolio_report:header 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->1. model.amazon_ads.amazon_ads__account_report:header 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->7. model.amazon_ads.amazon_ads__search_report:header 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->2. model.amazon_ads.amazon_ads__ad_group_report:header 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->4. model.amazon_ads.amazon_ads__campaign_report:header 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->3. model.amazon_ads.amazon_ads__ad_report:header
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[_fivetran_deleted]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • _fivetran_deleted: Directly copied
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[_fivetran_deleted]
    • Filtering: The column is filtered to include only non-deleted records (where _fivetran_deleted = False)
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[_fivetran_deleted]
    • Filtering: Used to filter out deleted records (WHERE _fivetran_deleted = False)
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[_fivetran_deleted]
    • Filtering: used to filter out deleted records (where _fivetran_deleted = False)
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[_fivetran_deleted]
    • Filtering: Used to filter out deleted records (where _fivetran_deleted = False)
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[_fivetran_deleted]
    • Filtering: the column is filtered to include only non-deleted records (where _fivetran_deleted = False)
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[_fivetran_deleted]
    • Filtering: used to filter out deleted records (where _fivetran_deleted = False)
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[_fivetran_deleted]
    • Filtering: the column is filtered to include only non-deleted records (where _fivetran_deleted = False)
26. model.amazon_ads_source.stg_amazon_ads__profile_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of TEXT data type. It's likely used as a placeholder or template for further development or testing purposes.

Other
SQL Query
    
    
        
        
        
         
            
        
    select 
        cast(null as TEXT) as _dbt_source_relation
    limit 0
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp id _fivetran_deleted _fivetran_synced account_id account_marketplace_string_id account_name account_sub_type account_type account_valid_payment_method country_code currency_code daily_budget timezone 39. source.amazon_ads_source.amazon_ads.profile 39. source.amazon_ads_source.amazon_ads.profile
Name Type Comment
id integer None
_fivetran_deleted boolean None
_fivetran_synced timestamp without time zone None
account_id text None
account_marketplace_string_id text None
account_name text None
account_sub_type integer None
account_type text None
account_valid_payment_method boolean None
country_code text None
currency_code text None
daily_budget integer None
timezone text None
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp id 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile profile_id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->1. model.amazon_ads.amazon_ads__account_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report profile_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[id]
    • Cleaning: The column is cast to TEXT and renamed to profile_id
    • Output Columns:
      • profile_id: Directly mapped after casting to TEXT
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: Used as a key to join with other tables
    • Direct: Directly copied to the output
    • Output Columns:
      • profile_id: Directly copied
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: Used as a key to join with the campaigns table
    • Direct: Directly copied to the output
    • Output Columns:
      • profile_id: Directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: used as a key to join with the campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • profile_id: directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: Used as a key to join with the campaigns table
    • Direct: Directly copied to the output
    • Output Columns:
      • profile_id: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: used as a key to join with the campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • profile_id: directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: used as a key to join with the campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • profile_id: directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[profile_id]
    • Integration: used as a key to join with the campaigns table
    • Direct: directly copied to the output
    • Output Columns:
      • profile_id: directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp _fivetran_deleted 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile _fivetran_deleted 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->5. model.amazon_ads.amazon_ads__keyword_report:header 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->6. model.amazon_ads.amazon_ads__portfolio_report:header 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->1. model.amazon_ads.amazon_ads__account_report:header 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->7. model.amazon_ads.amazon_ads__search_report:header 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->2. model.amazon_ads.amazon_ads__ad_group_report:header 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->4. model.amazon_ads.amazon_ads__campaign_report:header 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->3. model.amazon_ads.amazon_ads__ad_report:header
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[_fivetran_deleted]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • _fivetran_deleted: Directly copied
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[_fivetran_deleted]
    • Filtering: The column is filtered to include only non-deleted records (where _fivetran_deleted = False)
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[_fivetran_deleted]
    • Filtering: Used to filter out deleted records (WHERE _fivetran_deleted = False)
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[_fivetran_deleted]
    • Filtering: used to filter out deleted records (where _fivetran_deleted = False)
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[_fivetran_deleted]
    • Filtering: Used to filter out deleted records (where _fivetran_deleted = False)
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[_fivetran_deleted]
    • Filtering: the column is filtered to include only non-deleted records (where _fivetran_deleted = False)
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[_fivetran_deleted]
    • Filtering: used to filter out deleted records (where _fivetran_deleted = False)
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[_fivetran_deleted]
    • Filtering: the column is filtered to include only non-deleted records (where _fivetran_deleted = False)
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_id 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->1. model.amazon_ads.amazon_ads__account_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report account_id 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_id]
    • Cleaning: The column is cast to TEXT
    • Output Columns:
      • account_id: Directly mapped after casting to TEXT
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: Directly copied to the output
    • Output Columns:
      • account_id: Directly copied
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: Directly copied to the output
    • Output Columns:
      • account_id: Directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: directly copied to the output
    • Output Columns:
      • account_id: directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: Directly copied to the output
    • Output Columns:
      • account_id: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: directly copied to the output
    • Output Columns:
      • account_id: directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: directly copied to the output
    • Output Columns:
      • account_id: directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_id]
    • Direct: directly copied to the output
    • Output Columns:
      • account_id: directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_marketplace_string_id 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_marketplace_string_id 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_marketplace_string_id]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • account_marketplace_string_id: Directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_name 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_name 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->1. model.amazon_ads.amazon_ads__account_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report account_name 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_name]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • account_name: Directly copied
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • account_name: Directly copied
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • account_name: Directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: directly copied to the output
    • Output Columns:
      • account_name: directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: Directly copied to the output
    • Output Columns:
      • account_name: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: directly copied to the output
    • Output Columns:
      • account_name: directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: directly copied to the output
    • Output Columns:
      • account_name: directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[account_name]
    • Direct: directly copied to the output
    • Output Columns:
      • account_name: directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_sub_type 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_sub_type 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_sub_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • account_sub_type: Directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_type 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_type 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • account_type: Directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp account_valid_payment_method 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile account_valid_payment_method 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[account_valid_payment_method]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • account_valid_payment_method: Directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp country_code 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile country_code 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0 6. model.amazon_ads.amazon_ads__portfolio_report 6. model.amazon_ads.amazon_ads__portfolio_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->6. model.amazon_ads.amazon_ads__portfolio_report:f0 1. model.amazon_ads.amazon_ads__account_report 1. model.amazon_ads.amazon_ads__account_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->1. model.amazon_ads.amazon_ads__account_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->7. model.amazon_ads.amazon_ads__search_report:f0 2. model.amazon_ads.amazon_ads__ad_group_report 2. model.amazon_ads.amazon_ads__ad_group_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->2. model.amazon_ads.amazon_ads__ad_group_report:f0 4. model.amazon_ads.amazon_ads__campaign_report 4. model.amazon_ads.amazon_ads__campaign_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->4. model.amazon_ads.amazon_ads__campaign_report:f0 3. model.amazon_ads.amazon_ads__ad_report 3. model.amazon_ads.amazon_ads__ad_report country_code 25. model.amazon_ads_source.stg_amazon_ads__profile:f0->3. model.amazon_ads.amazon_ads__ad_report:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[country_code]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • country_code: Directly copied
1. model.amazon_ads.amazon_ads__account_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: Directly copied to the output
    • Output Columns:
      • country_code: Directly copied
2. model.amazon_ads.amazon_ads__ad_group_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: Directly copied to the output
    • Output Columns:
      • country_code: Directly copied
3. model.amazon_ads.amazon_ads__ad_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: directly copied to the output
    • Output Columns:
      • country_code: directly copied
4. model.amazon_ads.amazon_ads__campaign_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: Directly copied to the output
    • Output Columns:
      • country_code: Directly copied
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: directly copied to the output
    • Output Columns:
      • country_code: directly copied
6. model.amazon_ads.amazon_ads__portfolio_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: directly copied to the output
    • Output Columns:
      • country_code: directly copied
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 25. model.amazon_ads_source.stg_amazon_ads__profile[country_code]
    • Direct: directly copied to the output
    • Output Columns:
      • country_code: directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp currency_code 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile currency_code 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[currency_code]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • currency_code: Directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp daily_budget 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile daily_budget 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[daily_budget]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • daily_budget: Directly copied
Column Lineage
%3 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp timezone 25. model.amazon_ads_source.stg_amazon_ads__profile 25. model.amazon_ads_source.stg_amazon_ads__profile timezone 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp:f0->25. model.amazon_ads_source.stg_amazon_ads__profile:f0
25. model.amazon_ads_source.stg_amazon_ads__profile
  • Input Column: 26. model.amazon_ads_source.stg_amazon_ads__profile_tmp[timezone]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • timezone: Directly copied
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report

This SQL query performs data type casting and column renaming on a staging table for Amazon Ads search term and keyword report data. It creates a CTE structure to organize the transformations, casting various columns to appropriate data types (integer, float, text, date) and renaming some columns. The query also adds a 'source_relation' column and adjusts some column names in the final select statement.

CleaningOther
SQL Query
with base as (

    select * 
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp
),

fields as (

    select
        
    cast(null as integer) as 
    
    ad_group_id
    
 , 
    cast(null as TEXT) as 
    
    ad_keyword_status
    
 , 
    cast(null as float) as 
    
    campaign_budget_amount
    
 , 
    cast(null as TEXT) as 
    
    campaign_budget_currency_code
    
 , 
    cast(null as TEXT) as 
    
    campaign_budget_type
    
 , 
    cast(null as integer) as 
    
    campaign_id
    
 , 
    cast(null as integer) as 
    
    clicks
    
 , 
    cast(null as float) as 
    
    cost
    
 , 
    cast(null as date) as 
    
    date
    
 , 
    cast(null as integer) as 
    
    impressions
    
 , 
    cast(null as float) as 
    
    keyword_bid
    
 , 
    cast(null as integer) as 
    
    keyword_id
    
 , 
    cast(null as TEXT) as 
    
    search_term
    
 , 
    cast(null as TEXT) as 
    
    targeting
    
 


    
        


, cast('' as TEXT) as source_relation




    from base
),

final as (

    select
        source_relation, 
        cast(ad_group_id as TEXT) as ad_group_id,
        ad_keyword_status,
        campaign_budget_amount,
        campaign_budget_currency_code,
        campaign_budget_type,
        cast(campaign_id as TEXT) as campaign_id,
        clicks,
        cost,
        date as date_day,
        impressions,
        keyword_bid,
        cast(keyword_id as TEXT) as keyword_id,
        search_term,
        targeting

        




    from fields
)

select *
from final
%3 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report ad_group_id ad_keyword_status campaign_budget_amount campaign_budget_currency_code campaign_budget_type campaign_id clicks cost date_day impressions keyword_bid keyword_id search_term targeting 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp ad_group_id campaign_id date keyword_id campaign_budget_amount campaign_budget_currency_code campaign_budget_type clicks cost impressions keyword_bid search_term targeting 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f1->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f5 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f2->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f8 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f3->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f11 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f4->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f2 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f5->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f6->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f4 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f7->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f6 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f8->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f7 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f9->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f9 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f10->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f10 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f11->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f12 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f12->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f13
Name Type Comment
ad_group_id text None
ad_keyword_status text None
campaign_budget_amount double precision None
campaign_budget_currency_code text None
campaign_budget_type text None
campaign_id text None
clicks integer None
cost double precision None
date_day date None
impressions integer None
keyword_bid double precision None
keyword_id text None
search_term text None
targeting text None
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp ad_group_id 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report ad_group_id 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report ad_group_id 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[ad_group_id]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • ad_group_id: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[ad_group_id]
    • Direct: directly copied to the output
    • Integration: used to join with ad_groups table
    • Output Columns:
      • ad_group_id: directly copied
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp campaign_budget_amount 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report campaign_budget_amount 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[campaign_budget_amount]
    • Cleaning: The column is cast to FLOAT data type
    • Output Columns:
      • campaign_budget_amount: Directly mapped after casting
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp campaign_budget_currency_code 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report campaign_budget_currency_code 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[campaign_budget_currency_code]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • campaign_budget_currency_code: Directly mapped after casting
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp campaign_budget_type 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report campaign_budget_type 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[campaign_budget_type]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • campaign_budget_type: Directly mapped after casting
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp campaign_id 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report campaign_id 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report campaign_id 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[campaign_id]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • campaign_id: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[campaign_id]
    • Direct: directly copied to the output
    • Integration: used to join with campaigns table
    • Output Columns:
      • campaign_id: directly copied
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp clicks 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report clicks 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report clicks 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[clicks]
    • Cleaning: The column is cast to INTEGER data type
    • Output Columns:
      • clicks: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[clicks]
    • Aggregation: summed up in the final select statement
    • Output Columns:
      • clicks: aggregated sum
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp cost 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report cost 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report cost 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[cost]
    • Cleaning: The column is cast to FLOAT data type
    • Output Columns:
      • cost: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[cost]
    • Aggregation: summed up in the final select statement
    • Output Columns:
      • cost: aggregated sum
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp date 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report date_day 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report date_day 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[date]
    • Cleaning: The column is cast to DATE data type
    • Output Columns:
      • date_day: Directly mapped after casting and renamed
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[date_day]
    • Direct: directly copied to the output
    • Output Columns:
      • date_day: directly copied
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp impressions 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report impressions 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report impressions 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[impressions]
    • Cleaning: The column is cast to INTEGER data type
    • Output Columns:
      • impressions: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[impressions]
    • Aggregation: summed up in the final select statement
    • Output Columns:
      • impressions: aggregated sum
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp keyword_bid 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report keyword_bid 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[keyword_bid]
    • Cleaning: The column is cast to FLOAT data type
    • Output Columns:
      • keyword_bid: Directly mapped after casting
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp keyword_id 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report keyword_id 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report keyword_id 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[keyword_id]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • keyword_id: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[keyword_id]
    • Direct: directly copied to the output
    • Integration: used to join with keywords table
    • Output Columns:
      • keyword_id: directly copied
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp search_term 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report search_term 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report search_term 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[search_term]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • search_term: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[search_term]
    • Direct: directly copied to the output
    • Output Columns:
      • search_term: directly copied
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp targeting 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report targeting 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report targeting 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[targeting]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • targeting: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[targeting]
    • Direct: directly copied to the output
    • Output Columns:
      • targeting: directly copied
28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp

This SQL query creates an empty result set with a single column named '_dbt_source_relation' of type TEXT. The query doesn't actually select any data from a table; instead, it creates a dummy result with zero rows. This type of query is often used as a placeholder or template in data modeling tools like dbt.

Other
SQL Query
    
    
        
        
        
         
            
        
    select 
        cast(null as TEXT) as _dbt_source_relation
    limit 0
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp ad_group_id campaign_id date keyword_id _fivetran_synced campaign_budget_amount campaign_budget_currency_code campaign_budget_type clicks cost impressions keyword_bid search_term targeting 40. source.amazon_ads_source.amazon_ads.search_term_ad_keyword_report 40. source.amazon_ads_source.amazon_ads.search_term_ad_keyword_report
Name Type Comment
ad_group_id integer None
campaign_id integer None
date date None
keyword_id integer None
_fivetran_synced timestamp without time zone None
campaign_budget_amount double precision None
campaign_budget_currency_code text None
campaign_budget_type text None
clicks integer None
cost double precision None
impressions integer None
keyword_bid double precision None
search_term text None
targeting text None
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp ad_group_id 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report ad_group_id 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report ad_group_id 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[ad_group_id]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • ad_group_id: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[ad_group_id]
    • Direct: directly copied to the output
    • Integration: used to join with ad_groups table
    • Output Columns:
      • ad_group_id: directly copied
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp campaign_id 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report campaign_id 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report campaign_id 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[campaign_id]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • campaign_id: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[campaign_id]
    • Direct: directly copied to the output
    • Integration: used to join with campaigns table
    • Output Columns:
      • campaign_id: directly copied
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp date 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report date_day 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report date_day 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[date]
    • Cleaning: The column is cast to DATE data type
    • Output Columns:
      • date_day: Directly mapped after casting and renamed
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[date_day]
    • Direct: directly copied to the output
    • Output Columns:
      • date_day: directly copied
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp keyword_id 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report keyword_id 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report keyword_id 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[keyword_id]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • keyword_id: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[keyword_id]
    • Direct: directly copied to the output
    • Integration: used to join with keywords table
    • Output Columns:
      • keyword_id: directly copied
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp campaign_budget_amount 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report campaign_budget_amount 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[campaign_budget_amount]
    • Cleaning: The column is cast to FLOAT data type
    • Output Columns:
      • campaign_budget_amount: Directly mapped after casting
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp campaign_budget_currency_code 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report campaign_budget_currency_code 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[campaign_budget_currency_code]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • campaign_budget_currency_code: Directly mapped after casting
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp campaign_budget_type 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report campaign_budget_type 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[campaign_budget_type]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • campaign_budget_type: Directly mapped after casting
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp clicks 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report clicks 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report clicks 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[clicks]
    • Cleaning: The column is cast to INTEGER data type
    • Output Columns:
      • clicks: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[clicks]
    • Aggregation: summed up in the final select statement
    • Output Columns:
      • clicks: aggregated sum
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp cost 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report cost 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report cost 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[cost]
    • Cleaning: The column is cast to FLOAT data type
    • Output Columns:
      • cost: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[cost]
    • Aggregation: summed up in the final select statement
    • Output Columns:
      • cost: aggregated sum
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp impressions 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report impressions 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report impressions 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[impressions]
    • Cleaning: The column is cast to INTEGER data type
    • Output Columns:
      • impressions: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[impressions]
    • Aggregation: summed up in the final select statement
    • Output Columns:
      • impressions: aggregated sum
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp keyword_bid 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report keyword_bid 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[keyword_bid]
    • Cleaning: The column is cast to FLOAT data type
    • Output Columns:
      • keyword_bid: Directly mapped after casting
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp search_term 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report search_term 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report search_term 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[search_term]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • search_term: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[search_term]
    • Direct: directly copied to the output
    • Output Columns:
      • search_term: directly copied
Column Lineage
%3 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp targeting 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report targeting 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp:f0->27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0 7. model.amazon_ads.amazon_ads__search_report 7. model.amazon_ads.amazon_ads__search_report targeting 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report:f0->7. model.amazon_ads.amazon_ads__search_report:f0
27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report
  • Input Column: 28. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report_tmp[targeting]
    • Cleaning: The column is cast to TEXT data type
    • Output Columns:
      • targeting: Directly mapped after casting
7. model.amazon_ads.amazon_ads__search_report
  • Input Column: 27. model.amazon_ads_source.stg_amazon_ads__search_term_ad_keyword_report[targeting]
    • Direct: directly copied to the output
    • Output Columns:
      • targeting: directly copied
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report

This SQL query performs data type casting and column renaming on a staging table for Amazon Ads targeting keyword reports. It creates a CTE structure to first select all columns from the source table, then defines data types for each column using CAST statements, and finally selects and renames some columns in the final output. The query also adds a 'source_relation' column to track the data source.

CleaningOther
SQL Query
with base as (

    select * 
    from TEST.PUBLIC_amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp
),

fields as (

    select
        
    cast(null as integer) as 
    
    ad_group_id
    
 , 
    cast(null as TEXT) as 
    
    ad_keyword_status
    
 , 
    cast(null as float) as 
    
    campaign_budget_amount
    
 , 
    cast(null as TEXT) as 
    
    campaign_budget_currency_code
    
 , 
    cast(null as TEXT) as 
    
    campaign_budget_type
    
 , 
    cast(null as integer) as 
    
    campaign_id
    
 , 
    cast(null as integer) as 
    
    clicks
    
 , 
    cast(null as float) as 
    
    cost
    
 , 
    cast(null as date) as 
    
    date
    
 , 
    cast(null as integer) as 
    
    impressions
    
 , 
    cast(null as float) as 
    
    keyword_bid
    
 , 
    cast(null as integer) as 
    
    keyword_id
    
 , 
    cast(null as TEXT) as 
    
    keyword_type
    
 , 
    cast(null as TEXT) as 
    
    match_type
    
 , 
    cast(null as TEXT) as 
    
    targeting
    
 


    
        


, cast('' as TEXT) as source_relation




    from base
),

final as (

    select
        source_relation, 
        cast(ad_group_id as TEXT) as ad_group_id,
        ad_keyword_status,
        campaign_budget_amount,
        campaign_budget_currency_code,
        campaign_budget_type,
        cast(campaign_id as TEXT) as campaign_id,
        clicks,
        cost,
        date as date_day,
        impressions,
        keyword_bid,
        cast(keyword_id as TEXT) as keyword_id,
        keyword_type,
        match_type,
        targeting

        




    from fields
)

select *
from final
%3 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report ad_group_id ad_keyword_status campaign_budget_amount campaign_budget_currency_code campaign_budget_type campaign_id clicks cost date_day impressions keyword_bid keyword_id keyword_type match_type targeting 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp ad_group_id campaign_id date keyword_id ad_keyword_status campaign_budget_amount campaign_budget_currency_code campaign_budget_type clicks cost impressions keyword_bid keyword_type match_type targeting 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f1->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f5 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f2->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f8 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f3->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f11 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f4->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f1 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f5->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f2 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f6->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f7->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f4 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f8->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f6 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f9->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f7 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f10->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f9 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f11->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f10 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f12->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f12 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f13->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f13 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f14->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f14
Name Type Comment
ad_group_id text None
ad_keyword_status text None
campaign_budget_amount double precision None
campaign_budget_currency_code text None
campaign_budget_type text None
campaign_id text None
clicks integer None
cost double precision None
date_day date None
impressions integer None
keyword_bid double precision None
keyword_id text None
keyword_type text None
match_type text None
targeting text None
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp ad_group_id 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report ad_group_id 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report ad_group_id 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[ad_group_id]
    • Cleaning: The column is cast to TEXT in the final output
    • Output Columns:
      • ad_group_id: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[ad_group_id]
    • Direct: The column is directly copied without transformation
    • Integration: Used as a key to join with the ad_groups table
    • Output Columns:
      • ad_group_id: Directly copied
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp ad_keyword_status 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report ad_keyword_status 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[ad_keyword_status]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • ad_keyword_status: Directly mapped
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp campaign_budget_amount 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report campaign_budget_amount 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[campaign_budget_amount]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_budget_amount: Directly mapped
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp campaign_budget_currency_code 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report campaign_budget_currency_code 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[campaign_budget_currency_code]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_budget_currency_code: Directly mapped
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp campaign_budget_type 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report campaign_budget_type 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[campaign_budget_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_budget_type: Directly mapped
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp campaign_id 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report campaign_id 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report campaign_id 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[campaign_id]
    • Cleaning: The column is cast to TEXT in the final output
    • Output Columns:
      • campaign_id: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[campaign_id]
    • Direct: The column is directly copied without transformation
    • Integration: Used as a key to join with the campaigns table
    • Output Columns:
      • campaign_id: Directly copied
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp clicks 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report clicks 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report clicks 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[clicks]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • clicks: Directly mapped
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[clicks]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • clicks: Aggregated sum
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp cost 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report cost 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report cost 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[cost]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • cost: Directly mapped
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[cost]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • cost: Aggregated sum
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp date 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report date_day 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report date_day 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[date]
    • Cleaning: The column is renamed in the final output
    • Output Columns:
      • date_day: Directly mapped and renamed
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[date_day]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • date_day: Directly copied
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp impressions 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report impressions 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report impressions 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[impressions]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • impressions: Directly mapped
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[impressions]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • impressions: Aggregated sum
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp keyword_bid 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report keyword_bid 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report keyword_bid 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[keyword_bid]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • keyword_bid: Directly mapped
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[keyword_bid]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • keyword_bid: Directly copied
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp keyword_id 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report keyword_id 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report keyword_id 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[keyword_id]
    • Cleaning: The column is cast to TEXT in the final output
    • Output Columns:
      • keyword_id: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[keyword_id]
    • Direct: The column is directly copied without transformation
    • Integration: Used as a key to join with the keywords table
    • Output Columns:
      • keyword_id: Directly copied
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp keyword_type 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report keyword_type 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report keyword_type 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[keyword_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • keyword_type: Directly mapped
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[keyword_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • keyword_type: Directly copied
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp match_type 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report match_type 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report match_type 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[match_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • match_type: Directly mapped
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[match_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • match_type: Directly copied
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp targeting 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report targeting 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[targeting]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • targeting: Directly mapped
30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_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 development, as it doesn't retrieve any actual data.

Other
SQL Query
    
    
        
        
        
         
            
        
    select 
        cast(null as TEXT) as _dbt_source_relation
    limit 0
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp ad_group_id campaign_id date keyword_id _fivetran_synced ad_keyword_status campaign_budget_amount campaign_budget_currency_code campaign_budget_type clicks cost impressions keyword_bid keyword_type match_type targeting 41. source.amazon_ads_source.amazon_ads.targeting_keyword_report 41. source.amazon_ads_source.amazon_ads.targeting_keyword_report
Name Type Comment
ad_group_id integer None
campaign_id integer None
date date None
keyword_id integer None
_fivetran_synced timestamp without time zone None
ad_keyword_status text None
campaign_budget_amount double precision None
campaign_budget_currency_code text None
campaign_budget_type text None
clicks integer None
cost double precision None
impressions integer None
keyword_bid double precision None
keyword_type text None
match_type text None
targeting text None
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp ad_group_id 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report ad_group_id 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report ad_group_id 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[ad_group_id]
    • Cleaning: The column is cast to TEXT in the final output
    • Output Columns:
      • ad_group_id: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[ad_group_id]
    • Direct: The column is directly copied without transformation
    • Integration: Used as a key to join with the ad_groups table
    • Output Columns:
      • ad_group_id: Directly copied
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp campaign_id 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report campaign_id 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report campaign_id 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[campaign_id]
    • Cleaning: The column is cast to TEXT in the final output
    • Output Columns:
      • campaign_id: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[campaign_id]
    • Direct: The column is directly copied without transformation
    • Integration: Used as a key to join with the campaigns table
    • Output Columns:
      • campaign_id: Directly copied
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp date 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report date_day 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report date_day 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[date]
    • Cleaning: The column is renamed in the final output
    • Output Columns:
      • date_day: Directly mapped and renamed
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[date_day]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • date_day: Directly copied
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp keyword_id 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report keyword_id 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report keyword_id 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[keyword_id]
    • Cleaning: The column is cast to TEXT in the final output
    • Output Columns:
      • keyword_id: Directly mapped after casting to TEXT
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[keyword_id]
    • Direct: The column is directly copied without transformation
    • Integration: Used as a key to join with the keywords table
    • Output Columns:
      • keyword_id: Directly copied
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp ad_keyword_status 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report ad_keyword_status 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[ad_keyword_status]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • ad_keyword_status: Directly mapped
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp campaign_budget_amount 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report campaign_budget_amount 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[campaign_budget_amount]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_budget_amount: Directly mapped
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp campaign_budget_currency_code 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report campaign_budget_currency_code 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[campaign_budget_currency_code]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_budget_currency_code: Directly mapped
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp campaign_budget_type 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report campaign_budget_type 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[campaign_budget_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • campaign_budget_type: Directly mapped
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp clicks 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report clicks 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report clicks 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[clicks]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • clicks: Directly mapped
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[clicks]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • clicks: Aggregated sum
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp cost 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report cost 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report cost 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[cost]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • cost: Directly mapped
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[cost]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • cost: Aggregated sum
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp impressions 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report impressions 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report impressions 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[impressions]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • impressions: Directly mapped
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[impressions]
    • Aggregation: The column is summed up in the group by clause
    • Output Columns:
      • impressions: Aggregated sum
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp keyword_bid 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report keyword_bid 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report keyword_bid 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[keyword_bid]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • keyword_bid: Directly mapped
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[keyword_bid]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • keyword_bid: Directly copied
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp keyword_type 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report keyword_type 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report keyword_type 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[keyword_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • keyword_type: Directly mapped
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[keyword_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • keyword_type: Directly copied
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp match_type 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report match_type 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0 5. model.amazon_ads.amazon_ads__keyword_report 5. model.amazon_ads.amazon_ads__keyword_report match_type 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0->5. model.amazon_ads.amazon_ads__keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[match_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • match_type: Directly mapped
5. model.amazon_ads.amazon_ads__keyword_report
  • Input Column: 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report[match_type]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • match_type: Directly copied
Column Lineage
%3 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp targeting 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report 29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report targeting 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp:f0->29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report:f0
29. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report
  • Input Column: 30. model.amazon_ads_source.stg_amazon_ads__targeting_keyword_report_tmp[targeting]
    • Direct: The column is directly copied without transformation
    • Output Columns:
      • targeting: Directly mapped
31. source.amazon_ads_source.amazon_ads.ad_group_history
The model details are not provided
32. source.amazon_ads_source.amazon_ads.ad_group_level_report
The model details are not provided
33. source.amazon_ads_source.amazon_ads.advertised_product_report
The model details are not provided
34. source.amazon_ads_source.amazon_ads.campaign_history
The model details are not provided
35. source.amazon_ads_source.amazon_ads.campaign_level_report
The model details are not provided
36. source.amazon_ads_source.amazon_ads.keyword_history
The model details are not provided
37. source.amazon_ads_source.amazon_ads.portfolio_history
The model details are not provided
38. source.amazon_ads_source.amazon_ads.product_ad_history
The model details are not provided
39. source.amazon_ads_source.amazon_ads.profile
The model details are not provided
40. source.amazon_ads_source.amazon_ads.search_term_ad_keyword_report
The model details are not provided
41. source.amazon_ads_source.amazon_ads.targeting_keyword_report
The model details are not provided