Skip to content

Commit

Permalink
adding new updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 committed Oct 27, 2023
1 parent 72189d4 commit 138a4ca
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 31 deletions.
63 changes: 36 additions & 27 deletions website/docs/docs/cloud/cloud-cli-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The dbt Cloud CLI is available in all [deployment regions](/docs/cloud/about-clo
You can install the dbt Cloud CLI on the command line by using one of these methods.

<details>
<summary>View a video tutorial for a step-by-step guide to installing</summary>
<summary>View a video tutorial for a step-by-step guide to installation.</summary>

<LoomVideo id="dd80828306c5432a996d4580135041b6?sid=fe1895b7-1281-4e42-9968-5f7d11768000"/>

Expand Down Expand Up @@ -145,43 +145,47 @@ Advanced users can configure multiple projects to use the same Cloud CLI executa
<TabItem value="pip" label="Existing dbt Core users (pip)">
If you already have dbt Core installed, you can install the dbt Cloud CLI using pip. Here are some considerations:
- **Prevent conflicts**<br/>
To prevent overwriting dbt Core, avoid installing the dbt Cloud CLI with `pip`. Instead, consider using the native installation method (Homebrew) and configure your PATH or create a new virtual environment.<br/>
- **Use both dbt Cloud CLI and dbt Core**<br/>
Have both the dbt Cloud CLI and dbt Core installed simultaneously to meet your needs. To avoid conflicts, alias the dbt Cloud CLI as "dbt-cloud." For more details, check the [FAQs](#faqs) if your operating system experiences path conflicts.<br/>
- **Switch from the dbt Cloud CLI to dbt Core**<br/>
If you've already installed the dbt Cloud CLI and need to switch back to dbt Core:
- Uninstall the dbt Cloud CLI using the command: `pip uninstall dbt`
- Reinstall dbt Core using the following command, replacing "adapter_name" with the appropriate adapter name:
```shell
pip install dbt-adapter_name --force-reinstall
```
For example, if I used Snowflake as an adapter, I would run: `pip install dbt-snowflake --force-reinstall`
:::info Use native packages or a virtual environment to prevent dbt Core conflicts
To prevent overwriting dbt Core, avoid installing the dbt Cloud CLI with pip. Instead, consider using the native installation method and configuring your PATH or create a new virtual environment.
If you've already installed the dbt Cloud CLI and need to switch back to dbt Core, uninstall the dbt Cloud CLI, and follow the dbt Core installation instructions.
You can also have both dbt Cloud CLI and dbt Core installed simultaneously. To avoid conflicts, alias the dbt Cloud CLI as `dbt-cloud`. For more details, check the [FAQs](#faqs) if your operating system experiences path conflicts.
:::
--------
Before installing the dbt Cloud CLI, make sure you have Python installed and your virtual environment venv or pyenv . If you already have a Python environment configured, you can skip to the [pip installation step](#install-dbt-cloud-cli-in-pip).
### Install a virtual environment
We recommend using virtual environments (venv) to namespace `cloud-cli`.
1. Create a new venv:
1. Create a new virtual environment named "dbt-cloud" with this command:
```shell
python3 -m venv dbt-cloud
```
2. Activate the virtual environment each time you create a shell window or session:
```shell
source dbt-cloud/bin/activate # activate the environment for Mac and Linux OR
dbt-env\Scripts\activate # activate the environment for Windows
```
2. Activate the virtual environment each time you create a shell window or session, depending on your operating system:
- For Mac and Linux, use: `source dbt-cloud/bin/activate`<br/>
- For Windows, use: `dbt-env\Scripts\activate`
3. (Mac and Linux only) Create an alias to activate your dbt environment with every new shell window or session. You can add the following to your shell's configuration file (for example, $HOME/.bashrc, $HOME/.zshrc) while replacing `<PATH_TO_VIRTUAL_ENV_CONFIG>` with the path to your virtual environment configuration:
3. (Mac and Linux only) Create an alias to activate your dbt environment with every new shell window or session. You can add the following to your shell's configuration file (for example, `$HOME/.bashrc, $HOME/.zshrc`) while replacing `<PATH_TO_VIRTUAL_ENV_CONFIG>` with the path to your virtual environment configuration:
```shell
alias env_dbt='source <PATH_TO_VIRTUAL_ENV_CONFIG>/bin/activate'
```
### Install dbt Cloud CLI in pip
1. (Optional) If you already have dbt Core installed, this installation will override that package. Note your dbt Core version in case you need to reinstall it later:
1. (Optional) If you already have dbt Core installed, this installation will override that package. Check your dbt Core version in case you need to reinstall it later by running the following command :
```bash
dbt --version
Expand All @@ -193,22 +197,23 @@ We recommend using virtual environments (venv) to namespace `cloud-cli`.
pip3 install dbt
```
3. (Optional) To revert back to dbt Core, first uninstall both the dbt Cloud CLI and dbt Core
4. Reinstall dbt Core using the version from Step 2.
3. (Optional) To revert back to dbt Core, first uninstall both the dbt Cloud CLI and dbt Core. Then reinstall dbt Core using the version from Step 1.
```bash
pip3 uninstall dbt-core dbt
pip3 install dbt-core==VERSION
```
4. After you've verified the installation, [configure](/docs/cloud/configure-cloud-cli) the dbt Cloud CLI for your dbt Cloud project and use it to run [dbt commands](/reference/dbt-commands) similar to dbt Core. For example, execute `dbt compile` to compile a project using dbt Cloud and validate your models and tests.
4. After you've verified the installation, [configure](/docs/cloud/configure-cloud-cli) the dbt Cloud CLI for your dbt Cloud project. You can then use it to run [dbt commands](/reference/dbt-commands) similar to dbt Core. For example, execute `dbt compile` to compile a project using dbt Cloud and validate your models and tests.
* If you're using the dbt Cloud CLI, you can connect to your data platform directly in the dbt Cloud interface and don't need a [`profiles.yml`](/docs/core/connect-data-platform/profiles.yml) file locally on your machine.
</TabItem>
</Tabs>
## Update dbt Cloud CLI
The following instructions explain how to update the dbt CLoud CLI to the latest version depending on your operating system.
Expand Down Expand Up @@ -246,6 +251,11 @@ To update:
</Tabs>
## dbt Cloud CLI extensions
Command line extensions are additional functionalities that you can add to a command line tool or shell environment. These extensions expand the capabilities of the CLI, making it more versatile and efficient.
The dbt Cloud CLI doesn't currently support extensions, such as SQLFluff or dbt-power-user, during the public preview period. This is because.....
## FAQs
<details>
Expand All @@ -261,11 +271,10 @@ For compatibility, both the dbt Cloud CLI and dbt Core are invoked by running <c
If you have dbt Core installed locally, either:
1. Install using [pip](/docs/cloud/cloud-cli-installation?install=pip#install-dbt-cloud-cli).
2. Install natively, but ensure that you deactivate your Python environment or uninstall it using `pip uninstall dbt` before proceeding.
- Install using the <code>pip3 install dbt</code> [pip](/docs/cloud/cloud-cli-installation?install=pip#install-dbt-cloud-cli) command, or
- Install natively, however ensure you deactivate your Python environment or uninstall it using `pip uninstall dbt` before proceeding.
3. (Advanced users) Install natively, but modify the $PATH environment variable to correctly point to the dbt Cloud CLI binary to use both dbt Cloud CLI and dbt Core together.
1. (Advanced users) Install natively, but modify the $PATH environment variable to correctly point to the dbt Cloud CLI binary to use both dbt Cloud CLI and dbt Core together.
You can always uninstall the dbt Cloud CLI to return to using dbt Core.
</details>
Expand Down
17 changes: 17 additions & 0 deletions website/docs/reference/commands/clone.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The `clone` command is useful for:
- handling incremental models in dbt Cloud CI jobs (on data warehouses that support zero-copy cloning tables)
- testing code changes on downstream dependencies in your BI tool


```bash
# clone all of my models from specified state to my target schema(s)
dbt clone --state path/to/artifacts
Expand All @@ -37,3 +38,19 @@ Unlike deferral, `dbt clone` requires some compute and creation of additional ob
For example, by creating actual data warehouse objects, `dbt clone` allows you to test out your code changes on downstream dependencies _outside of dbt_ (such as a BI tool).

As another example, you could `clone` your modified incremental models as the first step of your dbt Cloud CI job to prevent costly `full-refresh` builds for warehouses that support zero-copy cloning.

## Cloning in dbt Cloud

You can clone nodes between states in dbt Cloud using the `dbt clone` command. This is available in the [dbt Cloud IDE](/docs/cloud/dbt-cloud-ide/develop-in-the-cloud) and the [dbt Cloud CLI](/docs/cloud/cloud-cli-installation) and relies on the [`--defer`](/reference/node-selection/defer) feature. For more details on defer in dbt Cloud, read [Using defer in dbt Cloud](/docs/cloud/about-cloud-develop-defer).

- **Using dbt Cloud CLI** &mdash; The `dbt clone` command in the dbt Cloud CLI automatically includes the `--defer` flag. This means you can use the `dbt clone` command in the dbt Cloud CLI without any additional setup.

- **Using dbt Cloud IDE** &mdash; To use the `dbt clone` command in the dbt Cloud IDE, follow these steps before running the `dbt clone` command:

- Set up your **Production environment** and have a successful job run.
- Enable **Defer to production** by toggling the switch in the lower-right corner of the command bar.
<Lightbox src="/img/docs/dbt-cloud/defer-toggle.jpg" width="80%" title="Select the 'Defer to production' toggle on the bottom right of the command bar to enable defer in the dbt Cloud IDE."/>
- Run the `dbt clone` command from the command bar.



8 changes: 4 additions & 4 deletions website/docs/reference/dbt-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The following sections outline the commands supported by dbt and their relevant

### Available commands

<VersionBlock firstVersion="1.5">
<VersionBlock firstVersion="1.6">

All commands in the table are compatible with either the dbt Cloud IDE, dbt Cloud CLI, or dbt Core.

Expand All @@ -22,9 +22,9 @@ You can run dbt commands in your specific tool by prefixing them with `dbt`. Fo
| [build](/reference/commands/build) | Build and test all selected resources (models, seeds, snapshots, tests) | All | All [supported versions](/docs/dbt-versions/core) |
| cancel | Cancels the most recent invocation.| dbt Cloud CLI | Requires [dbt v1.6 or higher](/docs/dbt-versions/core) |
| [clean](/reference/commands/clean) | Deletes artifacts present in the dbt project | All | All [supported versions](/docs/dbt-versions/core) |
| [clone](/reference/commands/clone) | Clone selected models from the specified state | dbt Cloud CLI <br /> dbt Core | Requires [dbt v1.6 or higher](/docs/dbt-versions/core) |
| [clone](/reference/commands/clone) | Clone selected models from the specified state | All | Requires [dbt v1.6 or higher](/docs/dbt-versions/core) |
| [compile](/reference/commands/compile) | Compiles (but does not run) the models in a project | All | All [supported versions](/docs/dbt-versions/core) |
| [debug](/reference/commands/debug) | Debugs dbt connections and projects | dbt Core | All [supported versions](/docs/dbt-versions/core) |
| [debug](/reference/commands/debug) | Debugs dbt connections and projects | All | All [supported versions](/docs/dbt-versions/core) |
| [deps](/reference/commands/deps) | Downloads dependencies for a project | All | All [supported versions](/docs/dbt-versions/core) |
| [docs](/reference/commands/cmd-docs) | Generates documentation for a project | All | All [supported versions](/docs/dbt-versions/core) |
| help | Displays help information for any command | dbt Core <br /> dbt Cloud CLI | All [supported versions](/docs/dbt-versions/core) |
Expand All @@ -43,7 +43,7 @@ You can run dbt commands in your specific tool by prefixing them with `dbt`. Fo

</VersionBlock>

<VersionBlock lastVersion="1.4">
<VersionBlock lastVersion="1.5">

Select the tabs that are relevant to your development workflow. For example, if you develop in the dbt Cloud IDE, select **dbt Cloud**.

Expand Down

0 comments on commit 138a4ca

Please sign in to comment.