spod_connect | R Documentation |
DuckDB
or hive-style parquet
filesThis function allows the user to quickly connect to the data converted to DuckDB with the spod_convert function. This function simplifies the connection process. The user is free to use the DBI
and DuckDB
packages to connect to the data manually, or to use the arrow
package to connect to the parquet
files folder.
spod_connect(
data_path,
target_table_name = NULL,
quiet = FALSE,
max_mem_gb = max(4, spod_available_ram() - 4),
max_n_cpu = max(1, parallelly::availableCores() - 1),
temp_path = spod_get_temp_dir()
)
data_path |
a path to the |
target_table_name |
Default is |
quiet |
A |
max_mem_gb |
The maximum memory to use in GB. A conservative default is 3 GB, which should be enough for resaving the data to |
max_n_cpu |
The maximum number of threads to use. Defaults to the number of available cores minus 1. |
temp_path |
The path to the temp folder for DuckDB for intermediate spilling in case the set memory limit and/or physical memory of the computer is too low to perform the query. By default this is set to the |
a DuckDB
table connection object.
# Set data dir for file downloads
spod_set_data_dir(tempdir())
# download and convert data
dates_1 <- c(start = "2020-02-17", end = "2020-02-18")
db_2 <- spod_convert(
type = "number_of_trips",
zones = "distr",
dates = dates_1,
overwrite = TRUE
)
# now connect to the converted data
my_od_data_2 <- spod_connect(db_2)
# disconnect from the database
spod_disconnect(my_od_data_2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.