Compute a dplyr tbl SQL query into a temp table

Description

Computes a temporary table from a dplyr chain that returns an SQL query (e.g., tbl(con, table)) and returns the name of the temporary table. May be useful to create intermediate tables to reduce long queries. The temporary table will only exist for the current session and will nee to be created again a new session.

Usage

aou_compute(data, ..., con = getOption("aou.default.con"))

Arguments

data A reference to an unexecuted remote query (e.g., the result of a tbl(con, …) %>% … chain)
Other arugments passed to bigrquery::bq_table_download() when collect = TRUE
con Connection to the allofus SQL database. Defaults to getOption(“aou.default.con”), which is created automatically with aou_connect().

Details

[Experimental]

Value

A reference to a temporary table in the database.

Examples

library(allofus)



con <- aou_connect()
tmp_tbl <- dplyr::tbl(con, "concept") %>%
  dplyr::select(concept_id) %>%
  head(10) %>%
  aou_compute()

tmp_tbl