Description
Database Connection Management and Utilities for 'dbverse'.
Description
Provides an R6-based project container for managing 'DuckDB' connections, reconnecting lazy database tables after session restarts, and storing metadata for database-backed objects used by packages in the 'dbverse'. The package supplies S4 base classes and generics for database-backed data, helpers for validating 'DuckDB' connections and table names, utilities for creating persistent database views, and methods for writing and restoring pinned lazy tables through the 'pins' package. These tools help package authors and analysts keep database paths, cached connections, and table references synchronized across interactive sessions and project directories.
README.md
dbProject
The goal of dbProject is to manage dbData objects and database connections in the dbverse ecosystem.
Installation
You can install the development version of dbProject like so:
pak::pak("dbverse-org/dbproject-r")
Example
This is a basic example which shows you how to solve a common problem:
library(dbProject)
project_dir <- tempfile("dbproject_demo")
project <- dbProject$new(path = project_dir)
con <- project$get_conn()
DBI::dbWriteTable(con, "mtcars", mtcars)
DBI::dbReadTable(con, "mtcars")
project$disconnect()
unlink(project_dir, recursive = TRUE)