Run Artifacts

Concepts covered: Run artifacts

When a command finishes, its terminal output scrolls away, but dbt has also written files recording what it read and what it did. They land in the target/ folder inside the project, next to the compiled SQL. Long after the terminal is closed, these files answer which models ran, which failed, how long each took, and how the project's nodes connect.

PathWritten byWhat it records
target/manifest.jsonEvery command that reads the projectEach node: its type, config, schema, SQL and the nodes it depends on
target/run_results.jsonCommands that execute nodes, such as run, build and testOne result per node: status, timing, and for tests the count of failing rows
target/compiled/compile, run, build, testEach model and test as its SELECT, after Jinja renders
target/run/run, build, testThe full statement sent, with the create around the SELECT

manifest.json: the project as dbt read it

The manifest is one JSON object describing the whole project. Each node has a unique id that prefixes its own name with its type and the project name, so fct_orders in the shop project is model.shop.fct_orders. Under that id sit its materialization, the schema it builds into on this run's target, and depends_on, the list of nodes it reads from. parent_map holds every node's lineage in one direction at the top level of the file, and child_map holds it in the other.

{
  "nodes": {
    "model.shop.fct_orders": {
      "resource_type": "model",
      "schema": "dbt_ana",
      "config": {
        "materialized": "table"
      },
      "depends_on": {
        "nodes": ["model.shop.stg_orders"]
      }
    }
  },
  "child_map": {
    "model.shop.stg_orders": ["model.shop.fct_orders"]
  }
}

The + selectors from the previous section walk this same graph: stg_orders+ is stg_orders plus everything reachable from it through child_map. When a selection builds a model you did not expect, the maps show which reference tied the 2 together.

run_results.json: one entry per node

run_results.json holds the outcome of the last command that executed nodes. Its results list has one entry per node the command ran or skipped, each with the node's unique id, its status, its execution_time in seconds, and for a test the number of rows it returned in failures. Under args sits the command that produced the file, with its flags.

{
  "results": [
    {
      "unique_id": "test.shop.source_not_null_raw_orders_customer_id.4b8a9c1d2e",
      "status": "fail",
      "failures": 1,
      "execution_time": 0.41
    },
    {
      "unique_id": "model.shop.stg_orders",
      "status": "skipped",
      "execution_time": 0
    },
    {
      "unique_id": "model.shop.fct_orders",
      "status": "skipped",
      "execution_time": 0
    }
  ],
  "args": {
    "which": "build"
  }
}
StatusNodeWhat happened
successmodelIts SQL ran and the table or view was built
errormodelThe warehouse rejected its SQL
skippedmodel or testSomething upstream failed, so this node never ran
passtestThe test query returned 0 rows
failtestThe test query returned rows, counted in failures
errortestThe test query itself could not run

Each new command that writes these files replaces them. After a failed nightly build, a dbt test run on the same machine overwrites the build's run results with its own, and the record of what the build did is gone. Production jobs copy target/ to lasting storage after every run for that reason.

Screen and file report the same result in 2 spellings: a test that prints Failed is stored as fail, and a model that prints Skipped is stored as skipped. The file can therefore stand in for a terminal nobody was watching, and dbt retry reads its statuses to decide what to rerun.

Reading artifacts as practice

Run a build on your dev target and open target/run_results.json. Find the entry with the largest execution_time, then open that model's file in target/run/ and read the full statement it sent. Find the same model in manifest.json and follow its depends_on list up to the sources. One pass through a real project teaches the files' shape better than a list of their fields.

About this lesson

This section is part of the Deploying dbt: Beginner lesson on DataDriven, the home of data engineering. Lessons cover SQL, Python, Spark, data modeling and pipeline architecture, and each section pairs its explanation with worked examples and practice you run as you go.