Stores one or more time series to the database.
db_ts_store(
con,
x,
access = NULL,
valid_from = NULL,
release_date = NULL,
pre_release_access = NULL,
schema = "timeseries"
)
RPostgres connection object.
Object containing time series to store. Single ts or xts objects are allowed as well as objects of type list, tslist, and data.table.
character Access level for all ts to be stored. If set to NA (default) the database set it to 'main' access.
character representation of a date in the form of 'YYYY-MM-DD'. valid_from starts a new version
character date from which on this version of the time series should be made available when release date is respected. Applies to all time series in x.
character Only allow access to the series being stored ahead of the release date to users with this access level. NULL (default) allows everybody. See respect_release_date in db_ts_read
.
character name of the database schema. Defaults to 'timeseries'
Other time series functions:
db_collection_read_ts()
,
db_dataset_read_ts()
,
db_ts_delete_latest_version()
,
db_ts_delete()
,
db_ts_get_last_update()
,
db_ts_read_history()
,
db_ts_read()
,
db_ts_trim_history()
if (FALSE) {
# storing zrh_airport data that is a list with two xts objects.
db_ts_store(con = connection, zrh_airport, schema = "schema")
# to store different versions of the data, use parameter valid_from
# different versions are stored with the same key
ch.kof.barometer <- kof_ts["baro_2019m11"]
names(ch.kof.barometer) <- c("ch.kof.barometer")
db_ts_store(
con = connection,
ch.kof.barometer,
valid_from = "2019-12-01",
schema = "schema"
)
ch.kof.barometer <- kof_ts["baro_2019m12"]
names(ch.kof.barometer) <- c("ch.kof.barometer")
db_ts_store(
con = connection,
ch.kof.barometer,
valid_from = "2020-01-01",
schema = "schema"
)
}