dbImport: Import tabular data into SQL

View source: R/db.R

dbImportR Documentation

Import tabular data into SQL

Description

Create SQL tables from data.table, data.frame, or flat files.

Usage

dbImport(
  conn,
  table,
  name = NULL,
  pattern = "\\.(rds|csv|gz)$",
  index = NULL,
  overwrite = FALSE,
  verbose = TRUE,
  na.strings = "",
  ...
)

Arguments

conn

a DBIConnection object, as returned by dbConnect.

table

data.table, data.frame, path to a tabular data file, or path to the directory containing tabular data files.

name

table name. Used only when data is a data.table or path to file.

pattern

an optional regular expression. Only file names into the data folder which match the regular expression will be used.

index

character vector of column names to use as index.

overwrite

if TRUE, an existing table of the same name will be overwritten. This argument doesn't change behavior if the table does not exist yet.

verbose

if TRUE, print on progress.

na.strings

a character vector of strings which are to be interpreted as NA values by fread.

...

additional arguments passed to fread.

Value

NULL

Examples

## Not run: 
library(RSQLite)
conn <- dbConnect(RSQLite::SQLite(), "crsp.db")
path <- "path/to/crsp/sazYYYYMM_r"
dbInit(conn, path)

## End(Not run)


eguidotti/eap documentation built on Sept. 4, 2024, 3:43 a.m.