Google BigQuery Sink Connector for Confluent Cloud

Note

If you are installing the connector locally for Confluent Platform, see Google BigQuery Sink Connector for Confluent Platform.

The Google BigQuery Sink Connector is used to stream data into BigQuery tables. The BigQuery table schema is based upon information in the Apache Kafka® schema for the topic.

Features

  • The connector supports insert operations and attempts to detect duplicates. See BigQuery troubleshooting for additional information.
  • The connector uses the BigQuery insertAll streaming api, which inserts records one at a time. The records are immediately available in the table for querying.
  • The connector supports streaming from a list of topics into corresponding tables in BigQuery.
  • Even though the connector streams records one at a time by default (as opposed to running in batch mode), the connector is scalable because it contains an internal thread pool that allows it to stream records in parallel. The internal thread pool defaults to 10 threads.
  • The connector supports Avro and schemaless JSON (schema validation is disabled for JSON).

Refer to Cloud connector limitations for additional information.

Important

Preview connectors are not currently supported and are not recommended for production use. For specific connector limitations, see Cloud connector limitations.

Quick Start

Use this quick start to get up and running with the Confluent Cloud Google BigQuery Sink connector. The quick start provides the basics of selecting the connector and configuring it to stream events to a BigQuery data warehouse.

Prerequisites
  • An active GCP account with authorization to create resources.

  • A BigQuery project is required. The project can be created using the Google Cloud Console.

  • A BigQuery dataset is required in the project.

  • A service account that can access the BigQuery project containing the dataset. You can create this service account in the Google Cloud Console.

  • The service account must have access to the BigQuery project containing the dataset.

  • You create and download a key when creating a service account. The key can be downloaded as a JSON file. It resembles the example below:

    {
     "type": "service_account",
     "project_id": "confluent-842583",
     "private_key_id": "...omitted...",
     "private_key": "-----BEGIN PRIVATE ...omitted... =\n-----END PRIVATE KEY-----\n",
     "client_email": "confluent2@confluent-842583.iam.gserviceaccount.com",
     "client_id": "...omitted...",
     "auth_uri": "https://accounts.google.com/oauth2/auth",
     "token_uri": "https://oauth2.googleapis.com/token",
     "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/certs",
     "client_x509_cert_url": "https://www.googleapis.com/robot/metadata/confluent2%40confluent-842583.iam.gserviceaccount.com"
    }
    

    According to GCP specifications, the service account will either have to have the BigQueryEditor primitive IAM role or the bigquery.dataEditor predefined IAM role. The minimum permissions are:

    bigquery.datasets.get
    bigquery.tables.create
    bigquery.tables.get
    bigquery.tables.getData
    bigquery.tables.list
    bigquery.tables.update
    bigquery.tables.updateData
    

Additionally, make sure that either one of the following credential types is generated to use for the Kafka cluster credentials fields:

  • A Confluent Cloud API key and secret. After you have created your cluster, go to Cluster settings > API access > Create Key.
  • A Confluent Cloud service account.

Important

A BigQuery table must exist before running this connector. Topic names are mapped to BigQuery table names. When you create the BigQuery table, make sure to enable Partitioning: Partition by ingestion time and define a schema as shown in the example below:

../../_images/ccloud-bigquery-partition-by-ingestion.png

Step 1: Launch your Confluent Cloud cluster.

See the Confluent Cloud Quick Start for installation instructions.

Step 2: Add a connector.

Click Connectors > Add connector.

../../_images/ccloud-add-connector.png

Step 3: Select your connector.

Click the Google BigQuery Sink connector icon.

Step 4: Set up the connection.

Note

Make sure you have all your prerequisites completed.

Complete the following and click Continue.

  1. Select one or more topics.
  2. Enter a Connector Name.
  3. Enter your Kafka Cluster credentials. The credentials are either the API key and secret or the service account API key and secret.
  4. Enter your BigQuery credentials. Open the JSON file you downloaded when creating the service account. Copy and paste all file contents into the credentials field.
  5. Enter your BigQuery project and datasets.
  6. Select the message format.
  7. Add the storage account name, account key, and container name.
  8. Enter the number of tasks in use by the connector. See Confluent Cloud connector limitations for additional task information.

Step 5: Launch the connector.

Verify the connection details and click Launch.

../../_images/ccloud-bigquery-launch-connector.png

Step 6: Check the connector status.

The status for the connector should go from Provisioning to Running.

../../_images/ccloud-bigquery-status.png

Step 7: Check the results in BigQuery.

  1. From the Google Cloud Console, go to your BigQuery project.
  2. Query your datasets and verify that new records are being added.

For additional information about this connector, see Google BigQuery Sink Connector for Confluent Platform. Note that not all Confluent Platform connector features are provided in the Confluent Cloud connector.