time series data.table write to db routine