Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Connecting C++ and BigQuery with ADBC

Instructions

Prerequisites

  1. Install Pixi

  2. Install dbc

  3. Install Google Cloud CLI

  4. Create a Google account or be able to log in to an existing one

Set up BigQuery

  1. Log into the Google Cloud Console and create project or locate an existing project and record the project ID for use in a later step

  2. Run this command in your terminal to log in with the Google Cloud CLI:

    gcloud auth application-default login

Connect to BigQuery

  1. Install the BigQuery ADBC driver:

    dbc install --level user bigquery
  2. Customize the C++ program main.cpp as needed

    • Change the connection arguments in the AdbcDatabaseSetOption() calls
      • Change the value of the adbc.bigquery.sql.project_id argument to match the project ID you recorded in the earlier step
      • Change the value of adbc.bigquery.sql.dataset_id, or keep it to use the public Shakespeare dataset
    • If you changed the dataset, also change the SQL SELECT statement in AdbcStatementSetSqlQuery()
  3. Build and run the C++ program:

    Using Make:

    pixi run make
    ./bigquery_demo

    Or using CMake:

    pixi run cmake -B build
    pixi run cmake --build build
    ./build/bigquery_demo

Clean up

  1. Clean build artifacts:

    Using Make:

    pixi run make clean

    Using CMake:

    rm -rf build