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
- 👥 Models should be pluralized, for example, `customers`, `orders`, `products`.
9
9
- 🔑 Each model should have a primary key.
10
10
- 🔑 The primary key of a model should be named `<object>_id`, for example, `account_id`. This makes it easier to know what `id` is being referenced in downstream joined models.
11
+
- Use underscores for naming dbt models; avoid dots.
12
+
- ✅ `models_without_dots`
13
+
- ❌ `models.with.dots`
14
+
- Most data platforms use dots to separate `database.schema.object`, so using underscores instead of dots reduces your need for [quoting](/reference/resource-properties/quoting) as well as the risk of issues in certain parts of dbt Cloud. For more background, refer to [this GitHub issue](https://github.com/dbt-labs/dbt-core/issues/3246).
11
15
- 🔑 Keys should be string data types.
12
16
- 🔑 Consistency is key! Use the same field names across models where possible. For example, a key to the `customers` table should be named `customer_id` rather than `user_id` or 'id'.
13
17
- ❌ Do not use abbreviations or aliases. Emphasize readability over brevity. For example, do not use `cust` for `customer` or `o` for `orders`.
dbt Core and Cloud are composed of different moving parts working harmoniously. All of them are important to what dbt does — transforming data—the 'T' in ELT. When you execute `dbt run`, you are running a model that will transform your data without that data ever leaving your warehouse.
12
10
13
11
Models are where your developers spend most of their time within a dbt environment. Models are primarily written as a `select` statement and saved as a `.sql` file. While the definition is straightforward, the complexity of the execution will vary from environment to environment. Models will be written and rewritten as needs evolve and your organization finds new ways to maximize efficiency.
Copy file name to clipboardExpand all lines: website/docs/docs/build/sql-models.md
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,10 @@ dbt's Python capabilities are an extension of its capabilities with SQL models.
29
29
A SQL model is a `select` statement. Models are defined in `.sql` files (typically in your `models` directory):
30
30
- Each `.sql` file contains one model / `select` statement
31
31
- The model name is inherited from the filename.
32
-
- Models can be nested in subdirectories within the `models` directory
32
+
- We strongly recommend using underscores for model names, not dots. For example, use `models/my_model.sql` instead of `models/my.model.sql`.
33
+
- Models can be nested in subdirectories within the `models` directory.
34
+
35
+
Refer to [How we style our dbt models](/best-practices/how-we-style/1-how-we-style-our-dbt-models) for details on how we recommend you name your models.
33
36
34
37
When you execute the [`dbt run` command](/reference/commands/run), dbt will build this model <Termid="data-warehouse" /> by wrapping it in a `create view as` or `create table as` statement.
-[Version control basics](/docs/collaborate/git/version-control-basics)
139
139
-[dbt Commands](/reference/dbt-commands)
140
-
-[dbt Cloud IDE release notes](/tags/ide)
141
140
142
141
## Related questions
143
142
144
-
<FAQpath="Git/gitignore"/> <br />
145
-
146
-
<details>
147
-
<summary>Is there a cost to using the Cloud IDE?</summary>
148
-
<div>
149
-
<div>Not at all! You can use dbt Cloud when you sign up for the <a href="https://www.getdbt.com/pricing/">Free Developer plan</a>, which comes with one developer seat. If you’d like to access more features or have more developer seats, you can upgrade your account to the Team or Enterprise plan. See <a href="https://www.getdbt.com/pricing/">dbt pricing plans</a> for more details. </div>
150
-
</div>
151
-
</details>
152
-
<details>
153
-
<summary>Can I be a contributor to dbt Cloud?</summary>
154
-
<div>
155
-
<div>Anyone can contribute to the dbt project. And whether it's a dbt package, a plugin, dbt-core, or this documentation site, contributing to the open-source code that supports the dbt ecosystem is a great way to level yourself up as a developer, and give back to the community. See <a href="https://docs.getdbt.com/community/resources/oss-expectations">Contributing</a> for details on what to expect when contributing to the dbt open source software (OSS). </div>
156
-
</div>
157
-
</details>
158
-
<details>
159
-
<summary>What is the difference between developing on the dbt Cloud IDE, the dbt Cloud CLI, and dbt Core?</summary>
160
-
<div>
161
-
<div>You can develop dbt using the web-based IDE in dbt Cloud or on the command line interface using the dbt Cloud CLI or open-source dbt Core, all of which enable you to execute dbt commands. The key distinction between the dbt Cloud CLI and dbt Core is the dbt Cloud CLI is tailored for dbt Cloud's infrastructure and integrates with all its features.<br /><br />
162
-
<span>— </span>
163
-
<b>dbt Cloud IDE:</b> <a href="https://docs.getdbt.com/docs/cloud/about-cloud/dbt-cloud-features">dbt Cloud</a> is a web-based application that allows you to develop dbt projects with the IDE, includes a purpose-built scheduler, and provides an easier way to share your dbt documentation with your team. The IDE is a faster and more reliable way to deploy your dbt models and provides a real-time editing and execution environment for your dbt project. <br /><br />
164
-
<span>— </span>
165
-
<b>dbt Cloud CLI: </b> <a href="https://docs.getdbt.com/docs/cloud/cloud-cli-installation">The dbt Cloud CLI</a> allows you to run dbt commands against your dbt Cloud development environment from your local command line or code editor. It supports cross-project ref, speedier, lower-cost builds, automatic deferral of build artifacts, and more. <br /><br />
166
-
<span>— </span>
167
-
<b>dbt Core:</b> dbt Core is an <a href="https://github.com/dbt-labs/dbt">open-sourced</a> software that’s freely available. You can build your dbt project in a code editor, and run dbt commands from the command line.
168
-
</div>
169
-
</div>
170
-
</details>
143
+
<FAQpath="Git/gitignore"/>
144
+
145
+
<detailsTogglealt_header="Is there a cost to using the Cloud IDE?">
146
+
Not at all! You can use dbt Cloud when you sign up for the <ahref="https://www.getdbt.com/pricing/">Free Developer plan</a>, which comes with one developer seat. If you’d like to access more features or have more developer seats, you can upgrade your account to the Team or Enterprise plan.<br />
147
+
148
+
Refer to <ahref="https://www.getdbt.com/pricing/">dbt pricing plans</a> for more details.
149
+
</detailsToggle>
150
+
151
+
<detailsTogglealt_header="Can I be a contributor to dbt Cloud?">
152
+
As a proprietary product, dbt Cloud's source code isn't available for community contributions. If you want to build something in the dbt ecosystem, we encourage you to review [this article](/community/contributing/contributing-coding) about contributing to a dbt package, a plugin, dbt-core, or this documentation site. Participation in open-source is a great way to level yourself up as a developer, and give back to the community.
153
+
</detailsToggle>
154
+
155
+
<detailsTogglealt_header="What is the difference between developing on the dbt Cloud IDE, the dbt Cloud CLI, and dbt Core?">
156
+
You can develop dbt using the web-based IDE in dbt Cloud or on the command line interface using the dbt Cloud CLI or open-source dbt Core, all of which enable you to execute dbt commands. The key distinction between the dbt Cloud CLI and dbt Core is the dbt Cloud CLI is tailored for dbt Cloud's infrastructure and integrates with all its features:
157
+
158
+
- dbt Cloud IDE: <ahref="https://docs.getdbt.com/docs/cloud/about-cloud/dbt-cloud-features">dbt Cloud</a> is a web-based application that allows you to develop dbt projects with the IDE, includes a purpose-built scheduler, and provides an easier way to share your dbt documentation with your team. The IDE is a faster and more reliable way to deploy your dbt models and provides a real-time editing and execution environment for your dbt project.
159
+
160
+
- dbt Cloud CLI: <ahref="https://docs.getdbt.com/docs/cloud/cloud-cli-installation">The dbt Cloud CLI</a> allows you to run dbt commands against your dbt Cloud development environment from your local command line or code editor. It supports cross-project ref, speedier, lower-cost builds, automatic deferral of build artifacts, and more.
161
+
162
+
- dbt Core: dbt Core is an <ahref="https://github.com/dbt-labs/dbt">open-sourced</a> software that’s freely available. You can build your dbt project in a code editor, and run dbt commands from the command line
0 commit comments