dumpDatabase: Export Database Tables to CSV Files

View source: R/dumpDatabase.R

dumpDatabaseR Documentation

Export Database Tables to CSV Files

Description

Exports all tables of a database of which the names match a given pattern to csv files.

Usage

dumpDatabase(
  db,
  pattern = "^tbl",
  target_dir = NULL,
  create_target_dir = FALSE,
  sep = ",",
  dec = ".",
  as.is = FALSE,
  qmethod = "double",
  row.names = FALSE,
  ...
)

Arguments

db

full path to database or name of ODBC data source

pattern

pattern matching names of tables to be exported. Default: "^tbl", i.e. tables starting with "tbl"

target_dir

target directory. By default a new directory is created in the same directory as mdb resides in. The new directory has the same name as the database file with dots substituted with underscores

create_target_dir

if TRUE, the target directory tdir is created if it does not exist.

sep

passed to write.table

dec

passed to write.table

as.is

passed to sqlGetResults. If TRUE (the default is FALSE), original data types are kept when the table is read into R. By default the types are converted to appropriate R data types (e.g. dates are converted from strings to date objects).

qmethod

passed to write.table

row.names

passed to write.table

...

further arguments passed to write.table


KWB-R/kwb.db documentation built on Oct. 1, 2023, 4:10 a.m.