The CData Cmdlets PowerShell Module for YouTube Analytics models YouTube Analytics entities in relational Tables, Views, and Stored Procedures. YouTube Analytics allows for Dimensions and Metrics to be queried in a large number of arrangements. Some sample views are provided based on common YouTube Analytics reports. You can however also create your own custom views based on any combination of Dimensions and Metrics you need.
Creating view schemas as well as API limitations and requirements are documented in this section.
You can access Groups and Group Items as Tables.
Stored Procedures are function-like interfaces to the data source. They can be used to access additional capabilities of the YouTube Analytics API.
Reports are shown as views, tables that cannot be modified. Unlike traditional database views, however, it is not very helpful to select all metrics and dimensions in a given table. The provider thus interprets the SELECT * query to mean a default set of metrics and dimensions are requested. This includes queries that explicitly select all columns.
Additionally, the YouTube Analytics API limits the number and combinations of columns that can be projected over the data or used to restrict the results returned. You can find these limitations and the default fields for each schema in Views. Refer to these sections when defining your own view, as well.
Defining Custom Views
To create a view on a query, you can use the CreateCustomSchema stored procedure. The CreateCustomSchema stored procedure provides an easy way to generate new view definitions with a custom combination of Dimensions and Metrics. Calling it will create a new schema file that you can query like any other view.
The stored procedure takes a view name, a comma-separated list of metrics, a comma-separated list of dimensions, and an output folder as inputs. You will need to set the Location connection property to the folder containing the new script files in order to access them; the Location can be set instead of the output folder.
For example, to use a new schema along with the default schemas, set the Location property to the db subfolder in the installation folder and make the following call:
EXEC CreateCustomSchema Dimensions='Day,DeviceType', Metrics='Views,EstimatedMinutesWatched', TableName='DailyDeviceReports'