Download a table using a single connection
simple_download.RdSimple single-threaded download of a table, optionally filtered by year. Useful for small tables or environments where parallel connections are not available.
Usage
simple_download(
table,
year_col = NULL,
schema = "llds",
years = NULL,
con = NULL,
connection_args = list()
)Arguments
- table
Character. Table name.
- year_col
Character or NULL. Name of the year column for filtering. If NULL, the entire table is downloaded.
- schema
Character. Schema name. Default: "llds".
- years
Integer vector or NULL. Years to download. If NULL (default) and
year_colis provided, all years are downloaded. If bothyear_colandyearsare NULL, the full table is downloaded.- con
A DBI connection object or NULL. If provided, this connection is used directly and the caller is responsible for managing the connection lifecycle. If NULL (default), a connection is created internally using
connection_argsand disconnected on exit.- connection_args
List. Additional arguments passed to
create_connection()whenconis NULL. Default: list().
Examples
if (FALSE) { # \dontrun{
# Download an entire small table
ref <- simple_download(table = "LLDS_SOME_REF_TABLE")
# Download specific years
hdr <- simple_download(
table = "LLDS_HDR_20240315HAC",
year_col = "LANDYR",
years = 2020:2023
)
# Download using a provided connection (e.g., DSN connection)
con <- create_dsn_connection("PIRO LOTUS")
catch <- simple_download(
table = "LDS_CATCH_V",
schema = "newobs",
con = con
)
DBI::dbDisconnect(con)
} # }