From 148035566cf7adc0e2e4397431b35e6230116673 Mon Sep 17 00:00:00 2001 From: JulianUmbhau Date: Mon, 8 Sep 2025 09:15:55 +0000 Subject: [PATCH 1/2] labels added to query jobs --- R/query.R | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/R/query.R b/R/query.R index c43482b..8f6098e 100644 --- a/R/query.R +++ b/R/query.R @@ -3,6 +3,7 @@ #' @param projectId The BigQuery project ID #' @param datasetId A datasetId within projectId #' @param query BigQuery SQL. You can also supply a file location of your query ending with \code{.sql} +#' @param labels Labels to tag to job in list format. lower-case only. Default empty list #' @param maxResults Max number per page of results. Set total rows with LIMIT in your query. #' @param useLegacySql Whether the query you pass is legacy SQL or not. Default TRUE #' @param useQueryCache Whether to use the query cache. Default TRUE, set to FALSE for realtime queries. @@ -33,6 +34,7 @@ bqr_query <- function(projectId = bqr_get_global_project(), datasetId = bqr_get_global_dataset(), query, + labels = list(), maxResults = 1000, useLegacySql = TRUE, useQueryCache = TRUE, @@ -50,6 +52,7 @@ bqr_query <- function(projectId = bqr_get_global_project(), body <- list( kind = "bigquery#queryRequest", query = query, + labels = labels, maxResults = maxResults, useLegacySql = useLegacySql, useQueryCache = useQueryCache, @@ -125,6 +128,7 @@ bqr_query <- function(projectId = bqr_get_global_project(), #' @param projectId projectId to be billed. #' @param datasetId datasetId of where query will execute. #' @param query The BigQuery query as a string. +#' @param labels Labels to tag to job in list format. lower-case only. Default empty list #' @param destinationTableId Id of table the results will be written to. #' @param writeDisposition Behaviour if destination table exists. See Details. #' @param useLegacySql Whether the query you pass is legacy SQL or not. Default TRUE @@ -202,6 +206,7 @@ bqr_query <- function(projectId = bqr_get_global_project(), bqr_query_asynch <- function(projectId = bqr_get_global_project(), datasetId = bqr_get_global_dataset(), query, + labels = list(), destinationTableId, useLegacySql = TRUE, writeDisposition = c("WRITE_EMPTY", @@ -239,7 +244,8 @@ bqr_query_asynch <- function(projectId = bqr_get_global_project(), query = query, useLegacySql = useLegacySql, writeDisposition = writeDisposition - ) + ), + labels = labels ) ) From 4bb39637ee0caae66758244fae02e02f862bde6f Mon Sep 17 00:00:00 2001 From: JulianUmbhau Date: Mon, 8 Sep 2025 09:19:10 +0000 Subject: [PATCH 2/2] documentation --- DESCRIPTION | 2 +- man/bigQueryR.Rd | 10 ++++++++++ man/bqr_query.Rd | 3 +++ man/bqr_query_asynch.Rd | 3 +++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 454d847..3301c2a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -28,5 +28,5 @@ Suggests: testthat, data.table, purrr -RoxygenNote: 7.1.1 +RoxygenNote: 7.3.1 VignetteBuilder: knitr diff --git a/man/bigQueryR.Rd b/man/bigQueryR.Rd index 9f2370f..cef19b9 100644 --- a/man/bigQueryR.Rd +++ b/man/bigQueryR.Rd @@ -2,6 +2,7 @@ % Please edit documentation in R/bigQueryR.R \docType{package} \name{bigQueryR} +\alias{bigQueryR-package} \alias{bigQueryR} \title{bigQueryR} \description{ @@ -10,3 +11,12 @@ Provides an interface with Google BigQuery \seealso{ \url{https://cloud.google.com/bigquery/docs/reference/v2/?hl=en} } +\author{ +\strong{Maintainer}: Mark Edmondson \email{r@sunholo.com} + +Other contributors: +\itemize{ + \item Hadley Wickham \email{hadley@rstudio.com} [contributor] +} + +} diff --git a/man/bqr_query.Rd b/man/bqr_query.Rd index 13198e3..d5ebcdf 100644 --- a/man/bqr_query.Rd +++ b/man/bqr_query.Rd @@ -8,6 +8,7 @@ bqr_query( projectId = bqr_get_global_project(), datasetId = bqr_get_global_dataset(), query, + labels = list(), maxResults = 1000, useLegacySql = TRUE, useQueryCache = TRUE, @@ -22,6 +23,8 @@ bqr_query( \item{query}{BigQuery SQL. You can also supply a file location of your query ending with \code{.sql}} +\item{labels}{Labels to tag to job in list format. lower-case only. Default empty list} + \item{maxResults}{Max number per page of results. Set total rows with LIMIT in your query.} \item{useLegacySql}{Whether the query you pass is legacy SQL or not. Default TRUE} diff --git a/man/bqr_query_asynch.Rd b/man/bqr_query_asynch.Rd index 03804bf..80149c4 100644 --- a/man/bqr_query_asynch.Rd +++ b/man/bqr_query_asynch.Rd @@ -8,6 +8,7 @@ bqr_query_asynch( projectId = bqr_get_global_project(), datasetId = bqr_get_global_dataset(), query, + labels = list(), destinationTableId, useLegacySql = TRUE, writeDisposition = c("WRITE_EMPTY", "WRITE_TRUNCATE", "WRITE_APPEND") @@ -20,6 +21,8 @@ bqr_query_asynch( \item{query}{The BigQuery query as a string.} +\item{labels}{Labels to tag to job in list format. lower-case only. Default empty list} + \item{destinationTableId}{Id of table the results will be written to.} \item{useLegacySql}{Whether the query you pass is legacy SQL or not. Default TRUE}