CreateReportSchema
Creates a schema file based on the specified report.
Use this stored procedure to create a new view, which will include all attributes, metrics, and segments from specific resources. These columns can be from resource attributes (ResourceName), from non-segmenting resources (AttributeResources), or from segmenting resources (SegmentingResources). Below are a few examples:
EXEC CreateReportSchema ResourceName='distance_view', ReportName='Distance 1', SegmentingResources='campaign', OutputFolder='C:/Users/Public/Desktop' EXEC CreateReportSchema ResourceName='distance_view', ReportName='Distance 2', Description='Sample description.' EXEC CreateReportSchema ResourceName='distance_view', ReportName='Distance 3', AttributeResources='customer', Description='Sample description.' EXEC CreateReportSchema ResourceName='distance_view', ReportName='Distance 4', SegmentingResources='campaign', AttributeResources='customer', Description='Sample description.'
For the last example, you can not select all the columns in a query, because some metrics do not support some resources. You should instead specify a subset, for example:
SELECT DistanceViewResourceName, CustomerTimeZone, CampaignName, CampaignEndDate, Clicks, Impressions FROM [Distance 4]
Input
Name | Type | Accepts Output Streams | Description |
ReportName | String | False | The name for the new view. If not set, the name will be generated based on ResourceName. |
ResourceName | String | False | The API name of the resource you want to use, for example, campaign, ad_group, etc. |
AttributeResources | String | False | A comma-separated list of API resource names to include in addition to the ResourceName. Fields from these resources may be selected along with ResourceName in your SELECT and WHERE clauses. These fields will not segment metrics in your SELECT clause. |
SegmentingResources | String | False | A comma-separated list of API resource names to include in addition to the ResourceName. Fields from these resources, when selected along with ResourceName in your SELECT and WHERE clauses, will segment metrics. |
Metrics | String | False | A comma-separated list of metrics to include in the schema file. For a list of possible metrics values, see https://developers.google.com/google-ads/api/fields/v11/metrics on the Google Ads API website. |
Segments | String | False | A comma-separated list of segments to include in the schema file. For a list of possible segment values, see https://developers.google.com/google-ads/api/fields/v11/segments on the Google Ads API website. |
Description | String | False | An optional description for this custom report. |
FileStream | String | True | An instance of an output stream where file data is written to. Only used if WriteToFile is set to 'False'. |
WriteToFile | Boolean | False | If set to 'True', the schema file will be written to the directory specified by the Location connection property. If set to 'False', the schema data will either be written to the FileStream or be output as BASE64 encoded data. Defaults to 'True'.
The default value is true. |
Result Set Columns
Name | Type | Description |
Success | String | Whether or not the schema was created successfully. |
SchemaFile | String | The generated schema file. |
FileData | String | The schema's data in BASE64 encoding. Only used if WriteToFile is set to 'False' and FileStream is not set. |