dr_dbt_init()
Write a small dbt-duckdb project with RAW inputs, staging casts, a core
order model, customer revenue and uniqueness/not-null tests. Supply accepted
R-ingested
sources to use real immutable RAW relations. With no sources,
the starter remains a runnable synthetic seed demonstration. Existing
non-empty directories are never overwritten. No connection is opened.
Usage
dr_dbt_init(
path,
config,
name = "dataraft_demo",
executable = "dbt",
sources = NULL
)Arguments
- path
- Character scalar giving a new or empty directory.
- config
- A
dataraft.lake::dr_lake_config()with a local DuckDB catalog and local storage. - name
- Character scalar. A dbt project identifier containing letters, digits and underscores, starting with a letter.
- executable
- Character scalar giving a dbt executable name or path.
It is passed to
processx::run()without a shell. - sources
- Optional named list accepted by
dr_dbt_sources(). The canned order example requires anordersentry whose recorded schema includesorder_id,customer_idandamount. Staging castsamountto SQLdouble, including when input amounts are character strings. Invalid numeric strings fail the dbt build. Other named sources also receive staging models. For arbitrary business models usedr_dbt_sources()with your own project instead of this order-specific starter.
Value
A
dr_dbt_project() specification pointing to the written project
and profile. Its source_config records the expected catalog. Source mode
creates no seeds and never writes RAW tables. Configure
layers = c("raw", "staging", "core", "marts") in dataraft.lake::dr_lake_config().
A named layer vector can map staging, core and marts to other schema
names; the ingestion schema remains raw. Seed mode also works with the
usual three-layer lake configuration, creating its dbt schemas on build.
Details
The generated profile targets the catalog in
config through the lake
attachment. Supported configurations use a local metadata catalog and local
storage. For S3, PostgreSQL or dbt v2 catalog configuration, create and
verify
an appropriate profile yourself and use dr_dbt_project(). The starter
uses the dbt-duckdb profile format; it does not install dbt or adapters.
Examples
\dontshow{if (requireNamespace("duckdb", quietly = TRUE) && requireNamespace("yaml", quietly = TRUE)) withAutoprint(\{ # examplesIf}
root <- tempfile("dataraft-example-")
config <- dataraft.lake::dr_lake_config(
catalog = dataraft.lake::dr_registry_duckdb(file.path(root, "lake.duckdb")),
storage = dataraft.lake::dr_storage_local(file.path(root, "data")),
landing = file.path(root, "landing"), backend = "duckdb"
)
project <- dr_dbt_init(file.path(root, "dbt"), config)
project
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.