run_query: Convenience method to execute a SQL query optionally...

Description Usage Arguments Details See Also Examples

Description

This function is a wrapper for the bigrquery::bq_project_query() and bigrquery::bq_table_download() functions from the bigrquery package changing a few of the default values for parameters. See the documentation and vignettes of that package to learn how to use bigrquery. It also makes use of stringr::str_glue() to format and interpolate the SQL string passed in, if any of it needed to be interpolated using values from the global environment. See the documentation and vignettes of the stringr package for more detail.

Usage

1
run_query(query, project, page_size = 5000, max_pages = Inf)

Arguments

query

SQL query string optionally containing code to be interpolated

project

The billing project name, a string.

page_size

The number of rows returned per page. Make this smaller if you have many fields or large records and you are seeing a 'responseTooLarge' error.

max_pages

Maximum number of results to retrieve. Defaults to Inf to retrieve all rows.

Details

Troubleshooting tips

See Also

bigrquery::bq_project_query(), browseVignettes("bigrquery")

bigrquery::bq_table_download(), browseVignettes("bigrquery")

stringr::str_glue(), browseVignettes("stringr")

Examples

1
2
3
4
5
6
7
8
9
## Not run: 

BILLING_PROJECT <- 'my-cloud-project'
TABLE <- 'genomics-public-data.1000_genomes.sample_info'
df <- run_query('SELECT Sample, Gender, Super_Population FROM `{TABLE}`',
                project = BILLING_PROJECT)


## End(Not run)

nurseshealthstudy/Nurses documentation built on May 14, 2019, 3:08 a.m.