Skip to contents

R counterpart of omop_etl.extract.from_sql. Instead of a SQLAlchemy URL it takes an open DBI connection (use the site's own driver: odbc, RPostgres, ROracle, RSQLite, ...; keep credentials in environment variables, never in code). Rows are fetched in chunks, columns are lower-cased (Oracle / Snowflake upper-case identifiers), table names are matched case-insensitively and the output is one <table>.parquet per table, written through DuckDB so no arrow installation is needed.

Usage

from_sql(
  src,
  tables,
  out_dir,
  chunksize = 500000L,
  schema = NULL,
  table_map = NULL
)

Arguments

src

An open DBI connection to the source database.

tables

Expected table names; an entry "name=SOURCE_TABLE" maps explicitly.

out_dir

Output directory (created).

chunksize

Rows per fetch.

schema

Source schema.

table_map

Named list / character vector expected -> actual, or the path to a JSON object or expected,source CSV, for sites whose tables are not named like PCORnet.

Value

A data.frame with one row per table: table, source_table, rows, columns, file.