YouTube Channel Transfers

The BigQuery Data Transfer Service for YouTube allows you to automatically schedule and manage recurring load jobs for YouTube Channel reports.

Supported Reports

The BigQuery Data Transfer Service for YouTube Channel reports currently supports the following reporting options:

Reporting option Support
Supported API version August 10, 2017
Schedule

Daily, approximately 14:10 UTC

You can configure the time of day

Refresh window

The default value is 1 (the transfer run is scheduled for the current date). This value is not configurable.

Maximum backfill duration

Last 180 days

YouTube retains data for up to 180 days. For more information, see Backfill data in the YouTube Reporting API documentation.

Before you begin

Before you create a YouTube Channel transfer:

  • Verify that you have completed all actions required to enable the BigQuery Data Transfer Service.
  • Create a BigQuery dataset to store the YouTube data.
  • Ensure that you have the following required permissions:
    • YouTube: Owner of a YouTube channel.
    • Google Cloud Platform: bigquery.transfers.update permission. The bigquery.admin predefined IAM role includes bigquery.transfers.update permissions. For more information on IAM roles in BigQuery, see Access Control.

Setting up a YouTube Channel transfer

Setting up a YouTube Channel transfer requires a:

  • Channel Page ID: To retrieve your channel ID:
    • Open Google Plus.
    • At the top right of the window, click the account icon, and choose the account associated with your YouTube channel.
    • Retrieve the page id from the end of the URL. For example, if the URL is https://plus.google.com/b/123123123/, the page id is 123123123.
  • Table Suffix: A user-friendly name for the channel provided by you when you set up the transfer. The suffix is appended to the job ID to create the table name, for example [reportTypeId]_[suffix]. The suffix is used to prevent separate transfers from writing to the same tables. The table suffix must be unique across all transfers that load data into the same dataset, and the suffix should be short to minimize the length of the resulting table name.

If you currently use the YouTube Reporting API and have existing reporting jobs, the BigQuery Data Transfer Service loads your report data. If you do not have existing reporting jobs, setting up the transfer automatically enables YouTube reporting jobs.

To create a YouTube Channel transfer:

Web UI

  1. Go to the BigQuery web UI.

    Go to the BigQuery web UI

  2. Click Transfers.

  3. Click Add Transfer.

  4. On the New Transfer page:

    • For Source, choose YouTube Channel Reports.
    • For Destination, choose the appropriate dataset.
    • For Display Name, enter a name for the transfer such as My Transfer.
    • For Channel Page ID, enter your channel page ID.
    • For Table Suffix, enter a suffix such as MT.
    • For Schedule, leave the default value.

      Channel transfer

    • (Optional) To change the Schedule, click Edit and change the time.

      Channel transfer

  5. Click Add.

  6. When prompted, click Allow to give the BigQuery Transfer Service permission to manage your YouTube reporting data. You must allow pop-ups from bigquery.cloud.google.com to view the permissions window. If you have multiple accounts, you may be prompted to choose your account as well.

    Allow transfer

Command-line

Enter the bq mk command and supply the transfer creation flag — --transfer_config. The following flags are also required:

  • --data_source
  • --target_dataset
  • --display_name
  • --params

    bq mk --transfer_config --project_id=[PROJECT_ID] --target_dataset=[DATASET] --display_name=[NAME] --params='[PARAMETERS]' --data_source=[DATA_SOURCE]
    

Where:

  • --project_id is your project ID.
  • --target_dataset is the target dataset for the transfer configuration.
  • --display_name is the display name for the transfer configuration. The transfer name can be any value that allows you to easily identify the transfer if you need to modify it later.
  • --params contains the parameters for the created transfer configuration in JSON format. For example: --params='{"param":"param_value"}'. For YouTube Channel transfers, you must supply the page_id and table_suffix parameters.
  • --data_source is the data source — youtube_channel.

You can also supply the --project_id flag to specify a particular project. If --project_id isn't specified, the default project is used.

For example, the following command creates a YouTube Channel transfer named My Transfer using page ID 123123123, table suffix MT, and target dataset mydataset. The transfer is created in the default project:

bq mk --transfer_config --target_dataset=mydataset --display_name='My Transfer' --params='{"page_id":"123123123","table_suffix":"MT"}' --data_source=youtube_channel

API

Use the projects.locations.transferConfigs.create method and supply an instance of the TransferConfig resource.

When your data is transferred to BigQuery, the data is written to date-partitioned tables. For more information, see Partitioned Tables. If you query your tables directly instead of using the auto-generated views, you must use the _PARTITIONTIME pseudo-column in your query. For more information, see Querying Date-Partitioned Tables.

Troubleshooting YouTube Channel transfer setup

If you are having issues setting up your transfer, see YouTube transfer issues in Troubleshooting BigQuery Data Transfer Service Transfer Setup.

Send feedback about...