bigrquery v0.4.1

0

Monthly downloads

0th

Percentile

by Hadley Wickham

An Interface to Google's 'BigQuery' 'API'

Easily talk to Google's 'BigQuery' database from R.

Readme

bigrquery

Build Status

The bigrquery packages provides an R interface to Google BigQuery. It makes it easy to retrieve metadata about your projects, datasets, tables and jobs, and provides a convenient wrapper for working with bigquery from R.

Installation

The current bigrquery release can be installed from CRAN:

install.packages("bigrquery")

The newest development release can be installed from github:

# install.packages('devtools')
devtools::install_github("rstats-db/bigrquery")

Authentication

The first time you use bigrquery in a session, it will ask you to authorize bigrquery in the browser. This gives bigrquery the credentials to access data on your behalf. By default, bigrquery picks up httr's policy of caching per-working-directory credentials in .httr-oauth.

Note that bigrquery requests permission to modify your data; in general, the only data created or modified by bigrquery are the temporary tables created as query results, unless you explicitly modify your own data (say by calling delete_table() or insert_upload_job()).

Sample data and a billing project

If you just want to play around with the bigquery API, it's easiest to start with the Google's free sample data. To do that, you'll also need to create your own project for billing purposes. If you're just playing around, it's unlikely that you'll go over the 10,000 request/day free limit, but google still needs a project that it can bill (you don't even need to provide a credit card).

To create a project:

  1. Open https://console.cloud.google.com/
  2. Click "Create Project" at the top
  3. Select a name and project ID, and click "Create"
  4. Turn on the BigQuery API by clicking "APIs & Auth" on the left, scrolling down to "BigQuery API", and clicking the button at the right from "OFF" to "ON".
  5. Click on "Overview" at the left
  6. Use the Project ID or Project Number to identify your project with bigrquery. (You can also use the project number, though it's harder to remember.)

To run your first query:

library(bigrquery)
project <- "fantastic-voyage-389" # put your project ID here
sql <- "SELECT year, month, day, weight_pounds FROM [publicdata:samples.natality] LIMIT 5"
query_exec(sql, project = project)

Functions in bigrquery

Name Description
DBI DBI methods
bigrquery-package bigrquery: An Interface to Google's 'BigQuery' 'API'
format_dataset Format dataset and project ID as a BQ-style identifier
format_table Format dataset, project and table ID as a BQ-style identifier
delete_dataset Deletes an existing dataset in a project
delete_table Delete a table.
dbi_driver BigQuery DBI driver
get_access_cred Get and set access credentials
get_dataset Gets an existing dataset in a project
list_projects List all projects to which you have been granted any project role.
list_tabledata Retrieve data from a table.
parse_table Parse a BQ-style identifier into project/dataset/table IDs
copy_table Copy one or more source tables to a destination table.
query_exec Run a asynchronous query and retrieve results.
get_job Check status of a job.
get_table Retrieve table metadata
list_tables List available tables in dataset.
parse_dataset Parse a BQ-style identifier into project/dataset IDs
insert_upload_job Upload data.
list_datasets List the datasets in a project
wait_for Wait for a job to complete, optionally printing updates
insert_query_job Create a new query job.
insert_table Insert empty table
src_bigquery A bigquery data source.
update_dataset Updates an existing dataset in a project
insert_dataset Creates a new dataset in a project
insert_extract_job Create a new extract job.
No Results!

Last month downloads

Details

License GPL-3 | file LICENSE
LazyData true
RoxygenNote 6.0.1
URL https://github.com/rstats-db/bigrquery
BugReports https://github.com/rstats-db/bigrquery/issues
Collate 'auth.r' 'bigrquery.r' 'camelCase.R' 'datasets.r' 'dbi-driver.r' 'dbi-connection.r' 'dbi-result.r' 'dplyr-compat.R' 'dplyr.r' 'id.R' 'job-extract.R' 'job-query.R' 'job-upload.r' 'jobs.r' 'projects.r' 'query.r' 'request.r' 'tabledata.r' 'tables.r' 'utils.r' 'zzz.r'
NeedsCompilation yes
Packaged 2017-06-26 21:58:50 UTC; hadley
Repository CRAN
Date/Publication 2017-06-26 22:16:13 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/bigrquery)](http://www.rdocumentation.org/packages/bigrquery)