Defines functions storeMetaChunkWise

Documented in storeMetaChunkWise

#' Store Meta Information Chunk Wise to Avoid Memory Problem
#' This function is a wrapper around \code{\link{updateMetaInformation}}. It is used to split large environments of meta info
#' to avoid memory limitations. This function uses INSERT INTO instead of the more convenient dbWritetable for performance reasons. DO NOT USE THIS FUNCTIONS IN LOOPS OR LAPPLY! This function can handle a set of time series on its own and is much faster than looping over a list. Non-unique primary keys are overwritten !
#' @param meta_envir object of class meta_env. Most likely
#' generated by \code{\link{addMetaInformation}}
#' @param con a PostgreSQL connection object
#' @param schema character name of the schema to write to. Defaults to 'timeseries'.
#' @param tbl character name of the meta information table to write to. 
#' Defaults to 'meta_data_unlocalized'.
#' @param keys character vector of time series. If specified only the selected 
#' meta information is stored. Defaults to NULL which stores all meta information
#' records in the environment.
#' @param chunksize integer number of chunks. Defaults to NULL which automatically choose chunks based
#' on Cstack size.
#' @param quiet logical should the update function be quiet? Defaults to TRUE.  
#' @export
storeMetaChunkWise <- function(meta_envir,con,
                               schema = "timeseries",
                               tbl = "meta_data_unlocalized",
                               chunksize = NULL,
                               quiet = T){
  warning("chunkwise storage is deprecated. Simply use updateMetaInformation,
          which capable of COPY-based bulk inserts now.")
    updateMetaInformation(meta = meta_envir,
                          con = con,
                          schema = schema, 
                          tbl = tbl, 
                          keys = ls(envir = meta_envir),
                          quiet = quiet)
mbannert/timeseriesdb documentation built on Feb. 28, 2019, 5:11 p.m.