neon_db {neonstore}R Documentation

Cache-able duckdb database connection

Description

Cache-able duckdb database connection

Usage

neon_db(
  dir = neon_db_dir(),
  read_only = TRUE,
  memory_limit = getOption("duckdb_memory_limit", NA),
  ...
)

Arguments

dir

Location where files should be downloaded. By default will use the appropriate applications directory for your system (see tools::R_user_dir()). This default also be configured by setting the environmental variable NEONSTORE_HOME, see Sys.setenv or Renviron.

read_only

allow concurrent connections by enforcing read_only. See details.

memory_limit

Set a memory limit for duckdb, in GB. This can also be set for the session by using options, e.g. options(duckdb_memory_limit=10) for a limit of 10GB. On most systems duckdb will automatically set a limit to 80% of machine capacity if not set explicitly.

...

additional arguments to dbConnect

Details

Creates a connection to a permanent duckdb database instance in the provided directory (see neon_dir()). This connection is also cached, so that code which repeatedly calls ⁠[neon_db]⁠ will not stall or hang. Only read_only connections will be cached.

NOTE: ⁠[duckdb::duckdb()]⁠ can only support a single read-write connection at a time. The default option of read_only = TRUE allows multiple connections. ⁠[neon_store()]⁠ will automatically set this to FALSE to allow data import.

Examples


# tempfile used for illustration only
neon_db(tempfile())


[Package neonstore version 0.5.1 Index]