DRDataRaft/ docs
GitHub ↗

dr_dbt_build()

Run the dbt CLI in a separate process and read that invocation's artifacts. Each invocation gets a new directory under .dataraft/runs in the project; a failed invocation can never reuse an earlier run's successful results.

Usage

dr_dbt_build(
  project,
  select = NULL,
  exclude = NULL,
  full_refresh = FALSE,
  vars = list(),
  echo = TRUE,
  timeout = Inf,
  stop_on_failure = TRUE,
  catalog = NULL
)

dr_dbt_test(
  project,
  select = NULL,
  exclude = NULL,
  vars = list(),
  echo = TRUE,
  timeout = Inf,
  stop_on_failure = TRUE,
  catalog = NULL
)

Arguments

project
A dr_dbt_project() specification.


select, exclude
Optional character vectors of dbt selection expressions. Each element is one CLI argument; expressions starting with - are rejected.


full_refresh
Logical scalar. Rebuild incremental models when TRUE.


vars
A named list of non-secret dbt variables, encoded as JSON.


echo
Logical scalar. Stream dbt output to the R console.


timeout
Positive timeout in seconds, or Inf for no limit.


stop_on_failure
Logical scalar. Raise dr_dbt_failed on a nonzero exit status, failed nodes or missing artifacts. The condition's result field retains diagnostics. Set FALSE to inspect failures as ordinary results.


catalog
Optional dataraft.adapters::dr_catalog_openmetadata_dbt() adapter, a function receiving the dbt result, or an S3 catalog whose dataraft.core::dr_capabilities() declares metadata_inputs = "dr_dbt_result" and implements dataraft.core::dr_publish_metadata(). After dbt finishes, hand this invocation's artifacts to OpenMetadata's ingestion engine. A delivery failure warns and leaves the dbt outcome unchanged. Retry with dataraft.core::dr_publish_metadata(catalog, result) without rebuilding models.

Value

A dr_dbt_result list with status (integer exit code), success (logical), command, results (node tibble), parsed manifest, artifacts_dir, stdout, stderr, artifact_error, invocation_id, artifact_hashes, original project, resolved source_bindings, source_catalog and optional catalog_delivery. Warnings reported by dbt are retained and do not by themselves count as failure.

Details

Close R connections to the same local DuckDB or DuckLake catalog before running dbt, then reconnect for analysis. dbt manages its own connections. Anonymous usage telemetry is disabled for the child process. A dbt build is not an atomic dataraft release: earlier models can have been materialized even if a later model or test fails. dbt logs and artifacts can contain SQL, paths and database messages; treat them as project data.

Examples

\dontshow{if (nzchar(Sys.getenv("DATARAFT_DBT_EXAMPLE_PROJECT"))) withAutoprint(\{ # examplesIf}
project <- dr_dbt_project(Sys.getenv("DATARAFT_DBT_EXAMPLE_PROJECT"))
result <- dr_dbt_build(project, select = "tag:reporting", echo = FALSE)
dr_dbt_status(result)
\dontshow{\}) # examplesIf}

See also

dr_dbt_status(), dr_dbt_lineage(), dr_dbt_model()
Documentation source snapshot · View source at 3a9d744 ↗
Code examples are documented source examples; they are not executed in this website build.

Search documentation

Search functions, packages and guides.