| scr_connect | R Documentation |
With dsn, a thin wrapper around DBI::dbConnect() over odbc::odbc()
with one deliberate choice: bigint = "numeric". Under the odbc
default a BIGINT column arrives as integer64, and is.numeric() of an
integer64 is FALSE: typing would treat the column as a categorical of
very high cardinality. With driver, any DBI driver object is accepted
(e.g. RSQLite::SQLite(), duckdb::duckdb()), which is how the database
path is tested without a DSN.
scr_connect(dsn = NULL, driver = NULL, timeout = 20, ...)
dsn |
Name of the DSN configured on the system. Ignored when
|
driver |
Optional DBI driver object, used instead of ODBC. |
timeout |
Connection timeout in seconds (ODBC only). |
... |
Extra arguments passed on to |
A DBI connection. Close it with DBI::dbDisconnect().
Other database:
scr_fetch()
con <- scr_connect(driver = RSQLite::SQLite(), dbname = ":memory:")
d <- scr_demo; d$ref_date <- as.character(d$ref_date) # SQLite has no Date type
DBI::dbWriteTable(con, "dtm", d)
dt <- scr_fetch(con, "dtm", sample_frac = 0.5, seed = 42)
nrow(dt)
DBI::dbDisconnect(con)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.