bduk_bq: Runs a query in BigQuery and loads the data into R.

Description Usage Arguments Value Examples

View source: R/bduk_bq.R

Description

This function loads a BigQuery into a data table. This requires both a billing string and a json key to be installed. The json key must be in the same directory/project as you are working within.

Usage

1
bduk_bq(sql, project, key = NULL, keypath = NULL)

Arguments

sql

SQL code to be queried

project

The name of the bigquery project that the data is stored within. Unless otherwise specified, the key will be the name of this concatenated with "_bigquery.json".

key

The name of the BigQuery key used for billing

keypath

The path to the folder that contains the key. By default, this will be the current directory, and it is recommended the key is stored here.

Value

A data table containing the query results.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
bduk_bq(
 sql="SELECT pcds,Rurality FROM `dcms-datalake-staging.GEO_ONS.ONS_RURALITY` LIMIT 1 ",
 project="dcms-datalake-staging"
)
bduk_bq(
 sql="SELECT pcds,Rurality FROM `dcms-datalake-staging.GEO_ONS.ONS_RURALITY` LIMIT 1 ",
 project="dcms-datalake-staging",
 key="dcms-datalake-staging_bigquery.json",
 keypath="/home/dcms/keys"
)

SamA-DS/Rbduk documentation built on May 1, 2021, 5:29 a.m.