Skip to content

Commit

Permalink
Merge branch 'current' into sl-rn-dec
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 authored Dec 18, 2023
2 parents 17dcbc1 + b67bb6b commit f213c14
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -1,43 +1,35 @@
---
title: "Tips and tricks"
id: dbt-cloud-tips
description: "Check out any dbt Cloud and IDE-related tips."
sidebar_label: "Tips and tricks"
title: "dbt tips and tricks"
description: "Check out any dbt-related tips and tricks to help you work faster and be more productive."
sidebar_label: "dbt tips and tricks"
pagination_next: null
---

# dbt Cloud tips
Use this page for valuable insights and practical advice to enhance your dbt experience. Whether you're new to dbt or an experienced user, these tips are designed to help you work more efficiently and effectively.

The Cloud IDE provides keyboard shortcuts, features, and development tips to help you work faster and be more productive. Use this Cloud IDE cheat sheet to help you quickly reference some common operations.
The following tips are organized into the following categories:

## Cloud IDE Keyboard shortcuts
- [Package tips](#package-tips) to help you streamline your workflow.
- [Advanced tips and techniques](#advanced-tips-adn-techniques) to help you get the most out of dbt.

There are default keyboard shortcuts that can help make development more productive and easier for everyone.

- Press Fn-F1 to view a full list of the editor shortcuts
- Command-O on macOS or Control-O on Windows to select a file to open
- Command-P/Command-Shift-P on macOS or Control-P/Control-Shift-P on Windows to see the command palette
- Hold Option-click-on-area or press Shift-Option-Command on macOS or Hold-Alt-click-on-area on Windows to select multiple lines and perform a multi-edit. You can also press Command-E to perform this operation on the command line.
- Command-Enter on macOS or Control-Enter on Windows to Preview your code
- Command-Shift-Enter on macOS or Control-Shift-Enter on Windows to Compile
- Highlight a portion of code and use the above shortcuts to Preview or Compile code
- Enter two underscores (__) in the IDE to reveal a list of dbt functions
- Press Control-backtick (or Ctrl + `) to toggle the Invocation history
- Press Command-Option-forward slash on macOS or Control-Alt-forward slash on Windows on the selected code to add a block comment. SQL files will use the Jinja syntax `({# #})` rather than the SQL one `(/* */)`. Markdown files will use the Markdown syntax `(<!-- -->)`
- Option-W on macOS or Alt-W on Windows will close the currently active editor tab

If you're developing with the dbt Cloud IDE, you can refer to the [keyboard shortcuts](/docs/cloud/dbt-cloud-ide/keyboard-shortcuts) page to help make development more productive and easier for everyone.

## Package tips

- Use the [dbt_codegen](https://hub.getdbt.com/dbt-labs/codegen/latest/) package to help you generate YML files for your models and sources and SQL files for your staging models.
- The [dbt_utils](https://hub.getdbt.com/dbt-labs/dbt_utils/latest/) package contains macros useful for daily development. For example, `date_spine` generates a table with all dates between the ones provided as parameters.
- The [dbt_project_evaluator](https://hub.getdbt.com/dbt-labs/dbt_project_evaluator/latest) package compares your dbt project against a list of our best practices and provides suggestions and guidelines on how to update your models.
- The [dbt_expectations](https://hub.getdbt.com/calogica/dbt_expectations/latest) package contains many tests beyond those built into dbt Core.
- The [dbt_audit_helper](https://hub.getdbt.com/#:~:text=adwords-,audit_helper,-codegen) package lets you compare the output of 2 queries. Use it when refactoring existing logic to ensure that the new results are identical.
- The [dbt_artifacts](https://hub.getdbt.com/brooklyn-data/dbt_artifacts/latest) package saves information about your dbt runs directly to your data platform so that you can track the performance of models over time.
- The [dbt_meta_testing](https://hub.getdbt.com/tnightengale/dbt_meta_testing/latest) package checks that your dbt project is sufficiently tested and documented.
Leverage these dbt packages to streamline your workflow:

| Package | Description |
|---------|-------------|
| [`dbt_codegen`](https://hub.getdbt.com/dbt-labs/codegen/latest/) |Use the package to help you generate YML files for your models and sources and SQL files for your staging models. |
| [`dbt_utils`](https://hub.getdbt.com/dbt-labs/dbt_utils/latest/) | The package contains macros useful for daily development. For example, `date_spine` generates a table with all dates between the ones provided as parameters. |
| [`dbt_project_evaluator`](https://hub.getdbt.com/dbt-labs/dbt_project_evaluator/latest) | The package compares your dbt project against a list of our best practices and provides suggestions and guidelines on how to update your models. |
| [`dbt_expectations`](https://hub.getdbt.com/calogica/dbt_expectations/latest) | The package contains many tests beyond those built into dbt. |
| [`dbt_audit_helper`](https://hub.getdbt.com/#:~:text=adwords-,audit_helper,-codegen) | The package lets you compare the output of 2 queries. Use it when refactoring existing logic to ensure that the new results are identical. |
| [`dbt_artifacts`](https://hub.getdbt.com/brooklyn-data/dbt_artifacts/latest) | The package saves information about your dbt runs directly to your data platform so that you can track the performance of models over time. |
| [`dbt_meta_testing`](https://hub.getdbt.com/tnightengale/dbt_meta_testing/latest) | This package checks that your dbt project is sufficiently tested and documented. |

## Advanced tips
## Advanced tips and techniques

- Use your folder structure as your primary selector method. `dbt build --select marts.marketing` is simpler and more resilient than relying on tagging every model.
- Think about jobs in terms of build cadences and SLAs. Run models that have hourly, daily, or weekly build cadences together.
Expand All @@ -61,4 +53,4 @@ There are default keyboard shortcuts that can help make development more product

- [Quickstart guide](/guides)
- [About dbt Cloud](/docs/cloud/about-cloud/dbt-cloud-features)
- [Develop in the Cloud](/docs/cloud/dbt-cloud-ide/develop-in-the-cloud)
- [Develop in the Cloud](/docs/cloud/about-develop-dbt)
2 changes: 1 addition & 1 deletion website/docs/docs/cloud/about-cloud/about-cloud-ide.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ For more information, read the complete [Cloud IDE guide](/docs/cloud/dbt-cloud-
## Related docs

- [IDE user interface](/docs/cloud/dbt-cloud-ide/ide-user-interface)
- [Tips and tricks](/docs/cloud/dbt-cloud-ide/dbt-cloud-tips)
- [Keyboard shortcuts](/docs/cloud/dbt-cloud-ide/keyboard-shortcuts)
11 changes: 4 additions & 7 deletions website/docs/docs/cloud/dbt-cloud-ide/develop-in-the-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pagination_prev: null

The dbt Cloud integrated development environment (IDE) is a single web-based interface for building, testing, running, and version-controlling dbt projects. It compiles dbt code into SQL and executes it directly on your database.

The dbt Cloud IDE offers several [editing features](/docs/cloud/dbt-cloud-ide/ide-user-interface#editing-features) for faster and more efficient data platform development and governance:
The dbt Cloud IDE offers several [keyboard shortcuts](/docs/cloud/dbt-cloud-ide/keyboard-shortcuts) and [editing features](/docs/cloud/dbt-cloud-ide/ide-user-interface#editing-features) for faster and more efficient data platform development and governance:

- Syntax highlighting for SQL: Makes it easy to distinguish different parts of your code, reducing syntax errors and enhancing readability.
- Auto-completion: Suggests table names, arguments, and column names as you type, saving time and reducing typos.
Expand Down Expand Up @@ -44,17 +44,14 @@ To improve your experience using dbt Cloud, we suggest that you turn off ad bloc

## dbt Cloud IDE features

The dbt Cloud IDE comes with [tips](/docs/cloud/dbt-cloud-ide/dbt-cloud-tips) and [features](/docs/cloud/dbt-cloud-ide/ide-user-interface) that make it easier for you to develop, build, compile, run, and test data models.
The dbt Cloud IDE comes with [features](/docs/cloud/dbt-cloud-ide/ide-user-interface) that make it easier for you to develop, build, compile, run, and test data models.

:::tip Stay informed
To understand how to navigate the IDE and its user interface elements, refer to the [IDE user interface](/docs/cloud/dbt-cloud-ide/ide-user-interface) page.

To stay informed on IDE updates, read [dbt Cloud IDE release notes](/tags/ide), or refer to the [IDE user interface](/docs/cloud/dbt-cloud-ide/ide-user-interface) for comprehensive definitions and terminology of user interface elements.

:::

| Feature | Info |
|---|---|
| **Keyboard shortcuts** | You can access a variety of [commands and actions](/docs/cloud/dbt-cloud-ide/dbt-cloud-tips#cloud-ide-keyboard-shortcuts) in the IDE by choosing the appropriate keyboard shortcut. This includes the command palette (Command-P or Control-P), which has common shortcuts and build commands to optimize your developer workflow. For example, you can build modified models or continue the build from the last failure point. |
| [**Keyboard shortcuts**](/docs/cloud/dbt-cloud-ide/keyboard-shortcuts) | You can access a variety of [commands and actions](/docs/cloud/dbt-cloud-ide/keyboard-shortcuts) in the IDE by choosing the appropriate keyboard shortcut. Use the shortcuts for common tasks like building modified models or resuming builds from the last failure. |
| **File state indicators** | Ability to see when changes or actions have been made to the file. The indicators **M, D, A,** and **** appear to the right of your file or folder name and indicate the actions performed: <br /> <br /> - Unsaved **(•)** &mdash; The IDE detects unsaved changes to your file/folder<br /> - Modification **(M)** &mdash; The IDE detects a modification of existing files/folders<br /> - Added **(A)** &mdash; The IDE detects added files<br/> - Deleted **(D)** &mdash; The IDE detects deleted files.
| **IDE version control** | The IDE version control section and git button allow you to apply the concept of [version control](/docs/collaborate/git/version-control-basics) to your project directly into the IDE. <br /><br /> - Create or change branches<br /> - Commit or revert individual files by right-clicking the edited file<br /> - [Resolve merge conflicts](/docs/collaborate/git/merge-conflicts)<br /> - Execute git commands using the git button <br /> - Link to the repo directly by clicking the branch name |
| **Project documentation** | Generate and view your [project documentation](/docs/collaborate/build-and-view-your-docs) for your dbt project in real-time. You can inspect and verify what your project's documentation will look like before you deploy your changes to production. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The IDE features some delightful tools and layouts to make it easier for you to

1. **File Editor &mdash;** The File Editor is where users edit code. Tabs break out the region for each opened file, and unsaved files are marked with a blue dot icon in the tab view.

* Use intuitive [keyboard shortcuts](/docs/cloud/dbt-cloud-ide/dbt-cloud-tips#cloud-ide-keyboard-shortcuts) to help develop easier for you and your team.
* Use intuitive [keyboard shortcuts](/docs/cloud/dbt-cloud-ide/keyboard-shortcuts) to help develop easier for you and your team.

2. **Save button &mdash;** The editor has a **Save** button that saves editable files. Pressing the button or using the Command-S or Control-S shortcut saves the file contents. You don't need to save to preview code results in the Console section, but it's necessary before changes appear in a dbt invocation. The File Editor tab shows a blue icon for unsaved changes.

Expand Down
29 changes: 29 additions & 0 deletions website/docs/docs/cloud/dbt-cloud-ide/keyboard-shortcuts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "dbt Cloud IDE keyboard shortcuts"
description: "Learn about the keyboard shortcuts available in the Cloud IDE."
sidebar_label: "Keyboard shortcuts"
---


The Cloud IDE provides keyboard shortcuts, features, and development tips to help you work faster and be more productive.

Use this dbt Cloud IDE page to help you quickly reference some common operations.

| Shortcut description | macOS | Windows |
|--------|----------------|------------------|
| View a full list of editor shortcuts | Fn-F1 | Fn-F1 |
| Select a file to open | Command-O | Control-O |
| Open the command palette to invoke dbt commands and actions | Command-P or Command-Shift-P | Control-P or Control-Shift-P |
| Multi-edit by selecting multiple lines | Option-click or Shift-Option-Command | Hold Alt and click |
| Preview code | Command-Enter | Control-Enter |
| Compile code | Command-Shift-Enter | Control-Shift-Enter |
| Reveal a list of dbt functions | Enter two underscores `__` | Enter two underscores `__` |
| Toggle open the [Invocation history drawer](/docs/cloud/dbt-cloud-ide/ide-user-interface#invocation-history) located on the bottom of the IDE. | Control-backtick (or Control + `) | Control-backtick (or Ctrl + `) |
| Add a block comment to selected code. SQL files will use the Jinja syntax `({# #})` rather than the SQL one `(/* */)`.<br /> <br /> Markdown files will use the Markdown syntax `(<!-- -->)` | Command-Option-/ | Control-Alt-/ |
| Close the currently active editor tab | Option-W | Alt-W |

## Related docs

- [Quickstart guide](/guides)
- [About dbt Cloud](/docs/cloud/about-cloud/dbt-cloud-features)
- [Develop in the Cloud](/docs/cloud/dbt-cloud-ide/develop-in-the-cloud)
2 changes: 1 addition & 1 deletion website/docs/docs/cloud/dbt-cloud-ide/lint-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,4 @@ Make sure you're on a development branch. Formatting or Linting isn't available
## Related docs

- [User interface](/docs/cloud/dbt-cloud-ide/ide-user-interface)
- [Tips and tricks](/docs/cloud/dbt-cloud-ide/dbt-cloud-tips)
- [Keyboard shortcuts](/docs/cloud/dbt-cloud-ide/keyboard-shortcuts)
3 changes: 2 additions & 1 deletion website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ const sidebarSettings = {
link: { type: "doc", id: "docs/cloud/dbt-cloud-ide/develop-in-the-cloud" },
items: [
"docs/cloud/dbt-cloud-ide/develop-in-the-cloud",
"docs/cloud/dbt-cloud-ide/keyboard-shortcuts",
"docs/cloud/dbt-cloud-ide/ide-user-interface",
"docs/cloud/dbt-cloud-ide/lint-format",
"docs/cloud/dbt-cloud-ide/dbt-cloud-tips",
],
},
],
Expand All @@ -259,6 +259,7 @@ const sidebarSettings = {
link: { type: "doc", id: "docs/build/projects" },
items: [
"docs/build/projects",
"docs/build/dbt-tips",
{
type: "category",
label: "Build your DAG",
Expand Down
5 changes: 5 additions & 0 deletions website/vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
"cleanUrls": true,
"trailingSlash": false,
"redirects": [
{
"source": "/docs/cloud/dbt-cloud-ide/dbt-cloud-tips",
"destination": "/docs/build/dbt-tips",
"permanent": true
},
{
"source": "/docs/dbt-cloud-apis/discovery-schema-job-metric",
"destination": "/docs/dbt-cloud-apis/discovery-schema-environment",
Expand Down

0 comments on commit f213c14

Please sign in to comment.