The tbl_get() function gives us the means to materialize a table that has an entry in a table store (i.e., has a table-prep formula with a unique name). The table store that is used for this can be in the form of a tbl_store object (created with the tbl_store() function) or an on-disk YAML representation of a table store (created by using yaml_write() with a tbl_store object).

Should you want a table-prep formula from a table store to use as a value for read_fn (in create_agent(), create_informant(), or set_read_fn()), then have a look at the tbl_source() function.

tbl_get(tbl, store = NULL)

Arguments

tbl

The table to retrieve from a table store. This table could be identified by its name (e.g., tbl = "large_table") or by supplying a reference using a subset (with $) of the tbl_store object (e.g., tbl = store$large_table). If using the latter method then nothing needs to be supplied to store.

store

Either a table store object created by the tbl_store() function or a path to a table store YAML file created by yaml_write().

Value

A table object.

Function ID

1-10

See also

Examples

if (interactive()) {

# Define a `tbl_store` object by adding
# table-prep formulas in `tbl_store()`
tbls <- 
  tbl_store(
    small_table_duck ~ db_tbl(
      table = small_table,
      dbname = ":memory:",
      dbtype = "duckdb"
    ),
    ~ db_tbl(
      table = "rna",
      dbname = "pfmegrnargs",
      dbtype = "postgres",
      host = "hh-pgsql-public.ebi.ac.uk",
      port = 5432,
      user = I("reader"),
      password = I("NWDMCE5xdipIjRrp")
    ),
    all_revenue ~ db_tbl(
      table = file_tbl(
        file = from_github(
          file = "all_revenue_large.rds",
          repo = "rich-iannone/intendo",
          subdir = "data-large"
        )
      ),
      dbname = ":memory:",
      dbtype = "duckdb"
    ),
    sml_table ~ pointblank::small_table
  )

# Once this object is available, you can
# check that the table of interest is
# produced to your specification
tbl_get(
  tbl = "small_table_duck",
  store = tbls
)

# An alternative method for getting the
# same table materialized is by using `$`
# to get the formula of choice from `tbls`
tbls$small_table_duck %>% tbl_get()

}