Package 'bigrquerystorage'

Title: An Interface to Google's 'BigQuery Storage' API
Description: Easily talk to Google's 'BigQuery Storage' API from R (<https://cloud.google.com/bigquery/docs/reference/storage/rpc>).
Authors: Bruno Tremblay [aut, cre], Google LLC [cph, fnd]
Maintainer: Bruno Tremblay <[email protected]>
License: Apache License (>= 2)
Version: 1.2.1
Built: 2024-10-18 12:33:26 UTC
Source: CRAN

Help Index


bigrquerystorage: An Interface to Google's 'BigQuery Storage' API

Description

Easily talk to Google's 'BigQuery Storage' API from R (https://cloud.google.com/bigquery/docs/reference/storage/rpc).

Author(s)

Maintainer: Bruno Tremblay [email protected]

Other contributors:

  • Google LLC [copyright holder, funder]

See Also

Useful links:


Initialize bigrquerystorage client

Description

Initialize bigrquerystorage client

Close bigrquerystorage client

Usage

bqs_auth()

bqs_deauth()

Details

Will attempt to reuse bigrquery credentials.

About Credentials

If your application runs inside a Google Cloud environment that has a default service account, your application can retrieve the service account credentials to call Google Cloud APIs. Such environments include Compute Engine, Google Kubernetes Engine, App Engine, Cloud Run, and Cloud Functions. We recommend using this strategy because it is more convenient and secure than manually passing credentials.

Additionally, we recommend you use Google Cloud Client Libraries for your application. Google Cloud Client Libraries use a library called Application Default Credentials (ADC) to automatically find your service account credentials. ADC looks for service account credentials in the following order:

  1. If the environment variable GOOGLE_APPLICATION_CREDENTIALS is set, ADC uses the service account file that the variable points to.

  2. If the environment variable GOOGLE_APPLICATION_CREDENTIALS isn't set, ADC uses the default service account that Compute Engine, Google Kubernetes Engine, App Engine, Cloud Run, and Cloud Functions provide.

  3. If ADC can't use either of the above credentials, an error occurs.

Value

No return value, called for side effects.


Download table data

Description

This retrieves rows block in a stream using a grpc protocol. It is most suitable for results of larger queries (>100 MB, say).

Usage

bqs_table_download(
  x,
  parent = getOption("bigquerystorage.project", ""),
  snapshot_time = NA,
  selected_fields = character(),
  row_restriction = "",
  sample_percentage,
  n_max = Inf,
  quiet = NA,
  as_tibble = lifecycle::deprecated(),
  bigint = c("integer", "integer64", "numeric", "character"),
  max_results = lifecycle::deprecated()
)

Arguments

x

Table reference ⁠{project}.{dataset}.{table_name}⁠

parent

Used as parent for CreateReadSession. grpc method. Default is to use option bigquerystorage.project value.

snapshot_time

Table modifier ⁠snapshot time⁠ as POSIXct.

selected_fields

Table read option selected_fields. A character vector of field to select from table.

row_restriction

Table read option row_restriction. A character. SQL text filtering statement.

sample_percentage

Table read option sample_percentage. A numeric ⁠0 <= sample_percentage <= 100⁠. Not compatible with row_restriction.

n_max

Maximum number of results to retrieve. Use Inf or -1L retrieve all rows.

quiet

Should information be printed to console.

as_tibble

Should data be returned as tibble. Default (FALSE) is to return as arrow Table from raw IPC stream.

bigint

The R type that BigQuery's 64-bit integer types should be mapped to. The default is "integer" which returns R's integer type but results in NA for values above/below +/- 2147483647. "integer64" returns a bit64::integer64, which allows the full range of 64 bit integers.

max_results

Deprecated

Details

More details about table modifiers and table options are available from the API Reference documentation. (See TableModifiers and TableReadOptions)

Value

This method returns a data.frame or optionally a tibble. If you need a data.frame, leave parameter as_tibble to FALSE and coerce the results with as.data.frame().