Skip to contents

Defines a directed edge child(fk) -> parent(pk) for rel_schema().

Usage

rel_fk(child, fk, parent, pk = fk, driver = FALSE, coherent_via = NULL)

Arguments

child

Name of the child (referencing) table.

fk

Character vector of foreign-key column(s) in child.

parent

Name of the parent (referenced) table.

pk

Character vector of primary-key column(s) in parent (defaults to fk).

driver

Logical; if TRUE, designates parent as the primary driver table controlling row counts and unit grouping for child when child has multiple parents (Star / Fan schemas).

coherent_via

Optional intermediate table name when this edge forms a redundant shortcut in a Diamond FK DAG (child -> via -> parent).

Value

A flexsynth_fk object.

Examples

rel_fk("admissions", "patient_id", "patients", "patient_id", driver = TRUE)
#> $child
#> [1] "admissions"
#> 
#> $fk
#> [1] "patient_id"
#> 
#> $parent
#> [1] "patients"
#> 
#> $pk
#> [1] "patient_id"
#> 
#> $driver
#> [1] TRUE
#> 
#> $coherent_via
#> NULL
#> 
#> attr(,"class")
#> [1] "flexsynth_fk"