Search code examples
apigoogle-cloud-platformcloudgoogle-ads-api

Does the Google Ads ad_group_ad has an unique atribute?


I'm writing a code to load data from Google Ads api to BigQuery table by using Cloud Functions, the process query a table called ad_group_ad but i'm struggling when trying to validate if there's duplicated rows at my destination.

By reading the docs I was expecting to find some attribute used to identifier a column or a group of columns that represents the table key. May this question seem obviously but i ain't having progress when trying to google this.

Is there a way to identifies if there's is duplicated rows? I'm not using any group by instruction when collecting, just a simple select like the example below:

SELECT
    segments.ad_network_type,
    campaign.name,
    ad_group.name,
    ad_group.id,
    so
    on,
    and,
    so,
    forth
FROM ad_group_ad
WHERE segments.date = ?

Solution

  • The combination of ad ID and ad group ID is guaranteed to be unique.

    However, as soon as you include segments in your select clause, you'll get multiple rows with the same IDs. So the combination of ad_group.id, ad.id plus whatever segment fields you need should be a candidate key.