I have created a simply Shiny application that connects to my database and produces a table given an SQL query:
ui <- fluidPage(
textAreaInput("query", "SQL query"),
actionButton("submit", "Submit query"),
dataTableOutput("queryResults")
)
server <- function(input, output, session) {
json="path/to/servicetoken.json"
bigrquery::bq_auth(path = json)
con <- DBI::dbConnect(
bigrquery::bigquery(),
project = "projectid",
dataset="dataset",
billing="projectid"
)
query <- eventReactive(input$submit, input$query)
output$queryResults <- renderDataTable({
query <- query()
DBI::dbGetQuery(con, query)
})
}
shinyApp(ui, server, ...)
This works great for just me. Every query sent to BigQuery bills me. However, what I would ideally like to do is bill those making the query. What is the best way to bill another Google user running queries via my Shiny application?