dr_dbt_sources()
Use successful ingestion or product results from any lake layer as ordinary
dbt sources. Each source group must use one physical schema. Bind additional
groups with separate calls, for example
name = "raw" and name = "enriched".
The registry supplies exact physical names and verifies the recorded run;
editable result output descriptions are never used as relation authority.
Usage
dr_dbt_sources(project, sources, name = "inputs")Arguments
- project
- A
dr_dbt_project()specification. - sources
- Named, non-empty list of successful
dr_run_resultobjects returned bydataraft.lake::dr_ingest()ordataraft.core::dr_publish(). Names are dbt identifiers such asorders. - name
- Logical dbt source name, used by
source(name, table)in SQL.
Value
The project specification, invisibly, for use in a pipe.
Details
For
For an externally configured project, this is an explicit immediate YAML generator. It preserves other logical tables in the same generated group. Only a file with the package ownership marker can be replaced. Its profile must attach the same catalog as
dr_dbt_project(lake = config), this function updates a deferred
specification. No database is opened and no files are written. At execution,
all groups are resolved and validated before one package-owned source YAML
is replaced. Constructor sources uses the group name inputs.For an externally configured project, this is an explicit immediate YAML generator. It preserves other logical tables in the same generated group. Only a file with the package ownership marker can be replaced. Its profile must attach the same catalog as
lake. Both modes use the first literal
model-paths directory, defaulting to models, and never write data or views.
Coordinate concurrent project writers and close caller-owned lake handles
before dbt execution.
Examples
\dontshow{if (requireNamespace("duckdb", quietly = TRUE) && requireNamespace("yaml", quietly = TRUE)) withAutoprint(\{ # examplesIf}
root <- tempfile("dataraft-dbt-sources-")
config <- dataraft.lake::dr_lake_config(
dataraft.lake::dr_registry_duckdb(file.path(root, "lake.db")),
dataraft.lake::dr_storage_local(file.path(root, "data")),
landing = file.path(root, "landing"), backend = "duckdb",
layers = c("raw", "staging", "core", "marts")
)
accepted <- dataraft.lake::dr_ingest(data.frame(
order_id = 1:2, customer_id = c(1L, 1L), amount = c(10, 20)
), name = "orders", to = config)
project <- dr_dbt_init(file.path(root, "dbt"), config,
sources = list(orders = accepted))
dr_dbt_sources(project, list(orders = accepted), name = "raw")
unlink(root, recursive = TRUE)
\dontshow{\}) # examplesIf}See also
Documentation source snapshot · View source at 3a9d744 ↗
Code examples are documented source examples; they are not executed in this website build.
Code examples are documented source examples; they are not executed in this website build.