update_db: Update tables in stock database with new data

Description Usage Arguments Details Value Functions See Also

Description

Generic function to update tables in stock database by importing new data

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
update_db(
  stock_db,
  data_source = get_datasource(stock_db),
  retry_log = NULL,
  log_file_prefix = "update_db_log",
  log_dir = "./log",
  ...
)

## S4 method for signature 'gta_db'
update_db(
  stock_db,
  data_source = get_datasource(stock_db),
  retry_log = NULL,
  log_file_prefix = "update_db_log",
  log_dir = "./log",
  ...
)

Arguments

stock_db

A stock database object to operate.

data_source

Data source info produced by get_datasource(stock_db)

retry_log

Log file for re-importing tables with recording failure in log file. If NULL, it will update all tables in data_source, otherwise only update on these tables with recording failure in log file. By default NULL.

log_file_prefix

A character of log file prefix to name log file. Log file is named as format of "log_file_prefix_XXXX_(current).csv" Default is "update_db_log".

log_dir

Path to save updating log file. NULL means to use "./" as log dir. Default "./log".

...

Extra arguments to be passed to methods.

Details

By combining information from data_source and re-try log file , it update all tables from raw data of datasource in following steps:

  1. Build target tables info from all tables in datasource or some tables with recording failure in retry log file;

  2. Update target tables by importing data from datasource;

  3. Save update log, etc.

Update log is saved in log dir, like "update_log_XXXX(current).csv"

Value

NULL invisibly. Raise error if anything goes wrong.

Functions

See Also

Other data management: clear_tables(), convert_import_file(), get_datasource(), import_table(), process_files(), read_import_file(), ttm_financial_report(), write_import_file()


chriszheng2016/zstmodelr documentation built on June 13, 2021, 8:59 p.m.