Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Connecting R and BigQuery with ADBC

Instructions

Prerequisites

  1. Install R

  2. Install dbc

  3. Install Google Cloud CLI

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

  5. Install R packages adbcdrivermanager, arrow, and tibble:

    install.packages(c("adbcdrivermanager", "arrow", "tibble"))

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 bigquery
  2. Customize the R script main.R as needed

    • Change the connection arguments in adbc_database_init()
      • 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 as is to use the public Shakespeare dataset
    • If you changed the dataset, also change the SQL SELECT statement in read_adbc()
  3. Run the R script:

    Rscript main.R