Skip to contents

Copies DuckDB tables into an OHDSI Andromeda object in chunks, so large covariate tables never have to fit in memory twice. Tables are always written through Andromeda's own interface (andromeda[[name]] <- data and Andromeda::appendToTable()), so they are visible in names(andromeda) whichever storage engine the installed Andromeda version uses (SQLite in 0.x, DuckDB in 1.x). Earlier versions attached the Andromeda file to DuckDB as SQLite; that wrote into a different file than the one Andromeda reads whenever the SQLite extension was available, and returned an empty Andromeda.

Usage

duckdb_to_andromeda(
  con,
  table_names = NULL,
  andromeda = NULL,
  output_file = NULL,
  chunk_size = 50000L
)

Arguments

con

Active DuckDB connection (duckdb::duckdb()).

table_names

Character vector of table names in DuckDB to transfer (e.g. c("covariates", "covariateRef", "analysisRef")). If NULL, transfers the covariate tables present, or every table when none match.

andromeda

Existing Andromeda object. If NULL, a new one is initialized.

output_file

Deprecated and ignored (kept so existing calls still work).

chunk_size

Rows copied per batch (default 50000).

Value

A populated Andromeda object.