{
  "source_file": "0930",
  "source_platform": "Ghost",
  "author": "Deep Learning Nerds",
  "title_listed": "dbt clone Explained: How to Use dbt clone with a Practical Example",
  "keywords": "",
  "domain": "数据处理",
  "content_type": "技术教程",
  "is_paid_flag": "否",
  "url": "https://www.deeplearningnerds.com/dbt-clone-explained-how-to-use-dbt-clone-with-a-practical-example/",
  "publish_date": "2026-06",
  "corpus_stage": "",
  "notes": "",
  "id": "a285b7786a1b",
  "collected_at": "2026-10-02T12:25:01",
  "title": "dbt clone Explained: How to Use dbt clone with a Practical Example",
  "body_markdown": "📘 Introduction\ndbt clone\nhelps you copy existing dbt-built objects from another environment into your current target schema. This is useful when you want realistic development or CI objects without rebuilding everything from scratch.\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\ndbt clone\nwith a practical example. We will clone the Gold model\ndim_student\nfrom a production state into a development target schema.\nThe goal is simple: use the production version of\ndim_student\nas a ready-made object in Dev, then rebuild only the models you are actively changing.\n💡 What are we implementing?\nWe will implement this workflow:\nProduction state -> dbt clone -> Dev schema\nIn our example, the production object is\nprod.dim_student\n. After cloning, we get a corresponding object in the development target, for example\ndev.dim_student\n.\nprod.dim_student -> dev.dim_student\nThis can make development and CI workflows faster because dbt does not have to rebuild the full upstream dependency graph just to make an object available in Dev.\n✅ Prerequisites\n☑️ A working dbt project\n☑️ A production dbt run with available artifacts\n☑️ A production\nmanifest.json\navailable locally, for example in\nstate/prod\n☑️ A development target configured in your dbt profile\n☑️ Permission to create relations in your development schema\n🧱1️⃣ Understand the current project setup\nFor this tutorial, we use this relevant project excerpt:\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 file for\ndbt clone\nis\nstate/prod/manifest.json\n. This artifact tells dbt what existed in the production state.\nWe will clone\ndim_student\nfrom that production state into the current target schema.\n🧭2️⃣ Understand local files, Production, and Dev\nThere are three different things in this tutorial, and they should not be mixed up:\nLocal dbt project file:\nmodels/03_gold/dim_student.sql\n\nProduction relation:\nprod.dim_student\n\nDevelopment relation:\ndev.dim_student\nThe local file\nmodels/03_gold/dim_student.sql\nshould exist so dbt knows that there is a model called\ndim_student\n.\nThe Production relation\nprod.dim_student\nmust already exist and must be represented in the Production\nmanifest.json\n.\nThe Development relation\ndev.dim_student\ndoes not need to exist before running\ndbt clone\n. This is the relation dbt creates in your Dev target.\n💡\nThe state folder must be locally available because dbt reads state/prod/manifest.json. The Dev relation does not need to exist before cloning.\n🧭3️⃣ Understand the basic clone command\nThe basic command looks like this:\ndbt clone --select dim_student --state state/prod\nThis tells dbt:\nselect the model\ndim_student\nlook at the production state in\nstate/prod\ncreate the selected object in the current target schema\nIf your current target is\ndev\n, the clone is created in Dev. It does not write back to Production.\n🎓 Want to go deeper with dbt?\nIf you want to understand dbt project structure, state artifacts, deferral, clone workflows, and Medallion Architecture 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": "dbt clone Explained: How to Use dbt clone with a Practical Example",
    "description": "Learn how dbt clone works with a practical dim_student example using production state artifacts and a development target schema.",
    "keywords": null,
    "author": null,
    "og:site_name": "Deep Learning Nerds | The ultimate Learning Platform for AI and Data Science",
    "og:type": "article",
    "og:title": "dbt clone Explained: How to Use dbt clone with a Practical Example",
    "og:description": "Learn how dbt clone works with a practical dim_student example using production state artifacts and a development target schema.",
    "og:url": "https://www.deeplearningnerds.com/dbt-clone-explained-how-to-use-dbt-clone-with-a-practical-example/",
    "og:image": "https://storage.ghost.io/c/5b/26/5b26e983-a59f-4f4b-a5f2-bd8c5a0a38e2/content/images/size/w1200/2026/06/dbt---dbt-clone-explained-How-to-Use-dbt-clone-with-a-practical-example.png",
    "og:image:width": "1200",
    "og:image:height": "839",
    "twitter:card": "summary_large_image",
    "twitter:title": "dbt clone Explained: How to Use dbt clone with a Practical Example",
    "twitter:description": "Learn how dbt clone works with a practical dim_student example using production state artifacts and a development target schema.",
    "twitter:url": "https://www.deeplearningnerds.com/dbt-clone-explained-how-to-use-dbt-clone-with-a-practical-example/",
    "twitter:image": "https://storage.ghost.io/c/5b/26/5b26e983-a59f-4f4b-a5f2-bd8c5a0a38e2/content/images/size/w1200/2026/06/dbt---dbt-clone-explained-How-to-Use-dbt-clone-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-01T17:49:23.000Z",
    "article:modified_time": "2026-06-01T17:49:23.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/a285b7786a1b/code/body-000.txt",
      "chars": 43,
      "language": "text"
    },
    {
      "file": "attachments/a285b7786a1b/code/body-001.txt",
      "chars": 35,
      "language": "text"
    },
    {
      "file": "attachments/a285b7786a1b/code/body-002.txt",
      "chars": 301,
      "language": "text"
    },
    {
      "file": "attachments/a285b7786a1b/code/body-003.txt",
      "chars": 132,
      "language": "text"
    },
    {
      "file": "attachments/a285b7786a1b/code/body-004.txt",
      "chars": 49,
      "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/a285b7786a1b/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:43Z",
  "source_url": "https://www.deeplearningnerds.com/dbt-clone-explained-how-to-use-dbt-clone-with-a-practical-example/",
  "papers": [],
  "actual_video_files": [],
  "body_chars": 4156,
  "expected_body_images": 1,
  "discovery_status": "ok",
  "delivery_status": "ok",
  "missing_reason": "",
  "raw_html": "attachments/a285b7786a1b/pages/source.html",
  "local_html": "attachments/a285b7786a1b/pages/article.html",
  "body_base_path": "attachments/a285b7786a1b/pages/",
  "body_markdown_path": "attachments/a285b7786a1b/pages/article.md"
}