You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
@@ -55,6 +58,57 @@ Any custom metric that matches the definition of your new YAML metric will autom
55
58
56
59
:::
57
60
61
+
## Write-Back dimensions from custom dimensions
62
+
63
+
You can build custom dimensions in Lightdash and write these back to your dbt project.
64
+
65
+
We recommend using dbt write-back for custom dimensions that you're using/creating frequently so they become dimensions that are reusable, governed and available for everyone else to build from.
66
+
67
+
:::info
68
+
69
+
**What's the difference between a dimension and a custom dimension?**
70
+
71
+
[Dimensions](/references/dimensions) written to your dbt project (or YAML dimensions) are reusable by everyone in your project and will show up in the list of available dimensions for a Table. [Custom dimensions](/references/custom-fields#custom-dimensions) are only saved in the chart they're used in and will not be saved in the list of `dimensions` available if you open the same Table to build a new chart.
72
+
73
+
:::
74
+
75
+
To get started, create a [custom dimension](/references/custom-fields#custom-dimensions) in the Explorer. Hover over the custom dimension in the sidebar and click on the three-dot menu, then `write back to dbt`.
76
+
77
+
1. Click `write back to dbt`
78
+
<img
79
+
src={writeBackCustomDimension1}
80
+
width="644"
81
+
height="805"
82
+
style={{display: 'block', margin: '0 auto 20px auto'}}
83
+
/>
84
+
2. Preview the dimension YAML and open a Pull Request.
85
+
<img
86
+
src={writeBackCustomDimension2}
87
+
width="644"
88
+
height="805"
89
+
style={{display: 'block', margin: '0 auto 20px auto'}}
90
+
/>
91
+
3. Approve and merge the Pull Request in your dbt project.
92
+
<img
93
+
src={writeBackCustomDimension3}
94
+
width="644"
95
+
height="805"
96
+
style={{display: 'block', margin: '0 auto 20px auto'}}
97
+
/>
98
+
99
+
Once the pull request with your new dimension is merged, you can click `refresh dbt` in Lightdash (or, if you're [using GitHub actions](../guides/cli/how-to-use-lightdash-deploy#automatically-deploy-your-changes-to-lightdash-using-a-github-action), your project will automatically refresh once your changes are merged).
100
+
101
+
### Known limitations
102
+
103
+
#### Bin dimensions
104
+
105
+
Writing back bin dimensions is not supported at the moment. If you want to help test our beta feature, please reach out to support.
At the moment, if you write back a custom dimension to your dbt project's YAML, the custom dimension will not be automatically replaced with the new, YAML dimension. Once your new dimension is created in dbt, you'll need to manually update your charts and replace the custom dimensions with the new dimension.
110
+
111
+
58
112
## Write-Back models from the SQL Runner
59
113
60
114
You can use Lightdash to build models in dbt from queries that you've built in the SQL runner. We recommend writing back models from the SQL runner if you're planning to use the query regularly so it can be easily used, governed and managed like other dbt models in your Lightdash project.
0 commit comments