Data Model
The CData ADO.NET Provider for YouTube Analytics models YouTube Analytics entities in relational Tables, Views, and Stored Procedures.
YouTube Analytics allows for the querying of Dimensions and Metrics in a large number of arrangements. We provide some sample views based on common YouTube Analytics reports. You can also create your own custom views based on any combination of Dimensions and Metrics you need.
For information about how to view schemas, along with API limitations and requirements, see Defining Custom Views, below.
Tables
You can access Groups and Group Items as Tables.
Stored Procedures
Stored Procedures are function-like interfaces to the data source that can be used to access additional capabilities of the YouTube Analytics API.
Views
Reports are shown as views; that is, as tables that are "snapshots" of the data, and cannot be modified. Unlike traditional database views, it is not very helpful to create a view of an entire table by selecting all metrics and dimensions in that table, because the provider interprets the SELECT * query as if you are requesting a default set of metrics and dimensions. This is also true for queries that explicitly select all columns.
Note that 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. These limitations and the default fields for each schema are listed in Views. Refer to these sections when defining your own view, as well.
Defining Custom Views
Use the CreateCustomSchema stored procedure to create a view on a query. This stored procedure provides an easy way to generate new view definitions with a custom combination of Dimensions and Metrics. Calling it creates 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. To access the script files created, you must set Location to the folder containing the new script files. In this sense, Location is a substitute for the output folder.
For example, to use a new schema along with the default schemas, set Location to the db subfolder in the installation folder and call:
EXEC CreateCustomSchema Dimensions='Day,DeviceType', Metrics='Views,EstimatedMinutesWatched', TableName='DailyDeviceReports'