Write an entire schema or a subset of tables within a schema to a csv for each table to the given path. The csvs are named according to the source table name.

write_schema_to_csvs(
  conn,
  schema,
  ...,
  path = getwd(),
  na = "NA",
  append = FALSE,
  col_names = !append,
  quote_escape = "double",
  eol = "\n"
)

Arguments

conn

Connection to a Postgres database.

...

Optional. Character vectors of names of tables to export. If missing, all the tables in the given schema are exported.

path

Path to the package root that contains the data-raw/, data/, and R/ folders. `

na

String used for missing values. Defaults to NA. Missing values will never be quoted; strings with the same value as na will always be quoted.

append

If FALSE, will overwrite existing file. If TRUE, will append to existing file. In both cases, if the file does not exist a new file is created.

col_names

If FALSE, column names will not be included at the top of the file. If TRUE, column names will be included. If not specified, col_names will take the opposite value given to append.

quote_escape

[Deprecated] , use the escape argument instead.

eol

The end of line character to use. Most commonly either "\n" for Unix style newlines, or "\r\n" for Windows style newlines.