Creates a caching system using temporary tables in DuckDB. This checks if a table exists and creates it as a temp table if it does not, or can recalculate if it does.
Arguments
- .data
A tibble or dataframe-like object that can be inserted into DuckDB.
- con
A DuckDB connection.
- tbl_name
The name for the temporary table.
- overwrite
A logical whether to overwrite an existing temporary table.
- quiet
Suppress information messages. The default is true and this does not stop any errors/warnings, only messages which inform the user on what is happening.
Value
A lazy table from DuckDB and dplyr::tbl()
, invisibly.
Details
This allows you to cache a calculation in DuckDB and retrieve it later
without inserting a check to calculate or to pull the existing. When
inserting the table must be materialized. You can't cache the result of
dplyr::tbl()
until you dplyr::collect()
it.
This function may change or go away if/when {duckplyr}
becomes more
friendly.