diff --git a/docs/content/api/modules.json.gz b/docs/content/api/modules.json.gz
index fbcd73aa6ce44..291e00118a131 100644
Binary files a/docs/content/api/modules.json.gz and b/docs/content/api/modules.json.gz differ
diff --git a/docs/content/api/searchindex.json.gz b/docs/content/api/searchindex.json.gz
index 194d101bceec0..520ff532b7db0 100644
Binary files a/docs/content/api/searchindex.json.gz and b/docs/content/api/searchindex.json.gz differ
diff --git a/docs/content/api/sections.json.gz b/docs/content/api/sections.json.gz
index e45844b3065d2..35077a1c75d92 100644
Binary files a/docs/content/api/sections.json.gz and b/docs/content/api/sections.json.gz differ
diff --git a/docs/content/guides/dagster/code-references.mdx b/docs/content/guides/dagster/code-references.mdx
index 2dd13f5983d84..4e93956897c74 100644
--- a/docs/content/guides/dagster/code-references.mdx
+++ b/docs/content/guides/dagster/code-references.mdx
@@ -29,7 +29,9 @@ To complete the steps in this guide, you'll need:
## Automatically attaching code references to asset definitions
-To automatically attach code references to the asset's function definition, you can use the `dagster._core.definitions.metadata.with_source_code_references` utility. Any asset definitions passed to the utility will have their source file attached as metadata.
+### Assets defined in Python
+
+To automatically attach code references to Python assets' function definitions, you can use the `dagster._core.definitions.metadata.with_source_code_references` utility. Any asset definitions passed to the utility will have their source file attached as metadata.
```python file=/guides/dagster/code_references/with_source_code_references.py
from dagster import Definitions, asset, with_source_code_references
@@ -57,6 +59,10 @@ A link to the asset's source in `with_source_code_references.py` will then be vi
/>
+### dbt assets
+
+Dagster's dbt integration can automatically attach references to the SQL files backing your dbt assets. For more information, see the [dagster-dbt integration reference](/integrations/dbt/reference#attaching-code-reference-metadata).
+
---
## Manually attaching code references to asset definitions
diff --git a/docs/content/integrations/dbt/reference.mdx b/docs/content/integrations/dbt/reference.mdx
index d38606cddc69c..537b72eed87d3 100644
--- a/docs/content/integrations/dbt/reference.mdx
+++ b/docs/content/integrations/dbt/reference.mdx
@@ -520,6 +520,43 @@ def my_dbt_assets(context: AssetExecutionContext, dbt: DbtCliResource):
Dagster also supports fetching additional metadata at dbt execution time to attach to asset materializations. For more information, see the [Customizing asset materialization metadata](#customizing-asset-materialization-metadata) section.
+#### Attaching code reference metadata
+
+Dagster's dbt integration can automatically attach [code reference](/guides/dagster/code-references) metadata to the SQL files backing your dbt assets. To enable this feature, set the `enable_code_references` parameter to `True` in the passed to your :
+
+```python file=/guides/dagster/code_references/with_dbt_code_references.py
+from pathlib import Path
+
+from dagster_dbt import (
+ DagsterDbtTranslator,
+ DagsterDbtTranslatorSettings,
+ DbtCliResource,
+ DbtProject,
+ dbt_assets,
+)
+
+from dagster import AssetExecutionContext, Definitions, with_source_code_references
+
+my_project = DbtProject(project_dir=Path("path/to/dbt_project"))
+
+# links to dbt model source code from assets
+dagster_dbt_translator = DagsterDbtTranslator(
+ settings=DagsterDbtTranslatorSettings(enable_code_references=True)
+)
+
+
+@dbt_assets(
+ manifest=my_project.manifest_path,
+ dagster_dbt_translator=dagster_dbt_translator,
+ project=my_project,
+)
+def my_dbt_assets(context: AssetExecutionContext, dbt: DbtCliResource):
+ yield from dbt.cli(["build"], context=context).stream()
+
+
+defs = Definitions(assets=with_source_code_references([my_dbt_assets]))
+```
+
### Customizing tags
diff --git a/examples/docs_snippets/docs_snippets/guides/dagster/code_references/with_dbt_code_references.py b/examples/docs_snippets/docs_snippets/guides/dagster/code_references/with_dbt_code_references.py
new file mode 100644
index 0000000000000..68f47d06a03ed
--- /dev/null
+++ b/examples/docs_snippets/docs_snippets/guides/dagster/code_references/with_dbt_code_references.py
@@ -0,0 +1,30 @@
+from pathlib import Path
+
+from dagster_dbt import (
+ DagsterDbtTranslator,
+ DagsterDbtTranslatorSettings,
+ DbtCliResource,
+ DbtProject,
+ dbt_assets,
+)
+
+from dagster import AssetExecutionContext, Definitions, with_source_code_references
+
+my_project = DbtProject(project_dir=Path("path/to/dbt_project"))
+
+# links to dbt model source code from assets
+dagster_dbt_translator = DagsterDbtTranslator(
+ settings=DagsterDbtTranslatorSettings(enable_code_references=True)
+)
+
+
+@dbt_assets(
+ manifest=my_project.manifest_path,
+ dagster_dbt_translator=dagster_dbt_translator,
+ project=my_project,
+)
+def my_dbt_assets(context: AssetExecutionContext, dbt: DbtCliResource):
+ yield from dbt.cli(["build"], context=context).stream()
+
+
+defs = Definitions(assets=with_source_code_references([my_dbt_assets]))