C3 AI Documentation Home

BigQuery Output Node

Output data from Visual Notebooks to BigQuery. You must have a Google Cloud account with access to BigQuery to use this node. To learn more about BigQuery, see https://cloud.google.com/bigquery.

Prerequisites

You must add a Google Cloud "service account JSON key" to Visual Notebooks before using the BigQuery node. Follow the steps below to generate this key and add it to Visual Notebooks. For more information about service account JSON keys, see the Google Cloud documentation.

  1. Log into the Google Cloud Platform
  2. Select the hamburger menu in the top left corner, then select IAM & Admin > Service Accounts Google Cloud IAM menu
  3. Select Create Service Account near the top of the page Create service account button
  4. Enter a service account name. This will auto-generate a service account ID Service account details
  5. Select Create and Continue
  6. Add the following roles:
    1. BigQuery > BigQuery Data Editor
    2. BigQuery > BigQuery Data Viewer
    3. BigQuery > BigQuery Job User
    4. BigQuery > BigQuery Read Session User
    5. Cloud Storage > Storage Object Admin
    6. Cloud Storage > Storage Object Viewer BigQuery roles
  7. Select Done
  8. Select the three vertical dots under Actions, then Manage keys Manage service account keys
  9. Select Add Key > Create New Key Create new key
  10. Check that JSON is selected, then select Create Select JSON key type
  11. Open the file that automatically downloads and copy the content Copy JSON key content
  12. Drag a BigQuery node onto the Visual Notebooks workspace
  13. Select the gear icon beside the Credential field BigQuery credential settings
  14. Select the plus sign in the upper right corner Add new BigQuery credential
  15. Enter a name for the credentials
  16. Paste the contents of the downloaded file into the Service Account JSON Key field Configure BigQuery credentials

Configuration

BigQuery configuration options

FieldDescription
Name OptionalName of the node An optional user-specified node name displayed in the workspace, both on the node and in the dataframe as a tab.
Credential RequiredThe information needed to access BigQuery data Select a saved credential from the dropdown menu. Select the gear icon to add a new credential or delete existing credentials.
Project ID RequiredThe name of the desired BigQuery project Enter the name of the desired project.
Dataset ID RequiredThe unique ID of the desired BigQuery dataset Enter the dataset ID for the desired dataset.
Table RequiredA name to give the data Enter a name to save the data as in BigQuery
Save Mode Default: OverwriteDuplicate data strategy Specify how to save the data from Visual Notebooks if a table with the given name already exists in BigQuery. Select Append to add the new data at the end of the preexisting BigQuery table. Select Overwrite to replace the preexisting table with the new data. Select Error If Exists to show an error if a table with the same name already exists in BigQuery. Select Ignore to keep the preexisting table and ignore the request to save the new data.
Bucket RequiredThe name of the Google Cloud Storage bucket Enter the name of an existing Cloud Storage bucket. For more information about buckets, see the Google Cloud documentation.

Node Inputs/Outputs

InputA Visual Notebooks dataframe
OutputNone

Example BigQuery output

Figure 1: Example output

Examples

Follow the steps below to save data from Visual Notebooks to BigQuery.

  1. Connect a BigQuery output node to an existing node.
  2. Select the saved credentials used to access BigQuery. If you have not yet saved credentials, follow the steps in the Prerequisites section above.
  3. Enter the name of the BigQuery project ID and dataset ID where you would like to save the data.
  4. Enter a name for the data in the Table field. Note that if a table with the same name already exists in BigQuery, the preexisting table will be overwritten with the new data. Use the Save Mode field to change this behavior.
  5. Enter the name of a Google Cloud bucket to use to save the data.
  6. Select Run to save the data to BigQuery.

Although the node doesn't display any output, the data saves successfully. The data should be present in your BigQuery account.

BigQuery output configuration

Figure 2: BigQuery output node

Was this page helpful?