Unique , Index, or Primary Key.

70 views
Skip to first unread message

Ahmad Jafari

unread,
Jul 7, 2022, 11:04:08 AM7/7/22
to Google Ads API and AdWords API Forum
Hi,
I get campaign performance based on segment Date and store it on DB, I want to know, is there any parameter as unique to avoid inserting duplicate records?
Thank you. 

Google Ads API Forum Advisor

unread,
Jul 7, 2022, 1:14:55 PM7/7/22
to aja...@perle.com, adwor...@googlegroups.com
Hi Ahmad,

Thank you for your question.

If you are using the campaign view, then, a single campaign.resource_name can have multiple rows depending on the date returned by the segments.date field, and also other rows if any of the other campaign report's segments fields were used.

Best regards,

Google Logo
Peter Laurence
Google Ads API Team
 


ref:_00D1U1174p._5004Q2cTaj5:ref

Ahmad Jafari

unread,
Jul 7, 2022, 3:11:39 PM7/7/22
to Google Ads API and AdWords API Forum
Thanks for your response.
Yes, I use campaign view.
 I think you mean I should generate an index key manually by combining the metric and resource_name. that is true?

Google Ads API Forum Advisor

unread,
Jul 7, 2022, 9:57:28 PM7/7/22
to aja...@perle.com, adwor...@googlegroups.com

Hi Ahmad,
 

Thank you for getting back to us. I work with Peter and allow me to assist you here.


Regarding your question "I think you mean I should generate an index key manually by combining the metric and resource_name. that is true?", my colleague meant that reports would generate a new row for every unique combination of campaign.resource_name with other segment fields (for example, segments.date). You may refer to our documentation on segmentation for more information.

Let us know if you have further question.
 

Regards,

Google Logo
Darwin
Google Ads API Team
 


ref:_00D1U1174p._5004Q2cTaj5:ref

Ahmad Jafari

unread,
Jul 8, 2022, 9:49:28 AM7/8/22
to Google Ads API and AdWords API Forum
Thanks for the clarification, currently there is no problem in getting the data. With this method, I can check the data entered in the local database, at the campaign level.

Google Ads API Forum Advisor

unread,
Jul 8, 2022, 12:14:03 PM7/8/22
to aja...@perle.com, adwor...@googlegroups.com
Hi Ahmad,

Product support's  About data freshness shows that metrics can change over time, so it's not advisable then to use a metric field in a key. All segmenting fields will need to be in the key too.

Regards,

Google Logo
Aryeh
Google Ads API Team
 


ref:_00D1U1174p._5004Q2cTaj5:ref

Ahmad Jafari

unread,
Jul 8, 2022, 12:32:43 PM7/8/22
to Google Ads API and AdWords API Forum
Thank you, for the useful link. I can use this info in my background job to fetch data through API.
Reply all
Reply to author
Forward
0 new messages