我正在尝试按照 Golem 的框架将 Bigquery 表中的数据读取到 Shiny App 中。
这可以通过在文件中的ui
andserver
函数之前添加以下代码来轻松完成App.R
bq_auth(path = "xxxxxxxxxxxx.json") # authenticating biqrquery with service account json file
# Establishing connection
con <- dbConnect(
bigrquery::bigquery(),
project = "project id",
dataset = "dataset name",
billing = "project id"
)
但是我对使用Golem
.
在这个线程之后,我在文件上创建了reactiveValue()
一个app_server.R
。
#' The application server-side
#'
#' @param input,output,session Internal parameters for {shiny}.
#' DO NOT REMOVE.
#' @import shiny
#' @import bigrquery
#' @noRd
app_server <- function( input, output, session ) {
# Your application server logic
bq <- reactiveValues()
observe({
bq$con <- dbConnect(drv = bigquery(),
project = "project_id",
dataset = "datset_id",
billing = "project_id")
})
}
我也导入bigrquery
了,但这似乎破坏了一些东西,因为现在我在运行时收到以下错误run_dev.R
:
> golem::document_and_reload()
Loading Dashboard
Error : object ‘DBI’ is not exported by 'namespace:bigrquery'
-- Error documenting your package ----------------------------------------------------------------
>
> # Run the application
> run_app()
Error in run_app() : could not find function "run_app"