Returns a data frame describing the columns of a database table.
Usage
schema_from_db(conn, table, level = c("medium", "low", "high"))
Examples
if (requireNamespace("DBI", quietly = TRUE) &&
requireNamespace("RSQLite", quietly = TRUE)) {
con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
on.exit(DBI::dbDisconnect(con), add = TRUE)
DBI::dbWriteTable(con, "mtcars", mtcars[1:3, ])
sc <- schema_from_db(con, "mtcars")
head(sc)
}
#> name type nullable sensitive
#> 1 mpg numeric TRUE FALSE
#> 2 cyl numeric TRUE FALSE
#> 3 disp numeric TRUE FALSE
#> 4 hp numeric TRUE FALSE
#> 5 drat numeric TRUE FALSE
#> 6 wt numeric TRUE FALSE