Load a Cal-Adapt SQLite database into R

ca_db_read(
  x,
  val_tbl = NULL,
  join_lookup_tbls = TRUE,
  all_tables = FALSE,
  exclude_hash_tables = TRUE
)

Arguments

x

A Cal-Adapt values remote tibble or SQLite file name

val_tbl

The name of table which contains climate data, ignored if all_tables = TRUE

join_lookup_tbls

Join lookup tables if present in the remote tibble

all_tables

Return all tables, logical

exclude_hash_tables

Exclude tables that contain search hashes, ignored if all_tables = FALSE

Value

A remote tibble with climate values if all_tables = FALSE, otherwise a list of remote tibbles if all_tables = TRUE

Details

This will 'mount' a SQLite database created by ca_getvals_db, and return a remote tibble (i.e., a tibble connected to a database). x can be either a SQLite file name or a remote tibble returned by ca_getvals_db.

val_tbl should be the name of the table in the database that contains the climate values (i.e., the same table you specified when you ran ca_getvals_db). If val_tbl = NULL and a sidecar text file for the SQLite database exists, it will search the sidecar file for the name of a values table and use the first one. if join_lookup_tbls = TRUE and lookup tables were used when fetching the data, the remote tibble returned will be based on a SQL expression that joins the lookup tables to the values table. Joining lookup tables is only possible if a sidecar text file exists.

If all_tables = TRUE, a list of remote tibbles for all the tables in the database will be returned. In this case, val_tbl and join_lookup_tbls are ignored. If exclude_hash_tables = TRUE, tables that store search hashes will be excluded in the returned list.