Skip to content

Commit 6401a81

Browse files
This branch was auto-updated!
2 parents 1d58916 + 67803a6 commit 6401a81

File tree

11 files changed

+300
-104
lines changed

11 files changed

+300
-104
lines changed

website/api/get-discourse-comments.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ const PREVIEW_ENV = 'deploy-preview-'
99
// Set API endpoint and headers
1010
let discourse_endpoint = `https://discourse.getdbt.com`
1111
let headers = {
12-
'Accept': 'application/json',
13-
'Api-Key': DISCOURSE_DEVBLOG_API_KEY,
14-
'Api-Username': DISCOURSE_USER_SYSTEM,
15-
}
12+
Accept: "application/json",
13+
"Api-Key": DISCOURSE_DEVBLOG_API_KEY,
14+
"Api-Username": DISCOURSE_USER_SYSTEM,
15+
// Cache comments in the browser (max-age) & CDN (s-maxage) for 1 day
16+
"Cache-Control": "max-age=86400, s-maxage=86400 stale-while-revalidate",
17+
};
1618

1719
async function getDiscourseComments(request, response) {
1820
let topicId, comments, DISCOURSE_TOPIC_ID;

website/api/get-discourse-topics.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ async function getDiscourseTopics(request, response) {
99
// Set API endpoint and headers
1010
let discourse_endpoint = `https://discourse.getdbt.com`
1111
let headers = {
12-
'Accept': 'application/json',
13-
'Api-Key': DISCOURSE_API_KEY,
14-
'Api-Username': DISCOURSE_USER,
15-
}
12+
Accept: "application/json",
13+
"Api-Key": DISCOURSE_API_KEY,
14+
"Api-Username": DISCOURSE_USER,
15+
// Cache topics in the browser (max-age) & CDN (s-maxage) for 1 day
16+
"Cache-Control": "max-age=86400, s-maxage=86400 stale-while-revalidate",
17+
};
1618

1719
const query = buildQueryString(body)
1820
if(!query) throw new Error('Unable to build query string.')

website/docs/docs/build/documentation.md

Lines changed: 44 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
---
2-
title: "Documentation"
2+
title: "About documentation"
33
description: "Learn how good documentation for your dbt models helps stakeholders discover and understand your datasets."
44
id: "documentation"
5+
pagination_next: "docs/build/view-documentation"
56
---
67

8+
import CopilotBeta from '/snippets/_dbt-copilot-avail.md';
9+
710
Good documentation for your dbt models will help downstream consumers discover and understand the datasets you curate for them.
811
dbt provides a way to generate documentation for your dbt project and render it as a website.
912

10-
import CopilotBeta from '/snippets/_dbt-copilot-avail.md';
1113

1214
<CopilotBeta resource='documentation' />
1315

16+
1417
## Related documentation
1518

1619
* [Declaring properties](/reference/configs-and-properties)
@@ -24,14 +27,16 @@ import CopilotBeta from '/snippets/_dbt-copilot-avail.md';
2427

2528
## Overview
2629

27-
dbt provides a way to generate documentation for your dbt project. The documentation for your project includes:
30+
dbt provides a scalable way to [generate](#generating-documentation) documentation for your dbt project using descriptions and commands. The documentation for your project includes:
2831
* **Information about your project**: including model code, a DAG of your project, any tests you've added to a column, and more.
2932
* **Information about your <Term id="data-warehouse" />**: including column data types, and <Term id="table" /> sizes. This information is generated by running queries against the information schema.
33+
* Importantly, dbt also provides a way to add **descriptions** to models, columns, sources, and more, to further enhance your documentation.
3034

31-
Importantly, dbt also provides a way to add **descriptions** to models, columns, sources, and more, to further enhance your documentation.
35+
The following sections describe how to [add descriptions](#adding-descriptions-to-your-project) to your project, [generate documentation](#generating-documentation), how to use [docs blocks](#using-docs-blocks), and set a [custom overview](#setting-a-custom-overview) for your documentation.
3236

3337
## Adding descriptions to your project
34-
To add descriptions to your project, use the `description:` key in the same files where you declare [tests](/docs/build/data-tests), like so:
38+
39+
Before generating documentation, add [descriptions](/reference/resource-properties/description) to your project resources. Add the `description:` key to the same YAML files where you declare [tests](/docs/build/data-tests). For example:
3540

3641
<File name='models/<filename>.yml'>
3742

@@ -56,33 +61,42 @@ models:
5661
- not_null
5762

5863
```
59-
6064
</File>
6165

62-
## Generating project documentation
6366

64-
The default documentation experience in dbt Cloud is [dbt Explorer](/docs/collaborate/explore-projects), available on [Team or Enterprise plans](https://www.getdbt.com/pricing/). Use dbt Explorer to view your project's resources (such as models, tests, and metrics), its [metadata](/docs/collaborate/explore-projects#generate-metadata), and their lineage to gain a better understanding of its latest production state.
67+
### FAQs
68+
<FAQ path="Project/example-projects" alt_header="Are there any example dbt documentation sites?"/>
69+
<FAQ path="Docs/document-all-columns" />
70+
<FAQ path="Docs/long-descriptions" />
71+
<FAQ path="Docs/sharing-documentation" />
72+
<FAQ path="Docs/document-other-resources" />
6573

66-
dbt Cloud developer and dbt Core users can use [dbt Docs](/docs/collaborate/build-and-view-your-docs#dbt-docs), which generates basic documentation, but doesn't offer the same speed, metadata, or visibility as dbt Explorer.
74+
## Generating documentation
6775

6876
Generate documentation for your project by following these steps:
6977

70-
1. Run `dbt docs generate` — this command tells dbt to compile relevant information about your dbt project and warehouse into `manifest.json` and `catalog.json` files, respectively.
71-
2. Ensure you've created the models with `dbt run` to view the documentation for all columns, not just those described in your project.
72-
3. Run `dbt docs serve` if you're developing locally to use these `.json` files to populate a local website.
78+
1. Run the `dbt docs generate` [command](/reference/commands/cmd-docs#dbt-docs-generate) to compile relevant information about your dbt project and warehouse into `manifest.json` and `catalog.json` files, respectively.
79+
2. Ensure you've created the models with `dbt run` or `dbt build` to view the documentation for all columns, not just those described in your project.
80+
3. Run the `dbt docs serve` [command](/reference/commands/cmd-docs#dbt-docs-serve) if you're developing locally to use these `.json` files to populate a local website.
7381

74-
To view a resource, its metadata, and what commands are needed in dbt Explorer, refer to [generate metadata](/docs/collaborate/explore-projects#generate-metadata) for more details.
82+
dbt provides two complementary ways to [view documentation](/docs/build/view-documentation), and your descriptions, after it's generated:
7583

76-
## FAQs
77-
<FAQ path="Project/example-projects" alt_header="Are there any example dbt documentation sites?"/>
78-
<FAQ path="Docs/document-all-columns" />
79-
<FAQ path="Docs/long-descriptions" />
80-
<FAQ path="Docs/sharing-documentation" />
81-
<FAQ path="Docs/document-other-resources" />
84+
- [**dbt Docs**:](/docs/build/view-documentation#dbt-docs) A static documentation site with model lineage, metadata, and documentation that can be hosted on your web server (like S3 or Netlify). Available for dbt Core or dbt Cloud Developer plans.
85+
- [**dbt Explorer**](/docs/collaborate/explore-projects): Builds upon dbt Docs to provide a dynamic, real-time interface with enhanced metadata, customizable views, deeper project insights, and collaboration tools. Available on dbt Cloud Team or Enterprise plans.
86+
87+
See [View documentation](/docs/build/view-documentation) to get the most out of your dbt project's documentation.
8288

8389
## Using docs blocks
90+
91+
Docs blocks provide a robust method for documenting models and other resources using Jinja and markdown. Docs block files can contain arbitrary markdown, but they must be uniquely named.
92+
8493
### Syntax
85-
To declare a docs block, use the jinja `docs` tag. Docs blocks can contain arbitrary markdown, but they must be uniquely named. Their names may contain uppercase and lowercase letters (A-Z, a-z), digits (0-9), and underscores (_), but can't start with a digit.
94+
To declare a docs block, use the Jinja `docs` tag. Their names may contain:
95+
96+
- Can't start with a digit
97+
- Uppercase and lowercase letters (A-Z, a-z)
98+
- Digits (0-9)
99+
- Underscores (_)
86100

87101
<File name='events.md'>
88102

@@ -102,7 +116,7 @@ The events in this table are recorded by [Snowplow](http://github.com/snowplow/s
102116

103117
</File>
104118

105-
In the above example, a docs block named `table_events` is defined with some descriptive markdown contents. There is nothing significant about the name `table_events` — docs blocks can be named however you like, as long as the name only contains alphanumeric and underscore characters and does not start with a numeric character.
119+
In this example, a docs block named `table_events` is defined with some descriptive markdown contents. There is nothing significant about the name `table_events` — docs blocks can be named however you like, as long as the name only contains alphanumeric and underscore characters and doesn't start with a numeric character.
106120

107121
### Placement
108122

@@ -118,9 +132,8 @@ Docs blocks should be placed in files with a `.md` file extension. By default, d
118132

119133
</VersionBlock>
120134

121-
122135
### Usage
123-
To use a docs block, reference it from your `schema.yml` file with the [doc()](/reference/dbt-jinja-functions/doc) function in place of a markdown string. Using the examples above, the `table_events` docs can be included in the `schema.yml` file as shown below:
136+
To use a docs block, reference it from your `schema.yml` file with the [doc()](/reference/dbt-jinja-functions/doc) function in place of a markdown string. Using the examples above, the `table_events` docs can be included in the `schema.yml` file as shown here:
124137

125138
<File name='schema.yml'>
126139

@@ -147,7 +160,11 @@ In the resulting documentation, `'{{ doc("table_events") }}'` will be expanded t
147160
## Setting a custom overview
148161
*Currently available for dbt Docs only.*
149162

150-
The "overview" shown in the dbt Docs website can be overridden by supplying your own docs block called `__overview__`. By default, dbt supplies an overview with helpful information about the docs site itself. Depending on your needs, it may be a good idea to override this docs block with specific information about your company style guide, links to reports, or information about who to contact for help. To override the default overview, create a docs block that looks like this:
163+
The "overview" shown in the dbt Docs website can be overridden by supplying your own docs block called `__overview__`.
164+
165+
- By default, dbt supplies an overview with helpful information about the docs site itself.
166+
- Depending on your needs, it may be a good idea to override this docs block with specific information about your company style guide, links to reports, or information about who to contact for help.
167+
- To override the default overview, create a docs block that looks like this:
151168

152169
<File name='models/overview.md'>
153170

@@ -168,7 +185,9 @@ as well as the repo for this project \[here](https://github.com/dbt-labs/mrr-pla
168185
*Currently available for dbt Docs only.*
169186

170187
You can set different overviews for each dbt project/package included in your documentation site
171-
by creating a docs block named `__[project_name]__`. For example, in order to define
188+
by creating a docs block named `__[project_name]__`.
189+
190+
For example, in order to define
172191
custom overview pages that appear when a viewer navigates inside the `dbt_utils` or `snowplow` package:
173192

174193
<File name='models/overview.md'>
@@ -190,48 +209,3 @@ up to page views and sessions.
190209
```
191210

192211
</File>
193-
194-
## Navigating the documentation site
195-
196-
Use [dbt Explorer](/docs/collaborate/explore-projects) for a richer documentation experience and more interactive experience for understanding your project's resources and lineage. Available on [Team or Enterprise plans](https://www.getdbt.com/pricing/).
197-
198-
For additional details on how to explore your lineage and navigate your resources, refer to [dbt Explorer](/docs/collaborate/explore-projects).
199-
200-
<Lightbox src="/img/docs/collaborate/dbt-explorer/example-model-details.png" width="100%" title="Example of resource details" />
201-
202-
<Expandable alt_header="For dbt Docs">
203-
If you're using the dbt Docs interface, you can navigate to the documentation for a specific model. That might look something like this:
204-
205-
<Lightbox src="/img/docs/building-a-dbt-project/testing-and-documentation/f2221dc-Screen_Shot_2018-08-14_at_6.29.55_PM.png" title="Auto-generated documentation for a dbt model"/>
206-
207-
Here, you can see a representation of the project structure, a markdown description for a model, and a list of all of the columns (with documentation) in the model.
208-
209-
From the dbt Docs page, you can click the green button in the bottom-right corner of the webpage to expand a "mini-map" of your DAG. This pane (shown below) will display the immediate parents and children of the model that you're exploring.
210-
211-
<Lightbox src="/img/docs/building-a-dbt-project/testing-and-documentation/ec77c45-Screen_Shot_2018-08-14_at_6.31.56_PM.png" title="Opening the DAG mini-map"/>
212-
213-
In this example, the `fct_subscription_transactions` model only has one direct parent. By clicking the "Expand" button in the top-right corner of the window, we can pivot the graph horizontally and view the full <Term id="data-lineage">lineage</Term> for our model. This lineage is filterable using the `--select` and `--exclude` flags, which are consistent with the semantics of [model selection syntax](/reference/node-selection/syntax). Further, you can right-click to interact with the DAG, jump to documentation, or share links to your graph visualization with your coworkers.
214-
215-
<Lightbox src="/img/docs/building-a-dbt-project/testing-and-documentation/ac97fba-Screen_Shot_2018-08-14_at_6.35.14_PM.png" title="The full lineage for a dbt model"/>
216-
217-
</Expandable>
218-
219-
## Deploying the documentation site
220-
221-
With dbt Cloud, use [dbt Explorer](/docs/collaborate/explore-projects) automatically retrieves the metadata updates after each job run in the production or staging deployment environment so it always has the latest results for your project &mdash; meaning it's always automatically updated after each job run.
222-
223-
:::caution Security
224-
225-
The `dbt docs serve` command is only intended for local/development hosting of the documentation site. Please use one of the methods listed below (or similar) to ensure that your documentation site is hosted securely!
226-
227-
:::
228-
229-
#### For dbt Docs users
230-
231-
dbt's documentation website was built to make it easy to host on the web. The site is "static,” meaning you don't need any "dynamic" servers to serve the docs. You can host your documentation in several ways:
232-
233-
* Use [dbt Cloud's](/docs/collaborate/build-and-view-your-docs) default documentation experience with [dbt Explorer](/docs/collaborate/explore-projects).
234-
* Host on [Amazon S3](https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html) (optionally [with IP access restrictions](https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html#example-bucket-policies-use-case-3))
235-
* Publish with [Netlify](https://discourse.getdbt.com/t/publishing-dbt-docs-to-netlify/121)
236-
* Use your own web server like Apache/Nginx
237-

0 commit comments

Comments
 (0)