Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(data-warehouse): add 14 missing Google Ads tables (#77282)

Tom Owers6fd54ae3bf21
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS.md
index 0a13146e7167..0b9d6018b04c 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS.md
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS.md
@@ -152,21 +152,29 @@ Lower priority: `issuing/*`, `treasury/*`, `terminal/*`, `identity/*`, `financia
`country_specs`, `exchange_rates`, `radar/value_lists`, `billing_portal/configurations`,
`payment_method_configurations`, `payment_method_domains`, `invoice_rendering_templates`.
-### Google Ads — needs confirmation
-
-21 tables and the best-covered source we have.
-Remaining gaps are mostly breakdown views and account-config resources.
-
-- [ ] `campaign_budget` — budgets and budget pacing.
-- [ ] `age_range_view`, `gender_view` — demographic breakdowns.
-- [ ] `detail_placement_view`, `landing_page_view` — where ads actually ran and landed.
-- [ ] `change_event` — audit of who changed what in the account.
-- [ ] `user_location_view` / `location_view` — distinct from the existing `geographic_stats`.
-- [ ] `audience`, `bidding_strategy`, `label`, `recommendation`.
-- [ ] `product_group_view` — Shopping campaign structure beyond `shopping_performance_view`.
-- [ ] `asset` — individual asset performance, complements `asset_group`.
-- [ ] Device segmentation and hourly segmentation on the existing stats views.
-- [ ] Conversion stats segmented by `conversion_action` (we have the actions but not their stats).
+### Google Ads — spec-verified
+
+Diffed against the [Google Ads API v25 field reference](https://developers.google.com/google-ads/api/fields/v25/overview)
+on 2026-08-04, using each resource's attributed/segmenting resource lists and the per-field
+"selectable with" lists to check every field, segment and metric combination.
+35 tables and the best-covered source we have.
+
+- [x] `campaign_budget` — budgets and budget pacing.
+- [x] `age_range_view`, `gender_view` — demographic breakdowns.
+- [x] `detail_placement_view`, `landing_page_view` — where ads actually ran and landed.
+- [ ] `change_event` — audit of who changed what in the account. (skipped: GAQL requires a mandatory
+ `LIMIT` of at most 10,000 rows and a `change_date_time` filter inside a 30-day window, neither of
+ which the shared query composer or the page-token pagination loop can express)
+- [x] `user_location_view` / `location_view` — distinct from the existing `geographic_stats`.
+- [x] `audience`, `bidding_strategy`, `label`. (`recommendation` skipped: recommendations are ephemeral
+ suggestions that vanish once applied or dismissed and have no stable ID, so a merge-only table
+ would accumulate rows that no longer exist)
+- [x] `product_group_view` — Shopping campaign structure beyond `shopping_performance_view`.
+- [x] `asset` — asset metadata, complements `asset_group`. Per-asset performance would need
+ `ad_group_ad_asset_view` or `asset_field_type_view` and is still open.
+- [x] Hourly segmentation, as `campaign_hourly_stats`. (device segmentation was already there — every
+ existing `*_stats` table selects `segments.device`)
+- [x] Conversion stats segmented by `conversion_action` (we have the actions but not their stats).
### Meta Ads — needs confirmation
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/canonical_descriptions.py
index d1621cc5d013..b1255f245946 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/canonical_descriptions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/canonical_descriptions.py
@@ -328,4 +328,229 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"conversion_action_counting_type": "Whether every conversion or one per click/interaction is counted.",
},
},
+ "campaign_budget": {
+ "description": "A campaign budget, including the daily amount, delivery method and Google's recommended budget.",
+ "docs_url": "https://developers.google.com/google-ads/api/fields/v25/campaign_budget",
+ "columns": {
+ "customer_id": "The Google Ads customer (account) ID the budget belongs to.",
+ "customer_currency_code": "Three-letter ISO 4217 currency code of the account.",
+ "campaign_budget_id": "Unique ID of the campaign budget. Join to campaign.campaign_budget.",
+ "campaign_budget_name": "Name of the budget. Only explicitly shared budgets are required to have one.",
+ "campaign_budget_amount_micros": "Average daily amount to spend, in micros, when the period is daily.",
+ "campaign_budget_total_amount_micros": "Total amount to spend over the whole run, in micros, when the period is a custom period.",
+ "campaign_budget_status": "Status of the budget (enabled or removed).",
+ "campaign_budget_delivery_method": "Rate at which the budget is spent (standard or accelerated).",
+ "campaign_budget_explicitly_shared": "Whether the budget was created to be shared across several campaigns.",
+ "campaign_budget_reference_count": "Number of campaigns actively using the budget.",
+ "campaign_budget_has_recommended_budget": "Whether Google has a recommended budget for this budget.",
+ "campaign_budget_recommended_budget_amount_micros": "Google's recommended budget amount, in micros. Falls back to the current amount when there is no recommendation.",
+ "campaign_budget_period": "Period the budget is spent over (daily or a custom period).",
+ "campaign_budget_type": "Type of the budget (standard or Smart campaign).",
+ "campaign_budget_aligned_bidding_strategy_id": "ID of the portfolio bidding strategy this shared budget is aligned with.",
+ },
+ },
+ "bidding_strategy": {
+ "description": "A portfolio bidding strategy shared across campaigns, including its targets and how many campaigns use it.",
+ "docs_url": "https://developers.google.com/google-ads/api/fields/v25/bidding_strategy",
+ "columns": {
+ "customer_id": "The Google Ads customer (account) ID the strategy belongs to.",
+ "bidding_strategy_id": "Unique ID of the bidding strategy. Join to campaign.bidding_strategy.",
+ "bidding_strategy_name": "Name of the bidding strategy, unique within the account.",
+ "bidding_strategy_type": "Type of the strategy (e.g. target CPA, target ROAS, maximize conversions).",
+ "bidding_strategy_status": "Status of the strategy (enabled or removed).",
+ "bidding_strategy_currency_code": "Currency the strategy bids in, as an ISO 4217 three-letter code.",
+ "bidding_strategy_effective_currency_code": "Currency actually used by the strategy, as an ISO 4217 three-letter code.",
+ "bidding_strategy_campaign_count": "Number of campaigns attached to the strategy.",
+ "bidding_strategy_non_removed_campaign_count": "Number of non-removed campaigns attached to the strategy.",
+ "bidding_strategy_aligned_campaign_budget_id": "ID of the campaign budget this portfolio strategy is aligned with.",
+ "bidding_strategy_target_cpa_target_cpa_micros": "Average cost-per-action target, in micros.",
+ "bidding_strategy_target_cpa_cpc_bid_ceiling_micros": "Highest CPC bid the target CPA strategy may set, in micros.",
+ "bidding_strategy_target_cpa_cpc_bid_floor_micros": "Lowest CPC bid the target CPA strategy may set, in micros.",
+ "bidding_strategy_target_roas_target_roas": "Target return on ad spend: revenue per unit of spend.",
+ "bidding_strategy_target_spend_target_spend_micros": "Spend target to maximize clicks under, in micros. Deprecated by Google in favour of the campaign budget.",
+ "bidding_strategy_target_spend_cpc_bid_ceiling_micros": "Highest CPC bid the maximize clicks strategy may set, in micros.",
+ "bidding_strategy_maximize_conversions_target_cpa_micros": "Target cost per conversion for a maximize conversions strategy, in micros.",
+ "bidding_strategy_maximize_conversion_value_target_roas": "Target return on ad spend for a maximize conversion value strategy.",
+ "bidding_strategy_target_impression_share_location": "Where on the search results page the strategy targets impressions.",
+ "bidding_strategy_target_impression_share_location_fraction_micros": "Chosen share of ads to show in the targeted location, in micros (1% is 10,000).",
+ "bidding_strategy_target_impression_share_cpc_bid_ceiling_micros": "Highest CPC bid the target impression share strategy may set, in micros.",
+ },
+ },
+ "label": {
+ "description": "A label that can be applied to campaigns, ad groups, ads and keywords for grouping and reporting.",
+ "docs_url": "https://developers.google.com/google-ads/api/fields/v25/label",
+ "columns": {
+ "customer_id": "The Google Ads customer (account) ID the label belongs to.",
+ "label_id": "Unique ID of the label.",
+ "label_name": "Name of the label.",
+ "label_status": "Status of the label (enabled or removed).",
+ "label_text_label_background_color": "Background color of the label, in hex format.",
+ "label_text_label_description": "Short description of the label.",
+ },
+ },
+ "audience": {
+ "description": "An audience: a reusable targeting definition combining segments such as user lists, interests and demographics.",
+ "docs_url": "https://developers.google.com/google-ads/api/fields/v25/audience",
+ "columns": {
+ "customer_id": "The Google Ads customer (account) ID the audience belongs to.",
+ "audience_id": "Unique ID of the audience.",
+ "audience_name": "Name of the audience, unique within the account.",
+ "audience_description": "Description of the audience.",
+ "audience_scope": "Whether the audience is available account-wide or only to one asset group.",
+ "audience_status": "Status of the audience (enabled or removed).",
+ "audience_asset_group": "Resource name of the asset group the audience is scoped to, when the scope is asset group.",
+ "audience_dimensions": "Positive dimensions making up the audience, as JSON.",
+ "audience_exclusion_dimension": "Negative dimension excluded from the audience, as JSON.",
+ },
+ },
+ "asset": {
+ "description": "An individual asset (text, image, video, sitelink, callout and so on) that can be attached to campaigns, ad groups and ads.",
+ "docs_url": "https://developers.google.com/google-ads/api/fields/v25/asset",
+ "columns": {
+ "customer_id": "The Google Ads customer (account) ID the asset belongs to.",
+ "asset_id": "Unique ID of the asset.",
+ "asset_name": "Optional name of the asset.",
+ "asset_type": "Type of the asset (e.g. text, image, youtube video, sitelink, callout).",
+ "asset_source": "Where the asset came from (advertiser-provided or automatically created).",
+ "asset_final_urls": "Landing-page URLs the asset sends users to.",
+ "asset_final_mobile_urls": "Mobile landing-page URLs the asset sends users to.",
+ "asset_tracking_url_template": "URL template used to build a tracking URL for the asset.",
+ "asset_policy_summary_approval_status": "Overall policy approval status of the asset.",
+ "asset_policy_summary_review_status": "Where the asset is in Google's review process.",
+ "asset_text_asset_text": "Text content, for text assets.",
+ "asset_image_asset_file_size": "File size of the image, in bytes.",
+ "asset_image_asset_mime_type": "MIME type of the image.",
+ "asset_image_asset_full_size_url": "URL that returns the image at its full size.",
+ "asset_image_asset_full_size_height_pixels": "Height of the image, in pixels.",
+ "asset_image_asset_full_size_width_pixels": "Width of the image, in pixels.",
+ "asset_youtube_video_asset_youtube_video_id": "YouTube video ID, the 11-character string from the video URL.",
+ "asset_youtube_video_asset_youtube_video_title": "Title of the YouTube video.",
+ "asset_callout_asset_callout_text": "Callout text, for callout assets.",
+ "asset_sitelink_asset_link_text": "Display text of the sitelink.",
+ "asset_sitelink_asset_description1": "First description line of the sitelink.",
+ "asset_sitelink_asset_description2": "Second description line of the sitelink.",
+ "asset_call_asset_phone_number": "Advertiser phone number, for call assets.",
+ "asset_call_asset_country_code": "Two-letter country code of the phone number.",
+ "asset_promotion_asset_promotion_code": "Code the user enters to qualify for the promotion.",
+ "asset_structured_snippet_asset_header": "Header of the structured snippet.",
+ "asset_structured_snippet_asset_values": "Values listed in the structured snippet.",
+ "asset_mobile_app_asset_app_id": "Store ID of the promoted mobile app.",
+ "asset_mobile_app_asset_app_store": "App store the promoted app is distributed on.",
+ "asset_lead_form_asset_business_name": "Name of the business advertised on the lead form.",
+ "asset_lead_form_asset_headline": "Headline of the lead form.",
+ },
+ },
+ "age_range_stats": {
+ "description": "Daily performance broken out by the age range of the user (age_range_view).",
+ "docs_url": "https://developers.google.com/google-ads/api/fields/v25/age_range_view",
+ "columns": _stats_columns(
+ **{
+ "ad_group_criterion_criterion_id": "Criterion ID of the age range within the ad group.",
+ "ad_group_criterion_age_range_type": "The age range bucket the metrics are reported for (e.g. 25-34, undetermined).",
+ "ad_group_criterion_status": "Status of the age range criterion (enabled, paused, or removed).",
+ "ad_group_criterion_bid_modifier": "Bid modifier applied to this age range.",
+ }
+ ),
+ },
+ "gender_stats": {
+ "description": "Daily performance broken out by the gender of the user (gender_view).",
+ "docs_url": "https://developers.google.com/google-ads/api/fields/v25/gender_view",
+ "columns": _stats_columns(
+ **{
+ "ad_group_criterion_criterion_id": "Criterion ID of the gender within the ad group.",
+ "ad_group_criterion_gender_type": "The gender bucket the metrics are reported for (male, female, or undetermined).",
+ "ad_group_criterion_status": "Status of the gender criterion (enabled, paused, or removed).",
+ "ad_group_criterion_bid_modifier": "Bid modifier applied to this gender.",
+ }
+ ),
+ },
+ "detail_placement_stats": {
+ "description": "Daily performance broken out by the individual placement (website, app, or YouTube channel) an ad ran on (detail_placement_view).",
+ "docs_url": "https://developers.google.com/google-ads/api/fields/v25/detail_placement_view",
+ "columns": _stats_columns(
+ **{
+ "detail_placement_view_placement": "Automatic placement string, e.g. a website URL, a mobile app ID, or a YouTube video or channel ID.",
+ "detail_placement_view_display_name": "Human-readable name of the placement: the website name, app name, or YouTube video or channel title.",
+ "detail_placement_view_placement_type": "Type of the placement (website, mobile app, YouTube video, or YouTube channel).",
+ "detail_placement_view_target_url": "URL of the placement, e.g. the website, the app store listing, or the YouTube video.",
+ "detail_placement_view_group_placement_target_url": "URL of the group that contains the placement, e.g. the domain or the YouTube channel.",
+ }
+ ),
+ },
+ "landing_page_stats": {
+ "description": "Daily performance broken out by the unexpanded final URL of the landing page ads sent users to (landing_page_view).",
+ "docs_url": "https://developers.google.com/google-ads/api/fields/v25/landing_page_view",
+ "columns": _stats_columns(
+ **{
+ "landing_page_view_unexpanded_final_url": "The final URL as entered by the advertiser, before URL expansion.",
+ "metrics_speed_score": "Google's 0-100 estimate of how fast the landing page loads on mobile, relative to other pages.",
+ "metrics_mobile_friendly_clicks_percentage": "Percentage of mobile clicks that went to a mobile-friendly page.",
+ "metrics_valid_accelerated_mobile_pages_clicks_percentage": "Percentage of clicks to a landing page that is a valid AMP page.",
+ }
+ ),
+ },
+ "user_location_stats": {
+ "description": "Daily performance broken out by the country the user was physically in, regardless of the locations the campaign targets (user_location_view).",
+ "docs_url": "https://developers.google.com/google-ads/api/fields/v25/user_location_view",
+ "columns": _stats_columns(
+ **{
+ "user_location_view_country_criterion_id": "Criterion ID of the country the user was physically located in.",
+ "user_location_view_targeting_location": "Whether the location was one the campaign targets.",
+ }
+ ),
+ },
+ "location_stats": {
+ "description": "Daily performance broken out by the location criteria a campaign targets (location_view).",
+ "docs_url": "https://developers.google.com/google-ads/api/fields/v25/location_view",
+ "columns": _stats_columns(
+ **{
+ "campaign_criterion_criterion_id": "Criterion ID of the targeted location within the campaign.",
+ "campaign_criterion_location_geo_target_constant": "Resource name of the targeted geo target constant.",
+ "campaign_criterion_negative": "Whether the location is excluded rather than targeted.",
+ "campaign_criterion_bid_modifier": "Bid modifier applied to this location.",
+ "campaign_criterion_status": "Status of the location criterion (enabled, paused, or removed).",
+ }
+ ),
+ },
+ "product_group_stats": {
+ "description": "Daily performance broken out by the product group nodes of a Shopping campaign's product partition tree (product_group_view).",
+ "docs_url": "https://developers.google.com/google-ads/api/fields/v25/product_group_view",
+ "columns": _stats_columns(
+ **{
+ "ad_group_criterion_criterion_id": "Criterion ID of the product group node.",
+ "ad_group_criterion_listing_group_type": "Type of the node: a subdivision that splits further, or a unit that can be bid on.",
+ "ad_group_criterion_listing_group_parent_ad_group_criterion": "Resource name of the parent node in the product partition tree.",
+ "ad_group_criterion_listing_group_case_value_product_item_id_value": "Product item ID the node splits on.",
+ "ad_group_criterion_listing_group_case_value_product_brand_value": "Product brand the node splits on.",
+ "ad_group_criterion_listing_group_case_value_product_condition_condition": "Product condition the node splits on (new, refurbished, or used).",
+ "ad_group_criterion_listing_group_case_value_product_type_value": "Product type value the node splits on.",
+ "ad_group_criterion_listing_group_case_value_product_type_level": "Level of the product type the node splits on.",
+ "ad_group_criterion_listing_group_case_value_product_channel_channel": "Sales channel the node splits on (online or local).",
+ "ad_group_criterion_negative": "Whether the node is excluded rather than bid on.",
+ "ad_group_criterion_status": "Status of the product group criterion (enabled, paused, or removed).",
+ "ad_group_criterion_cpc_bid_micros": "Maximum cost-per-click bid on the node, in micros.",
+ }
+ ),
+ },
+ "campaign_hourly_stats": {
+ "description": "Hourly campaign performance, one row per campaign, day, hour, device and network. Use it for dayparting analysis.",
+ "docs_url": "https://developers.google.com/google-ads/api/fields/v25/campaign",
+ "columns": _stats_columns(
+ **{
+ "segments_hour": "Hour of day the metrics are reported for, as an integer from 0 to 23 in the account time zone.",
+ }
+ ),
+ },
+ "campaign_conversion_action_stats": {
+ "description": "Daily campaign conversions broken out by conversion action. Only conversion metrics are available alongside this segmentation, so clicks, impressions and cost are not included.",
+ "docs_url": "https://developers.google.com/google-ads/api/fields/v25/campaign",
+ "columns": _stats_columns(
+ **{
+ "segments_conversion_action": "Resource name of the conversion action the conversions are attributed to. Join to conversion_action.",
+ "segments_conversion_action_name": "Name of the conversion action.",
+ "segments_conversion_action_category": "Category of the conversion action (e.g. purchase, lead, sign-up).",
+ "metrics_cross_device_conversions": "Conversions where the conversion happened on a different device to the ad interaction.",
+ }
+ ),
+ },
}
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/schemas.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/schemas.py
index 733b81c57ba6..40ade2c46727 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/schemas.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/schemas.py
@@ -872,4 +872,506 @@ RESOURCE_SCHEMAS: dict[str, dict[str, Any]] = {
"conversion_action.attribution_model_settings.data_driven_model_status",
],
},
+ "campaign_budget": {
+ "resource_name": "campaign_budget",
+ "primary_key": [
+ "campaign_budget.id",
+ "customer.id",
+ ],
+ "field_names": [
+ "campaign_budget.id",
+ "customer.id",
+ "campaign_budget.name",
+ "campaign_budget.amount_micros",
+ "campaign_budget.total_amount_micros",
+ "campaign_budget.status",
+ "campaign_budget.delivery_method",
+ "campaign_budget.explicitly_shared",
+ "campaign_budget.reference_count",
+ "campaign_budget.has_recommended_budget",
+ "campaign_budget.recommended_budget_amount_micros",
+ "campaign_budget.period",
+ "campaign_budget.type",
+ "campaign_budget.aligned_bidding_strategy_id",
+ "customer.currency_code",
+ ],
+ },
+ "bidding_strategy": {
+ "resource_name": "bidding_strategy",
+ "primary_key": [
+ "bidding_strategy.id",
+ "customer.id",
+ ],
+ "field_names": [
+ "bidding_strategy.id",
+ "customer.id",
+ "bidding_strategy.name",
+ "bidding_strategy.type",
+ "bidding_strategy.status",
+ "bidding_strategy.currency_code",
+ "bidding_strategy.effective_currency_code",
+ "bidding_strategy.campaign_count",
+ "bidding_strategy.non_removed_campaign_count",
+ "bidding_strategy.aligned_campaign_budget_id",
+ "bidding_strategy.target_cpa.target_cpa_micros",
+ "bidding_strategy.target_cpa.cpc_bid_ceiling_micros",
+ "bidding_strategy.target_cpa.cpc_bid_floor_micros",
+ "bidding_strategy.target_roas.target_roas",
+ "bidding_strategy.target_spend.target_spend_micros",
+ "bidding_strategy.target_spend.cpc_bid_ceiling_micros",
+ "bidding_strategy.maximize_conversions.target_cpa_micros",
+ "bidding_strategy.maximize_conversion_value.target_roas",
+ "bidding_strategy.target_impression_share.location",
+ "bidding_strategy.target_impression_share.location_fraction_micros",
+ "bidding_strategy.target_impression_share.cpc_bid_ceiling_micros",
+ ],
+ },
+ "label": {
+ "resource_name": "label",
+ "primary_key": [
+ "label.id",
+ "customer.id",
+ ],
+ "field_names": [
+ "label.id",
+ "customer.id",
+ "label.name",
+ "label.status",
+ "label.text_label.background_color",
+ "label.text_label.description",
+ ],
+ },
+ "audience": {
+ "resource_name": "audience",
+ "primary_key": [
+ "audience.id",
+ "customer.id",
+ ],
+ "field_names": [
+ "audience.id",
+ "customer.id",
+ "audience.name",
+ "audience.description",
+ "audience.scope",
+ "audience.status",
+ "audience.asset_group",
+ "audience.dimensions",
+ "audience.exclusion_dimension",
+ ],
+ },
+ "asset": {
+ "resource_name": "asset",
+ "primary_key": [
+ "asset.id",
+ "customer.id",
+ ],
+ "field_names": [
+ "asset.id",
+ "customer.id",
+ "asset.name",
+ "asset.type",
+ "asset.source",
+ "asset.final_urls",
+ "asset.final_mobile_urls",
+ "asset.tracking_url_template",
+ "asset.policy_summary.approval_status",
+ "asset.policy_summary.review_status",
+ "asset.text_asset.text",
+ "asset.image_asset.file_size",
+ "asset.image_asset.mime_type",
+ "asset.image_asset.full_size.url",
+ "asset.image_asset.full_size.height_pixels",
+ "asset.image_asset.full_size.width_pixels",
+ "asset.youtube_video_asset.youtube_video_id",
+ "asset.youtube_video_asset.youtube_video_title",
+ "asset.callout_asset.callout_text",
+ "asset.sitelink_asset.link_text",
+ "asset.sitelink_asset.description1",
+ "asset.sitelink_asset.description2",
+ "asset.call_asset.phone_number",
+ "asset.call_asset.country_code",
+ "asset.promotion_asset.promotion_code",
+ "asset.structured_snippet_asset.header",
+ "asset.structured_snippet_asset.values",
+ "asset.mobile_app_asset.app_id",
+ "asset.mobile_app_asset.app_store",
+ "asset.lead_form_asset.business_name",
+ "asset.lead_form_asset.headline",
+ ],
+ },
+ "age_range_stats": {
+ "resource_name": "age_range_view",
+ "primary_key": [
+ "ad_group_criterion.criterion_id",
+ "ad_group.id",
+ "campaign.id",
+ "customer.id",
+ "segments.date",
+ "segments.device",
+ "segments.ad_network_type",
+ ],
+ "filter_field_names": [("segments.date", IncrementalFieldType.Date)],
+ "should_sync_default": False,
+ "description": "This table fans out per age range bucket, device and network for every day.",
+ "field_names": [
+ "ad_group_criterion.criterion_id",
+ "ad_group.id",
+ "campaign.id",
+ "customer.id",
+ "customer.currency_code",
+ "ad_group_criterion.age_range.type",
+ "ad_group_criterion.status",
+ "ad_group_criterion.bid_modifier",
+ "metrics.clicks",
+ "metrics.impressions",
+ "metrics.cost_micros",
+ "metrics.conversions",
+ "metrics.conversions_value",
+ "metrics.all_conversions",
+ "metrics.all_conversions_value",
+ "metrics.view_through_conversions",
+ "metrics.ctr",
+ "metrics.average_cpc",
+ "metrics.average_cpm",
+ "metrics.interactions",
+ "metrics.interaction_rate",
+ "segments.date",
+ "segments.device",
+ "segments.ad_network_type",
+ "segments.day_of_week",
+ "segments.month",
+ "segments.quarter",
+ "segments.week",
+ "segments.year",
+ ],
+ },
+ "gender_stats": {
+ "resource_name": "gender_view",
+ "primary_key": [
+ "ad_group_criterion.criterion_id",
+ "ad_group.id",
+ "campaign.id",
+ "customer.id",
+ "segments.date",
+ "segments.device",
+ "segments.ad_network_type",
+ ],
+ "filter_field_names": [("segments.date", IncrementalFieldType.Date)],
+ "should_sync_default": False,
+ "description": "This table fans out per gender bucket, device and network for every day.",
+ "field_names": [
+ "ad_group_criterion.criterion_id",
+ "ad_group.id",
+ "campaign.id",
+ "customer.id",
+ "customer.currency_code",
+ "ad_group_criterion.gender.type",
+ "ad_group_criterion.status",
+ "ad_group_criterion.bid_modifier",
+ "metrics.clicks",
+ "metrics.impressions",
+ "metrics.cost_micros",
+ "metrics.conversions",
+ "metrics.conversions_value",
+ "metrics.all_conversions",
+ "metrics.all_conversions_value",
+ "metrics.view_through_conversions",
+ "metrics.ctr",
+ "metrics.average_cpc",
+ "metrics.average_cpm",
+ "metrics.interactions",
+ "metrics.interaction_rate",
+ "segments.date",
+ "segments.device",
+ "segments.ad_network_type",
+ "segments.day_of_week",
+ "segments.month",
+ "segments.quarter",
+ "segments.week",
+ "segments.year",
+ ],
+ },
+ "detail_placement_stats": {
+ "resource_name": "detail_placement_view",
+ "primary_key": [
+ "detail_placement_view.placement",
+ "ad_group.id",
+ "campaign.id",
+ "customer.id",
+ "segments.date",
+ "segments.device",
+ "segments.ad_network_type",
+ ],
+ "filter_field_names": [("segments.date", IncrementalFieldType.Date)],
+ "should_sync_default": False,
+ "description": "This table fans out to every individual placement an ad ran on and can load hundreds of millions of rows for active Display and Video campaigns.",
+ "extra_where": "metrics.impressions > 0",
+ "field_names": [
+ "detail_placement_view.placement",
+ "detail_placement_view.display_name",
+ "detail_placement_view.placement_type",
+ "detail_placement_view.target_url",
+ "detail_placement_view.group_placement_target_url",
+ "ad_group.id",
+ "campaign.id",
+ "customer.id",
+ "customer.currency_code",
+ "metrics.clicks",
+ "metrics.impressions",
+ "metrics.cost_micros",
+ "metrics.conversions",
+ "metrics.conversions_value",
+ "metrics.all_conversions",
+ "metrics.all_conversions_value",
+ "metrics.view_through_conversions",
+ "metrics.ctr",
+ "metrics.average_cpc",
+ "metrics.average_cpm",
+ "metrics.interactions",
+ "metrics.interaction_rate",
+ "segments.date",
+ "segments.device",
+ "segments.ad_network_type",
+ "segments.day_of_week",
+ "segments.month",
+ "segments.quarter",
+ "segments.week",
+ "segments.year",
+ ],
+ },
+ "landing_page_stats": {
+ "resource_name": "landing_page_view",
+ "primary_key": [
+ "landing_page_view.unexpanded_final_url",
+ "campaign.id",
+ "customer.id",
+ "segments.date",
+ "segments.device",
+ "segments.ad_network_type",
+ ],
+ "filter_field_names": [("segments.date", IncrementalFieldType.Date)],
+ "should_sync_default": False,
+ "description": "This table fans out to every landing page URL per campaign and day, so it can get large for accounts with many final URLs.",
+ "extra_where": "metrics.impressions > 0",
+ "field_names": [
+ "landing_page_view.unexpanded_final_url",
+ "campaign.id",
+ "customer.id",
+ "customer.currency_code",
+ "metrics.clicks",
+ "metrics.impressions",
+ "metrics.cost_micros",
+ "metrics.conversions",
+ "metrics.conversions_value",
+ "metrics.all_conversions",
+ "metrics.all_conversions_value",
+ "metrics.ctr",
+ "metrics.average_cpc",
+ "metrics.speed_score",
+ "metrics.mobile_friendly_clicks_percentage",
+ "metrics.valid_accelerated_mobile_pages_clicks_percentage",
+ "segments.date",
+ "segments.device",
+ "segments.ad_network_type",
+ "segments.day_of_week",
+ "segments.month",
+ "segments.quarter",
+ "segments.week",
+ "segments.year",
+ ],
+ },
+ "user_location_stats": {
+ "resource_name": "user_location_view",
+ "primary_key": [
+ "user_location_view.country_criterion_id",
+ "user_location_view.targeting_location",
+ "campaign.id",
+ "customer.id",
+ "segments.date",
+ "segments.device",
+ "segments.ad_network_type",
+ ],
+ "filter_field_names": [("segments.date", IncrementalFieldType.Date)],
+ "should_sync_default": False,
+ "description": "This table fans out per country, campaign and day and can get large for accounts running in many countries.",
+ "extra_where": "metrics.impressions > 0",
+ "field_names": [
+ "user_location_view.country_criterion_id",
+ "user_location_view.targeting_location",
+ "campaign.id",
+ "customer.id",
+ "customer.currency_code",
+ "metrics.clicks",
+ "metrics.impressions",
+ "metrics.cost_micros",
+ "metrics.conversions",
+ "metrics.conversions_value",
+ "metrics.all_conversions",
+ "metrics.all_conversions_value",
+ "metrics.view_through_conversions",
+ "metrics.ctr",
+ "metrics.average_cpc",
+ "segments.date",
+ "segments.device",
+ "segments.ad_network_type",
+ "segments.day_of_week",
+ "segments.month",
+ "segments.quarter",
+ "segments.week",
+ "segments.year",
+ ],
+ },
+ "location_stats": {
+ "resource_name": "location_view",
+ "primary_key": [
+ "campaign_criterion.criterion_id",
+ "campaign.id",
+ "customer.id",
+ "segments.date",
+ ],
+ "filter_field_names": [("segments.date", IncrementalFieldType.Date)],
+ "should_sync_default": False,
+ "description": "This table fans out per targeted location criterion, campaign and day.",
+ "field_names": [
+ "campaign_criterion.criterion_id",
+ "campaign.id",
+ "customer.id",
+ "customer.currency_code",
+ "campaign_criterion.location.geo_target_constant",
+ "campaign_criterion.negative",
+ "campaign_criterion.bid_modifier",
+ "campaign_criterion.status",
+ "metrics.clicks",
+ "metrics.impressions",
+ "metrics.cost_micros",
+ "metrics.conversions",
+ "metrics.conversions_value",
+ "metrics.all_conversions",
+ "metrics.all_conversions_value",
+ "metrics.ctr",
+ "metrics.average_cpc",
+ "segments.date",
+ "segments.month",
+ "segments.quarter",
+ "segments.week",
+ "segments.year",
+ ],
+ },
+ "product_group_stats": {
+ "resource_name": "product_group_view",
+ "primary_key": [
+ "ad_group_criterion.criterion_id",
+ "ad_group.id",
+ "campaign.id",
+ "customer.id",
+ "segments.date",
+ "segments.device",
+ "segments.ad_network_type",
+ ],
+ "filter_field_names": [("segments.date", IncrementalFieldType.Date)],
+ "should_sync_default": False,
+ "description": "This table fans out to every product group node per ad group and day, so it can get large for Shopping accounts with deep product group trees.",
+ "extra_where": "metrics.impressions > 0",
+ "field_names": [
+ "ad_group_criterion.criterion_id",
+ "ad_group.id",
+ "campaign.id",
+ "customer.id",
+ "customer.currency_code",
+ "ad_group_criterion.listing_group.type",
+ "ad_group_criterion.listing_group.parent_ad_group_criterion",
+ "ad_group_criterion.listing_group.case_value.product_item_id.value",
+ "ad_group_criterion.listing_group.case_value.product_brand.value",
+ "ad_group_criterion.listing_group.case_value.product_condition.condition",
+ "ad_group_criterion.listing_group.case_value.product_type.value",
+ "ad_group_criterion.listing_group.case_value.product_type.level",
+ "ad_group_criterion.listing_group.case_value.product_channel.channel",
+ "ad_group_criterion.negative",
+ "ad_group_criterion.status",
+ "ad_group_criterion.cpc_bid_micros",
+ "metrics.clicks",
+ "metrics.impressions",
+ "metrics.cost_micros",
+ "metrics.conversions",
+ "metrics.conversions_value",
+ "metrics.all_conversions",
+ "metrics.all_conversions_value",
+ "metrics.ctr",
+ "metrics.average_cpc",
+ "segments.date",
+ "segments.device",
+ "segments.ad_network_type",
+ "segments.day_of_week",
+ "segments.month",
+ "segments.quarter",
+ "segments.week",
+ "segments.year",
+ ],
+ },
+ "campaign_hourly_stats": {
+ "resource_name": "campaign",
+ "primary_key": [
+ "campaign.id",
+ "customer.id",
+ "segments.date",
+ "segments.hour",
+ "segments.device",
+ "segments.ad_network_type",
+ ],
+ "filter_field_names": [("segments.date", IncrementalFieldType.Date)],
+ "should_sync_default": False,
+ "description": "This table carries one row per campaign, hour, device and network for every day, so it is roughly 24 times the size of campaign_stats.",
+ "field_names": [
+ "campaign.id",
+ "customer.id",
+ "customer.currency_code",
+ "metrics.clicks",
+ "metrics.impressions",
+ "metrics.cost_micros",
+ "metrics.conversions",
+ "metrics.conversions_value",
+ "metrics.all_conversions",
+ "metrics.all_conversions_value",
+ "metrics.ctr",
+ "metrics.average_cpc",
+ "metrics.average_cpm",
+ "segments.date",
+ "segments.hour",
+ "segments.device",
+ "segments.ad_network_type",
+ ],
+ },
+ "campaign_conversion_action_stats": {
+ "resource_name": "campaign",
+ "primary_key": [
+ "campaign.id",
+ "customer.id",
+ "segments.conversion_action",
+ "segments.date",
+ "segments.device",
+ ],
+ "filter_field_names": [("segments.date", IncrementalFieldType.Date)],
+ "should_sync_default": False,
+ "description": "This table fans out per conversion action, so it only carries conversion metrics — clicks, impressions and cost are not available alongside conversion action segmentation.",
+ "field_names": [
+ "campaign.id",
+ "customer.id",
+ "segments.conversion_action",
+ "segments.conversion_action_name",
+ "segments.conversion_action_category",
+ "segments.date",
+ "metrics.conversions",
+ "metrics.conversions_value",
+ "metrics.all_conversions",
+ "metrics.all_conversions_value",
+ "metrics.view_through_conversions",
+ "metrics.cross_device_conversions",
+ "metrics.value_per_conversion",
+ "segments.device",
+ "segments.month",
+ "segments.quarter",
+ "segments.week",
+ "segments.year",
+ ],
+ },
}
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/tests/test_google_ads_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/tests/test_google_ads_source.py
index d3cf04ee9df0..3ef333a34bfa 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/tests/test_google_ads_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_ads/tests/test_google_ads_source.py
@@ -1504,3 +1504,69 @@ class TestTypeUrlVersionResolution:
def test_unknown_version_raises(self):
with pytest.raises(ValueError):
_resolve_protobuf_message_type_url("google.ads.googleads.v99.enums.DeviceEnum")
+
+
+class TestResourceSchemaInvariants:
+ @pytest.mark.parametrize("alias", sorted(RESOURCE_SCHEMAS))
+ def test_primary_key_columns_are_selected(self, alias):
+ # Rows are built only from the fields in the SELECT clause, so a primary key naming a field
+ # the table doesn't select produces rows without that column. The Delta merge then either
+ # fails on the missing key or matches every row, seeding duplicates on every sync.
+ contents = RESOURCE_SCHEMAS[alias]
+ assert set(contents["primary_key"]) <= set(contents["field_names"])
+
+ @pytest.mark.parametrize("alias", sorted(RESOURCE_SCHEMAS))
+ def test_partition_keys_are_selected(self, alias):
+ # Partition keys are read off the synced rows, so an unselected partition key would leave the
+ # pipeline partitioning on a column that never arrives.
+ contents = RESOURCE_SCHEMAS[alias]
+ assert set(contents.get("partition_keys") or []) <= set(contents["field_names"])
+
+ @pytest.mark.parametrize("alias", sorted(RESOURCE_SCHEMAS))
+ def test_incremental_tables_filter_on_a_selected_segments_date(self, alias):
+ # `requires_filter` tables are queried with a `segments.date` window and partitioned on
+ # `segments_date`. Declaring a different filter field, or not selecting segments.date, breaks
+ # both the incremental window and the partitioning.
+ contents = RESOURCE_SCHEMAS[alias]
+ if "filter_field_names" not in contents:
+ return
+ assert contents["filter_field_names"] == [("segments.date", IncrementalFieldType.Date)]
+ assert "segments.date" in contents["field_names"]
+
+
+class TestConversionActionSegmentedStats:
+ def test_only_conversion_metrics_are_selected(self):
+ # Google rejects a query that pairs segments.conversion_action with a non-conversion metric,
+ # which would fail the whole table rather than drop a column. Keep the metric list to the
+ # conversion family.
+ field_names = RESOURCE_SCHEMAS["campaign_conversion_action_stats"]["field_names"]
+ metrics = [f for f in field_names if f.startswith("metrics.")]
+
+ assert metrics
+ assert all("conversion" in metric for metric in metrics)
+
+
+class TestBreakdownStatsDefaultOff:
+ # These tables fan a day of spend out across placements, landing pages, product groups, hours and
+ # demographics, so they are orders of magnitude larger than the campaign and ad group reports.
+ # Defaulting one of them on would silently start syncing it for every account on the next schema
+ # reconcile, so each must stay opt-in and explain its size in the picker.
+ @pytest.mark.parametrize(
+ "alias",
+ [
+ "age_range_stats",
+ "campaign_conversion_action_stats",
+ "campaign_hourly_stats",
+ "detail_placement_stats",
+ "gender_stats",
+ "landing_page_stats",
+ "location_stats",
+ "product_group_stats",
+ "user_location_stats",
+ ],
+ )
+ def test_breakdown_stats_are_opt_in_and_described(self, alias):
+ contents = RESOURCE_SCHEMAS[alias]
+
+ assert contents["should_sync_default"] is False
+ assert contents["description"]