From 9533927851012871e1b9ccc42a6c706d04ca2f07 Mon Sep 17 00:00:00 2001 From: Niall Woodward Date: Mon, 28 Mar 2022 12:32:36 +0100 Subject: [PATCH] Release 2.0.0 --- CHANGELOG.md | 18 ++++++++++++++++++ README.md | 16 +++++++++++----- pyproject.toml | 2 +- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87ea177..b5c7ccd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +## [2.0.0](https://github.com/brooklyn-data/dbtenv/compare/v2.0.0a2...v2.0.0) + +### Added +- dbtenv now operates at the adapter-version level, introduced by dbt in version 1.0.0. dbtenv can automatically detect the needed adapter version from `profiles.yml`, or the `--adapter` argument set in a dbt command passed to `dbtenv --execute`. +- The execute command's `--dbt` argument can now take either a dbt version (e.g. 1.0.0) or full pip specifier to use (e.g. dbt-snowflake==1.0.0). dbtenv will attempt to automatically detect the required adapter or version from the environment if not specified. +- dbtenv's version command and config files can now use a dbt version (e.g. 1.0.0) or full pip specifier to use (e.g. dbt-snowflake==1.0.0). dbtenv will attempt to automatically detect the required adapter or version from the environment if not specified. + +### Changed +- Dropped support for Homebrew. +- Previously created environments through dbtenv 1.0.0 will be ignored. +- dbtenv's default behaviour is now to install missing dbt adapter versions automatically. It can be disabled by setting the `DBTENV_AUTO_INSTALL` environment variable to `false`. +- Attempting to install a version of dbt which doesn't exist will exit cleanly, and provide a list of available versions for that adapter. +- Failed dbt version installations exit cleanly, removing the created virtual environment. + +### Fixed +- Only entries in the environment directory which are dbtenv 2.0.0 environments will be read as installed dbt versions, fixing an issue where dbtenv 1.0.0 environments caused a failure. +- Fixed version command, and all dbtenv config files. These can now take either a dbt version (e.g. 1.0.0) or full pip specifier to use (e.g. dbt-snowflake==1.0.0). dbtenv will attempt to automatically detect the required adapter or version from the environment if not specified. + ## [2.0.0a2](https://github.com/brooklyn-data/dbtenv/compare/v2.0.0a1...v2.0.0a2) ### Added diff --git a/README.md b/README.md index 1c5486f..915f449 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,10 @@ dbtenv is a version manager for dbt, automatically installing and switching to t 1. Install [pipx](https://pypa.github.io/pipx/) if you haven't already. 2. Run `pipx install dbtenv`. +## Basic example usage + +Run `dbtenv execute -- build` in a dbt project, and dbtenv will automatically download the required adapter and version for the project and run `dbt build`. We recommend [setting up an alias to dbtenv](https://github.com/brooklyn-data/dbtenv#running-dbt-with-dbtenv-more-seamlessly) so that you can run dbt commands as normal but through dbtenv. + ## How it works @@ -28,7 +32,7 @@ Some tips: ### Switching between dbt versions #### Adapter type -If a dbtenv command is invoked from within a dbt project, dbtenv will try to determine the in-use adapter from the default set for the project's profile in `profiles.yml`. If the `--adapter` argument is set in the dbt command passed to `dbtenv execute`, dbtenv will use that adapter's type instead. +If a dbtenv command is invoked from within a dbt project, dbtenv will try to determine the in-use adapter from the default set for the project's profile in `profiles.yml`. If the `--adapter` argument is set in the dbt command passed to `dbtenv execute`, dbtenv will use that adapter's type instead. If running outside of a dbt project, a pip specifier should be passed to dbtenv execute's `--dbt` argument so that dbtenv knows which adapter to use. #### dbt version @@ -37,7 +41,7 @@ dbtenv determines which dbt version to use by trying to read it from the followi 1. The `dbtenv execute` command's optional `--dbt ` argument. 2. A `DBT_VERSION` environment variable. 3. A `.dbt_version` file in the dbt project directory. -4. The [dbt version requirements](https://docs.getdbt.com/reference/project-configs/require-dbt-version/) of the dbt project and any dbt packages it uses. +4. The [dbt version requirements](https://docs.getdbt.com/reference/project-configs/require-dbt-version/) of the dbt project. - If the dbt version requirements specify a range of versions rather than an exact version, then dbtenv will try to read a preferred dbt version from the sources below and will use that version if it's compatible with the requirements. 5. The first `.dbt_version` file found by searching the dbt project's parent directories. 6. The `~/.dbt/version` file. @@ -47,15 +51,17 @@ dbtenv determines which dbt version to use by trying to read it from the followi You can: - Run `dbtenv version` to show which dbt version dbtenv determines dynamically based on the current environment. - Run `dbtenv which` to show the full path to the executable of the dbt version dbtenv determines dynamically based on the current environment. -- Run `dbtenv version --global ` to set the dbt version globally in the `~/.dbt/version` file. -- Run `dbtenv version --local ` to set the dbt version for the current directory in a `.dbt_version` file. +- Run `dbtenv version --global ` to set the dbt version globally in the `~/.dbt/version` file. The `` can be either a dbt version (e.g. 1.0.0) or full pip specifier (e.g. dbt-snowflake==1.0.0). dbtenv will attempt to automatically detect the required adapter or version from the environment if not specified. +- Run `dbtenv version --local ` to set the dbt version for the current directory in a `.dbt_version` file. The `` can be either a dbt version (e.g. 1.0.0) or full pip specifier (e.g. dbt-snowflake==1.0.0). dbtenv will attempt to automatically detect the required adapter or version from the environment if not specified. ### Running dbt through dbtenv Run `dbtenv execute -- ` to execute the dbt version determined dynamically based on the current environment, or run `dbtenv execute --dbt -- ` to execute the specified dbt version. For example: - `dbtenv execute -- run` will execute `dbt run` using the version determined dynamically based on the current environment. -- `dbtenv execute --dbt 0.19.0 -- run` will execute `dbt run` using dbt 0.19.0. +- `dbtenv execute --dbt 1.0.0 -- run` will execute `dbt run` using dbt 1.0.0, automatically detecting the required adapter from the default target in `profiles.yml`. +- `dbtenv execute --dbt 1.0.0 -- run --target prod` will execute `dbt run` using dbt 1.0.0, using the required adapter for the 'prod' target in `profiles.yml`. +- `dbtenv execute --dbt 1.0.0==dbt-bigquery -- run` will execute `dbt run` using dbt-bigquery==1.0.0. **Important:** It's highly recommended to put two dashes with spaces on both sides before the list of dbt arguments (as shown in the examples above) so that dbtenv doesn't try to interpret the dbt arguments itself. diff --git a/pyproject.toml b/pyproject.toml index 76cd84c..92940a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dbtenv" -version = "2.0.0a2" +version = "2.0.0" description = "dbtenv is a version manager for dbt, automatically installing and switching to the needed adapter and version of dbt." authors = ["Brooklyn Data Co. "] keywords = ["dbt"]