createTSdbTables: Create and Remove Time Series Database Tables

Description Usage Arguments Details Value See Also

View source: R/TSsql.R


Create or remove all the TS database tables.


  createTSdbTables(con, index=FALSE)
  removeTSdbTables(con, yesIknowWhatIamDoing=FALSE, ToLower=FALSE)



A database connection object (NOT a TSconnect object).


logical to help prevent accidents.


logical to indicate if table date indexes should be added.


logical indicating if table names should be converted to lower case.


The function createTSdbTables() creates tables on the database to store time series data. Typically this is done only on initial setup, and might be done by a database administrator and not by an end user. (It is used for examples and testing but will rarely be used otherwise.) Adding date indexes (index=TRUE) will typically speed searching but may dramatically slow down writing to the database (but for small databases it will not make much difference either way).

The function removeTSdbTables removes all the TS database tables. WARNING: use these function only if you know what you are doing. They destroy the whole database and all stored series. The function removeTSdbTables needs to work around the problem that different db engines treat capitalized table names differently. For example, MySQL uses table name Meta while Posgresql converts to meta. The argument ToLower indicates if table names should be converted to lower case.

The con needs to be specified. A default con is not used on purpose to help avoid accidental use. The argument yesIknowWhatIamDoing defaults to FALSE and must be set to TRUE or the function will return an error. Beware that dropping tables will destory the integrity of the of the database, and would usually only be done when you are intializing a TS database. Database permission may also be set to prevent users from dropping tables. If that is the case, then this function will return a failure error.


logical to indicate success.

See Also

dbConnect, TSdates, TSget, TSput

TSsql documentation built on May 2, 2019, 5:20 p.m.