Skip to contents

Creates the temporary view src_<table_name> over a source CSV, applying case-insensitive header aliases (e.g. ssid -> PATID) and padding absent expected columns with NULL. The aliased and null-padded columns are printed. Mirror of omop_etl.build_safe_source_view in Python.

Usage

build_safe_source_view(
  con,
  table_name,
  csv_path,
  expected_columns,
  aliases = .DEFAULT_ALIASES
)

Arguments

con

DuckDB DBI connection.

table_name

Source table name (the view is src_<table_name>).

csv_path

Path to the CSV.

expected_columns

Columns the view must expose.

aliases

Named list mapping an expected column (upper case) to accepted header names.

Value

Invisibly, the view name.