Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding 1.8 install changes #5002

Merged
merged 10 commits into from
Feb 28, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ Next, before you start writing code, you need to install MetricFlow:

- Download MetricFlow as an extension of a dbt adapter from PyPI (dbt Core users only). The MetricFlow is compatible with Python versions 3.8 through 3.11.
- **Note**: You'll need to manage versioning between dbt Core, your adapter, and MetricFlow.
- We'll use pip to install MetricFlow and our dbt adapter:
- Beginning in v1.8, installing an adapter no longer automatically installs `dbt-core`. This is because adapters and dbt Core versions have been decoupled from each other so we no longer want to overwrite existing dbt-core installations.
runleonarun marked this conversation as resolved.
Show resolved Hide resolved
runleonarun marked this conversation as resolved.
Show resolved Hide resolved
- Use pip to install MetricFlow and the dbt adapter.

```shell
# activate a virtual environment for your project,
Expand Down
55 changes: 51 additions & 4 deletions website/docs/docs/core/pip-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ title: "Install with pip"
description: "You can use pip to install dbt Core and adapter plugins from the command line."
---

You need to use `pip` to install dbt Core on Windows or Linux operating systems. You can use `pip` or [Homebrew](/docs/core/homebrew-install) for installing dbt Core on a MacOS.
You need to use `pip` to install dbt Core on Windows or Linux operating systems. You can use `pip` or [Homebrew](/docs/core/homebrew-install) for installing dbt Core on a MacOS.

You can install dbt Core and plugins using `pip` because they are Python modules distributed on [PyPI](https://pypi.org/project/dbt-core/).

<FAQ path="Core/install-pip-os-prereqs" />
<FAQ path="Core/install-python-compatibility" />

### Using virtual environments
We recommend using virtual environments (venv) to namespace pip modules.

We recommend using virtual environments (venv) to namespace pip modules.

1. Create a new venv:

Expand All @@ -27,6 +28,7 @@ dbt-env\Scripts\activate # activate the environment for Windows
```

#### Create an alias

To activate your dbt environment with every new shell window or session, you can create an alias for the source command in your $HOME/.bashrc, $HOME/.zshrc, or whichever config file your shell draws from.

For example, add the following to your rc file, replacing <PATH_TO_VIRTUAL_ENV_CONFIG> with the path to your virtual environment configuration.
Expand All @@ -36,10 +38,31 @@ alias env_dbt='source <PATH_TO_VIRTUAL_ENV_CONFIG>/bin/activate'
```

### Installing the adapter
Once you know [which adapter](/docs/supported-data-platforms) you're using, you can install it as `dbt-<adapter>`. For example, if using Postgres:

Once you decide [which adapter](/docs/supported-data-platforms) you're using, you can install using the command line. Beginning in v1.8, installing an adapter no longer automatically installs `dbt-core`. This is because adapters and dbt Core versions have been decoupled from each other so we no longer want to overwrite existing dbt-core installations.
runleonarun marked this conversation as resolved.
Show resolved Hide resolved

<VersionBlock firstVersion="1.8">

```shell
python -m pip install dbt-postgres
python -m pip install dbt-core dbt-ADAPTER_NAME.
runleonarun marked this conversation as resolved.
Show resolved Hide resolved
```

</VersionBlock>

<VersionBlock lastVersion="1.7">

```shell
python -m pip install dbt-ADAPTER_NAME
```

</VersionBlock>

For example, if using Postgres:

<VersionBlock lastVersion="1.8">
runleonarun marked this conversation as resolved.
Show resolved Hide resolved

```shell
python -m pip install dbt-core dbt-postgres
```

This will install `dbt-core` and `dbt-postgres` _only_:
Expand All @@ -56,6 +79,29 @@ Plugins:
```

All adapters build on top of `dbt-core`. Some also depend on other adapters: for example, `dbt-redshift` builds on top of `dbt-postgres`. In that case, you would see those adapters included by your specific installation, too.
</VersionBlock>

<VersionBlock lastVersion="1.7">

```shell
python -m pip install dbt-postgres
```

This will install `dbt-core` and `dbt-postgres` _only_:

```shell
$ dbt --version
installed version: 1.0.0
latest version: 1.0.0

Up to date!

Plugins:
- postgres: 1.0.0
```

Some adapters depend on other adapters. For example, `dbt-redshift` builds on top of `dbt-postgres`. In that case, you would see those adapters included by your specific installation, too.
</VersionBlock>

### Upgrade adapters

Expand All @@ -72,6 +118,7 @@ If you're building a tool that integrates with dbt Core, you may want to install
```shell
python -m pip install dbt-core
```

### Change dbt Core versions

You can upgrade or downgrade versions of dbt Core by using the `--upgrade` option on the command line (CLI). For more information, see [Best practices for upgrading in Core versions](/docs/dbt-versions/core#best-practices-for-upgrading).
Expand Down
40 changes: 35 additions & 5 deletions website/docs/docs/core/source-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,58 @@ Downloading and building dbt Core will enable you to contribute to the project b

### Installing dbt Core

To install `dbt-core` from the GitHub code source:
Beginning in v1.8, installing an adapter no longer automatically installs `dbt-core`. This is because adapters and dbt Core versions have been decoupled from each other so we no longer want to overwrite existing dbt-core installations
runleonarun marked this conversation as resolved.
Show resolved Hide resolved

<VersionBlock firstVersion="1.8">

To install `dbt-core` only from the GitHub code source:

```shell
git clone https://github.com/dbt-labs/dbt-core.git
cd dbt-core
python -m pip install -r requirements.txt
```

</VersionBlock>

<VersionBlock lastVersion="1.7">

To install `dbt-core` and `dbt-postgres` from the GitHub code source:

```shell
git clone https://github.com/dbt-labs/dbt-core.git
cd dbt-core
python -m pip install -r requirements.txt
```
</VersionBlock>

This will install `dbt-core` and `dbt-postgres`. To install in editable mode (includes your local changes as you make them), use `python -m pip install -e editable-requirements.txt` instead.
To install in editable mode, which includes your local changes as you make them:

```shell
python -m pip install -e editable-requirements.txt` instead.
```

### Installing adapter plugins

To install an adapter plugin from source, you will need to first locate its source repository. For instance, the `dbt-redshift` adapter is located at https://github.com/dbt-labs/dbt-redshift.git, so I can clone it and install from there:
To install an adapter plugin from source, you will need to first locate its source repository. For instance, the `dbt-redshift` adapter is located at https://github.com/dbt-labs/dbt-redshift.git, so you can clone it and install from there:

<VersionBlock firstVersion="1.8">

You will also need to install `dbt-core` before installing an adapter plugin.

</VersionBlock>

<VersionBlock lastVersion="1.7">

You do _not_ need to install `dbt-core` before installing an adapter plugin -- the plugin includes `dbt-core` among its dependencies, and it will install the latest compatible version automatically.
</VersionBlock>

```shell
git clone https://github.com/dbt-labs/dbt-redshift.git
cd dbt-redshift
python -m pip install .
```

You do _not_ need to install `dbt-core` before installing an adapter plugin -- the plugin includes `dbt-core` among its dependencies, and it will install the latest compatible version automatically.

To install in editable mode, such as while contributing, use `python -m pip install -e .` instead.

<FAQ path="Core/install-pip-os-prereqs" />
Expand Down
Loading