The function odm_write can be used to get data into the DataValues table in an ODM database. odm_write takes a dataframe containing the required columns for working with ODM data and loads it. The dataframes will either have been acquired using odm_read or created using odm_data.

odm_write(Data, qc_check = 1, channel = ODM, batch_size = 1000,
  check_before_load = TRUE)

Arguments

Data

containing the required columns

qc_check

must match the quality control level of the data to be loaded

channel

connection handle as returned by odbcConnect

batch_size

data is sent in small chunks to the database. This setting decides the size of those chunks.

check_before_load

will let you know what data you are about to load to the database. You can turn this behavior off by setting this to FALSE.

Details

A standard SQL query is issued to the ODM database and the values are uploaded in 1000 row chunks. QClevel 1 data is handled by default but data containing any QClevel data can be used by setting the argument to the appropriate value.

Examples

if (FALSE) { # Establish connection with database ODM <- odbc::dbConnect(odbc::odbc(), dsn = "ODM", database = "OD", UID = "update", PWD = rstudioapi::askForPassword("Database password"), Port = 1433) # Query the database tmp <- odm_read(site_id = 1, variable_id = 1, method_id = 9, level_id = 0, start_date = "2013-06-01", end_date = "2013-07-01") # Load values back to ODM odm_write(Data = tmp, qc_check = 0) }