The functions parses table schema (from database) and saves its structure yaml format. The defined structure is then used to prepare schema dependency graph, that is:

  • dependencies between tablesBased on foreign key definitions

  • inner table column dependenciesBased on defined dependencies by various methods. See vignette('todo').

schema_source(
  source,
  schema = "public",
  file = if (is.character(source)) source else file.path(getwd(), "schema.yml"),
  faker_opts = getOption("dfkr_options", default_faker_opts)
)

Arguments

source

Connection to Redshift or Postgres database or path to YAML configuration file from which schema metadata should be sourced. When missing file defined file will be sourced if existing.

schema

Schema name from which the structure should be sourced.

file

Path to yaml file describing database schema, or target file when schema should be saved (when db_conn not mising). See vignette('todo').

faker_opts

Structure sourcing and columns simulation config.

Details

Detected dependencies are then saved in R6Class object that is returned and possible to pass for further methods. See schema_methods.

Keeping the schema as a graph allows to perform simulation process in proper order, preserving table dependencies and constraints.