Learn R Programming

nodbi (version 0.10.7)

src_duckdb: Setup a DuckDB database connection

Description

Setup a DuckDB database connection

Usage

src_duckdb(drv = duckdb::duckdb(), dbdir = attr(drv, "dbdir"), ...)

Value

A nodbi source object

Arguments

drv

Object returned by duckdb()

dbdir

Location for database files. Should be a path to an existing directory in the file system. With the default (or ""), all data is kept in RAM.

...

Additional named parameters passed on to DBI::dbConnect()

Details

Uses duckdb::duckdb() as backend. nodbi creates or uses a DuckDB table, with columns _id and json created and used by package nodbi, applying SQL functions as per https://duckdb.org/docs/extensions/json to the json column. Each row in the table represents a JSON document. Any root-level _id is extracted from the document(s) and used for column _id, otherwise a UUID is created as _id. The table is indexed on _id. For a benchmark, see https://github.com/ropensci/nodbi#benchmark.

Examples

Run this code
if (FALSE) {
con <- src_duckdb()
print(con)
}

Run the code above in your browser using DataLab