Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

query_exec

Run a asynchronous query and retrieve results deprecated


Description

Please use bq_project_query() instead.

Usage

query_exec(
  query,
  project,
  destination_table = NULL,
  default_dataset = NULL,
  page_size = 10000,
  max_pages = 10,
  warn = TRUE,
  create_disposition = "CREATE_IF_NEEDED",
  write_disposition = "WRITE_EMPTY",
  use_legacy_sql = TRUE,
  quiet = getOption("bigrquery.quiet"),
  ...
)

Arguments

query

SQL query string

destination_table

(optional) destination table for large queries, either as a string in the format used by BigQuery, or as a list with project_id, dataset_id, and table_id entries

default_dataset

(optional) default dataset for any table references in query, either as a string in the format used by BigQuery or as a list with project_id and dataset_id entries

page_size

Number of items per page.

max_pages

Maximum number of pages to retrieve. Use Inf to retrieve all pages (this may take a long time!)

warn

If TRUE, warn when there are unretrieved pages.

create_disposition

behavior for table creation. defaults to "CREATE_IF_NEEDED", the only other supported value is "CREATE_NEVER"; see the API documentation for more information

write_disposition

behavior for writing data. defaults to "WRITE_EMPTY", other possible values are "WRITE_TRUNCATE" and "WRITE_APPEND"; see the API documentation for more information

use_legacy_sql

(optional) set to FALSE to enable BigQuery's standard SQL.

...

Additional arguments passed on to the underlying API call. snake_case names are automatically converted to camelCase.

See Also

Google documentation describing asynchronous queries: https://cloud.google.com/bigquery/docs/running-queries

Google documentation for handling large results: https://cloud.google.com/bigquery/docs/writing-results

Examples

## Not run: 
project <- bq_test_project() # put your project ID here
sql <- "SELECT year, month, day, weight_pounds FROM [publicdata:samples.natality] LIMIT 5"
query_exec(sql, project = project)
# Put the results in a table you own (which uses project by default)
query_exec(sql, project = project, destination_table = "my_dataset.results")
# Use a default dataset for the query
sql <- "SELECT year, month, day, weight_pounds FROM natality LIMIT 5"
query_exec(sql, project = project, default_dataset = "publicdata:samples")

## End(Not run)

bigrquery

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

v1.3.2
GPL-3
Authors
Hadley Wickham [aut, cre] (<https://orcid.org/0000-0003-4757-117X>), Jennifer Bryan [aut] (<https://orcid.org/0000-0002-6983-2759>), Kungliga Tekniska Högskolan [ctb] (strptime implementation), The NetBSD Foundation, Inc. [ctb] (gmtime implementation), RStudio [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.