Skip to main content

Install dbt Cloud CLI

Public preview functionality

The dbt Cloud CLI is currently in public preview. Share feedback or request features you'd like to see on the dbt community Slack.

dbt Cloud natively supports developing using a command line (CLI), empowering team members to contribute with enhanced flexibility and collaboration. The dbt Cloud CLI allows you to run dbt commands against your dbt Cloud development environment from your local command line.

dbt commands are run against dbt Cloud's infrastructure and benefit from:

  • Secure credential storage in the dbt Cloud platform.
  • Automatic deferral of build artifacts to your Cloud project's production environment.
  • Speedier, lower-cost builds.
  • Support for dbt Mesh (cross-project ref),
  • Significant platform improvements, to be released over the coming months.

The dbt Cloud CLI is available in all deployment regions and and for both multi-tenant and single-tenant accounts (Azure single-tenant not supported at this time).

Install dbt Cloud CLI

You can install the dbt Cloud CLI on the command line by using one of these methods:

Use native packages or a virtual environment to avoid overriding dbt Core

Installing the dbt Cloud CLI with pip replaces dbt Core. This change can be avoided by using the native install method and configuring your PATH or by creating a new virtual environment.

Otherwise, to switch back to dbt Core, uninstall the dbt Cloud CLI and follow the dbt Core installation instructions.

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 a virtual environment

We recommend using virtual environments (venv) to namespace cloud-cli.

  1. Create a new venv:

    python3 -m venv dbt-cloud
  2. Activate the virtual environment each time you create a shell window or session:

    source dbt-cloud/bin/activate         # activate the environment for Mac and Linux OR
    dbt-env\Scripts\activate # activate the environment for Windows
  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:

    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:

    dbt --version
  2. Make sure you're in your virtual environment and run the following command to install the dbt 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.

    pip3 uninstall dbt-core dbt
    pip3 install dbt-core==VERSION

Update dbt Cloud CLI

The following instructions explain how to update the dbt CLoud CLI to the latest version depending on your operating system.

During the public preview period, we recommend updating before filing a bug report. This is because the API is subject to breaking changes.

To update:

  • Make sure you're in your virtual environment
  • Run pip install --upgrade dbt.

Next steps

After installation, you can configure the dbt Cloud CLI for your dbt Cloud project and use it to run dbt commands similar to dbt Core.

For example, you can execute dbt compile to compile a project using dbt Cloud.

Note, that 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 file.

FAQs

What's the difference between the dbt Cloud CLI and dbt Core?
The dbt Cloud CLI and dbt Core, an open-source project, are both command line tools that enable you to run dbt commands. The key distinction is the dbt Cloud CLI is tailored for dbt Cloud's infrastructure and integrates with all its features.
How do I run both the dbt Cloud CLI and dbt Core?
For compatibility, both the dbt Cloud CLI and dbt Core are invoked by running dbt. This can create path conflicts if your operating system selects one over the other based on your $PATH environment variable (settings).

If you have dbt Core installed locally, either:

  1. Install using pip.

  2. Install natively, but ensure that 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.

You can always uninstall the dbt Cloud CLI to return to using dbt Core.

0