{
  "source_file": "0930",
  "source_platform": "Ghost",
  "author": "Deep Learning Nerds",
  "title_listed": "Understanding dbt State: How state:modified Works with a Practical Example",
  "keywords": "",
  "domain": "数据处理",
  "content_type": "技术教程",
  "is_paid_flag": "否",
  "url": "https://www.deeplearningnerds.com/understanding-dbt-state-how-state-modified-works-with-a-practical-example/",
  "publish_date": "2026-06",
  "corpus_stage": "",
  "notes": "",
  "id": "523bc939504a",
  "collected_at": "2026-10-02T12:24:50",
  "title": "Understanding dbt State: How state:modified Works with a Practical Example",
  "body_markdown": "📘 Introduction\ndbt state helps dbt compare your current project with a previous version of the same project. This is useful when you want to run only the models that changed instead of rebuilding the whole project.\nWe use the same\ndlnerds_university\nMedallion Architecture example project from previous dbt posts, so the project structure stays familiar.\nIn this tutorial, you will learn dbt state with a practical example. We will use a production\nmanifest.json\nand the selector\nstate:modified\nto detect that\ndim_student\nchanged.\nThe goal is simple: understand how dbt can compare the current project against a saved production state and then build only the changed models.\n💡 What are we implementing?\nWe will implement this workflow:\nProduction manifest -> dbt state comparison -> modified models -> focused dbt build\nThe production manifest represents the previous state of the project. Your local files represent the current state. dbt compares both and tells you what changed.\nstate/prod/manifest.json + current project files -> state:modified\nIn this tutorial, we will change\ndim_student.sql\n. Then dbt should detect\ndim_student\nas modified.\n✅ Prerequisites\n☑️ A working dbt project\n☑️ Raw source tables already defined in\nmodels/01_bronze/sources.yml\n☑️ Existing Silver model\nstudent_cleaned\nwith its own YAML file\n☑️ A production\nmanifest.json\navailable locally, for example in\nstate/prod\n☑️ Basic knowledge of running\ndbt ls\nand\ndbt build\n🧱1️⃣ Understand the current project setup\nFor this tutorial, we use this relevant excerpt of the\ndlnerds_university\nproject:\ndlnerds_university/\n├── dbt_project.yml\n├── models/\n│   ├── 01_bronze/\n│   │   └── sources.yml\n│   ├── 02_silver/\n│   │   ├── student_cleaned.sql\n│   │   └── student_cleaned.yml\n│   └── 03_gold/\n│       ├── dim_student.sql\n│       └── dim_student.yml\n└── state/\n    └── prod/\n        └── manifest.json\nThe important state file is\nstate/prod/manifest.json\n. This file is created by a previous dbt invocation, usually a production run.\nIt does not need to be created locally, but it must be locally available when you pass it to\n--state\n.\n🧠2️⃣ What does dbt state mean?\nIn dbt, state means a saved point-in-time view of your project and run artifacts.\nThe most important artifact for state comparison is\nmanifest.json\n. It contains metadata about dbt resources such as models, sources, tests, snapshots, macros, configs, and dependencies.\nWhen you use\n--state state/prod\n, dbt reads the artifact files in that folder and compares them with the current project.\nprevious state: state/prod/manifest.json\ncurrent state: your local dbt project\nThis is why\n--state\npoints to a folder, not directly to the\nmanifest.json\nfile.\n🎓 Want to go deeper with dbt?\nIf you want to understand dbt state, Slim CI, artifacts, model selection, and Medallion Architecture workflows in more detail, the Academy and the dbt book go deeper into hands-on dbt projects with practical examples.\nIf you’d like to dive deeper into\ndbt (data build tool)\n, our book\nBuilding Modern Data Pipelines with dbt: From Raw Data to Gold Standard with the Medallion Architecture\nprovides a hands-on guide to designing modern data pipelines. It covers dbt’s core concepts and best practices, including building Bronze, Silver, and Gold layers with the\nMedallion Architecture\n. It also serves as a hands-on study guide for the\ndbt Analytics Engineering Certification\n.\nView on Amazon\nYou can view this post with the tier:\n      Academy Membership\nJoin academy now to read the post and get access to the full library of premium posts for academy members only.\nJoin Academy\nAlready have an account?\nSign In",
  "metadata": {
    "title": "Understanding dbt State: How state:modified Works with a Practical Example",
    "description": "Learn how dbt state works with a practical state:modified example using a production manifest.json and a changed dim_student model.",
    "keywords": null,
    "author": null,
    "og:site_name": "Deep Learning Nerds | The ultimate Learning Platform for AI and Data Science",
    "og:type": "article",
    "og:title": "Understanding dbt State: How state:modified Works with a Practical Example",
    "og:description": "Learn how dbt state works with a practical state:modified example using a production manifest.json and a changed dim_student model.",
    "og:url": "https://www.deeplearningnerds.com/understanding-dbt-state-how-state-modified-works-with-a-practical-example/",
    "og:image": "https://storage.ghost.io/c/5b/26/5b26e983-a59f-4f4b-a5f2-bd8c5a0a38e2/content/images/2026/06/dbt---Understanding-dbt-State-How-statemodified-Works-with-a-Practical-Example.png",
    "og:image:width": "1200",
    "og:image:height": "839",
    "twitter:card": "summary_large_image",
    "twitter:title": "Understanding dbt State: How state:modified Works with a Practical Example",
    "twitter:description": "Learn how dbt state works with a practical state:modified example using a production manifest.json and a changed dim_student model.",
    "twitter:url": "https://www.deeplearningnerds.com/understanding-dbt-state-how-state-modified-works-with-a-practical-example/",
    "twitter:image": "https://storage.ghost.io/c/5b/26/5b26e983-a59f-4f4b-a5f2-bd8c5a0a38e2/content/images/2026/06/dbt---Understanding-dbt-State-How-statemodified-Works-with-a-Practical-Example.png",
    "twitter:label1": "Written by",
    "twitter:data1": "Data Engineer",
    "twitter:label2": "Filed under",
    "twitter:data2": "dbt, Data Engineering, dbt Analytics Engineering Certification",
    "twitter:site": "@DLNerds",
    "article:published_time": "2026-06-05T12:18:48.000Z",
    "article:modified_time": "2026-06-05T12:18:48.000Z",
    "article:tag": "dbt Analytics Engineering Certification",
    "article:publisher": "https://www.facebook.com/deeplearningnerds/",
    "article:author": "https://www.facebook.com/deeplearningnerds/"
  },
  "paywall": {
    "listed_paid": false,
    "detected": false,
    "marker": "",
    "public_only": false,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 200,
    "error": ""
  },
  "code_blocks": [
    {
      "file": "attachments/523bc939504a/code/body-000.txt",
      "chars": 83,
      "language": "text"
    },
    {
      "file": "attachments/523bc939504a/code/body-001.txt",
      "chars": 66,
      "language": "text"
    },
    {
      "file": "attachments/523bc939504a/code/body-002.txt",
      "chars": 301,
      "language": "text"
    },
    {
      "file": "attachments/523bc939504a/code/body-003.txt",
      "chars": 78,
      "language": "text"
    }
  ],
  "images": [
    {
      "status": "ok",
      "url": "https://storage.ghost.io/c/5b/26/5b26e983-a59f-4f4b-a5f2-bd8c5a0a38e2/content/images/2026/03/Mockup-Transparent-PNG-1.png",
      "bytes": 1130793,
      "reused": true,
      "local_path": "attachments/523bc939504a/images/005.png",
      "src": "https://storage.ghost.io/c/5b/26/5b26e983-a59f-4f4b-a5f2-bd8c5a0a38e2/content/images/2026/03/Mockup-Transparent-PNG-1.png",
      "alt": "CTA Image",
      "downloaded": true
    }
  ],
  "audio": [],
  "videos": [],
  "links": [
    {
      "href": "https://amzn.eu/d/04HPLJMo?ref=deeplearningnerds.com",
      "label": "",
      "type": "a"
    },
    {
      "href": "https://www.deeplearningnerds.com/membership/",
      "label": "Join Academy",
      "type": "a"
    },
    {
      "href": "https://www.deeplearningnerds.com/signin/",
      "label": "Sign In",
      "type": "a"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-14T10:47:42Z",
  "source_url": "https://www.deeplearningnerds.com/understanding-dbt-state-how-state-modified-works-with-a-practical-example/",
  "papers": [],
  "actual_video_files": [],
  "body_chars": 3633,
  "expected_body_images": 1,
  "discovery_status": "ok",
  "delivery_status": "ok",
  "missing_reason": "",
  "raw_html": "attachments/523bc939504a/pages/source.html",
  "local_html": "attachments/523bc939504a/pages/article.html",
  "body_base_path": "attachments/523bc939504a/pages/",
  "body_markdown_path": "attachments/523bc939504a/pages/article.md"
}