Skip to contents

Export database tables to another format such as csv

Usage

cas_export_tables(
  path = NULL,
  file_format = "csv.gz",
  tables = NULL,
  db_connection = NULL,
  disconnect_db = FALSE,
  db_folder = NULL,
  ...
)

Arguments

path

Defaults to NULL. If NULL, path is set to the project/website/export/file_format folder.

file_format

Defaults to "csv.gz", i.e. compressed csv files. All formats supported by readr::write_csv() are valid.

tables

Defaults to NULL. If NULL, all database tables are exported. If given, names of the database tables to export. See vignette("castarter-database") for details.

db_connection

Defaults to NULL. If NULL, uses local SQLite database. If given, must be a connection object or a list with relevant connection settings (see example).

disconnect_db

Defaults to TRUE. If FALSE, leaves the connection to database open.

...

Passed to cas_get_db_file().

Examples

if (FALSE) {
if (interactive) {
  cas_export_tables(file_format = "csv")
}
}