Opens a large dataset as one or more lazy DuckDB tables. No observations
enter R memory until the query is explicitly collected with
dplyr::collect(). Related tables returned in the same catalog share one
database connection and can be joined with standard dplyr verbs.
Arguments
- name
Character. Dataset identifier. See
list_datasets()for datasets whoseaccess_modeis"query".- table
Character or
NULL. Return one table when supplied. WhenNULL, return a named catalog containing every related table.- version
Character. Immutable dataset version, or
"latest"to use the version referenced by the latest manifest.- quiet
Logical. If
TRUE, suppress informational messages.
Value
If table is supplied, a closable lazy dbplyr table. Otherwise,
a realestatebr_query_dataset catalog containing named lazy tables. Close
either result explicitly with close() when it is no longer needed.
See also
get_dataset() for datasets returned directly in memory.
Examples
if (FALSE) { # interactive()
cno <- query_dataset("cno")
on.exit(close(cno))
constructions_sp <- cno$constructions |>
dplyr::filter(.data$state == "SP")
result <- constructions_sp |>
dplyr::inner_join(cno$areas, by = "cno") |>
dplyr::collect()
}