From baf4053543ca11953de7ec0a75e2016da716bce8 Mon Sep 17 00:00:00 2001 From: Joel Labes Date: Fri, 3 Dec 2021 10:56:15 +1300 Subject: [PATCH] dbt v1 compat (#453) * dbt 0.7.4 release (#441) * Update require-dbt-version to be 1.0 * Fix SQL 42000 on Exasol (#420) " SQL-Error [42000]: syntax error, unexpected '*' " If you specify the * in the unioned with their respectiv names .* you do not receive the SQL Error posted above. This should not inflict any further problems since it is redundant for most DBs. * Minor readme link fixes (#431) * minor readme link fixes * changelog addition Co-authored-by: Joel Labes * 0.7.4 changelog (#432) * Update CHANGELOG.md * Note branch name change * use `limit_zero` macro instead of `limit 0` (#437) * Utils 0.7.4b1 (#433) * Update require-dbt-version to be 1.0 * Fix SQL 42000 on Exasol (#420) " SQL-Error [42000]: syntax error, unexpected '*' " If you specify the * in the unioned with their respectiv names .* you do not receive the SQL Error posted above. This should not inflict any further problems since it is redundant for most DBs. * Minor readme link fixes (#431) * minor readme link fixes * changelog addition Co-authored-by: Joel Labes * 0.7.4 changelog (#432) * Update CHANGELOG.md * Note branch name change Co-authored-by: Timo Kruth Co-authored-by: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> * standard convention * Update integration_tests/tests/jinja_helpers/test_slugify.sql Taking the liberty of committing on your behalf so that the CI job starts again * Change limit_zero to be a macro Co-authored-by: Joel Labes Co-authored-by: Timo Kruth Co-authored-by: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> * Add col_name alias to else state too (#437) * Remove extra semicolon in `insert_by_period` materialization (#439) * Remove extra semicolon in `insert_by_period` materialization. `create_table_as()` generates a SQL statement that already ends with a semicolon, so the extra semicolon after a `create_table_as()` call in the `insert_by_period` materialization ends up being an empty SQL statement, and at least when using Snowflake this causes the dbt run to fail with a "cannot unpack non-iterable NoneType object" error. * Update changelog for PR 439. * Use the relation object passed into get_column_values, instead of making our own (#440) * Use the relation object passed into get_column_values, instead of making our own * Rename variables in get column value test to be clearer * Update CHANGELOG.md * Update CHANGELOG.md Co-authored-by: Timo Kruth Co-authored-by: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> Co-authored-by: Anders Co-authored-by: Sean Rose * Regression: Correctly handle missing relations in get_column_values (#448) * Create integration test for a dropped relation * Update get_column_values.sql * Swap out adapter call for a good old fashioned drop table * Add missing curlies * what person wrote this code :/ (it was me) * wrap values in quotes * GOOD * bigquery compat (they don't like except) * Backport android url changes from #426 (#452) * Update CHANGELOG.md * Change require-dbt-version, update dbt_project.yml for integration tests proj * Upgrade python version in CI, improve drop relation integration test * Clarify version pinning * Drop support for release candidates of 1.0.0 Co-authored-by: Timo Kruth Co-authored-by: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> Co-authored-by: Anders Co-authored-by: Sean Rose --- .circleci/config.yml | 8 ++++---- CHANGELOG.md | 2 +- dbt_project.yml | 6 +++--- integration_tests/dbt_project.yml | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8869c8bb..2432273b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ jobs: integration-postgres: docker: - - image: circleci/python:3.6.13-stretch + - image: cimg/python:3.9.9 - image: circleci/postgres:9.6.5-alpine-ram steps: @@ -24,7 +24,7 @@ jobs: integration-redshift: docker: - - image: circleci/python:3.6.3-stretch + - image: cimg/python:3.9.9 steps: - checkout - run: @@ -35,7 +35,7 @@ jobs: integration-snowflake: docker: - - image: circleci/python:3.6.3-stretch + - image: cimg/python:3.9.9 steps: - checkout - run: @@ -48,7 +48,7 @@ jobs: environment: BIGQUERY_SERVICE_KEY_PATH: "/home/circleci/bigquery-service-key.json" docker: - - image: circleci/python:3.6.3-stretch + - image: cimg/python:3.9.9 steps: - checkout - run: diff --git a/CHANGELOG.md b/CHANGELOG.md index 75833b7b..6ad5e3e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # dbt-utils v0.8.0 ## 🚨 Breaking changes -- dbt ONE POINT OH is here! This version of dbt-utils requires `dbt-core ~=1.0.0` (any minor and patch version of v1), which means far less need for compatibility releases in the future. +- dbt ONE POINT OH is here! This version of dbt-utils requires _any_ version (minor and patch) of v1, which means far less need for compatibility releases in the future. - The partition column in the `mutually_exclusive_ranges` test is now always called `partition_by_col`. This enables compatibility with `--store-failures` when multiple columns are concatenated together. If you have models built on top of the failures table, update them to reflect the new column name. ([#423](https://github.com/dbt-labs/dbt-utils/issues/423), [#430](https://github.com/dbt-labs/dbt-utils/pull/430)) ## Contributors: diff --git a/dbt_project.yml b/dbt_project.yml index aaaf9d49..833501d8 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -1,11 +1,11 @@ name: 'dbt_utils' -version: '0.7.0' +version: '0.1.0' -require-dbt-version: [">=0.20.0", "<=1.0.0"] +require-dbt-version: [">=1.0.0", "<2.0.0"] config-version: 2 target-path: "target" -clean-targets: ["target", "dbt_modules"] +clean-targets: ["target", "dbt_modules", "dbt_packages"] macro-paths: ["macros"] log-path: "logs" diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml index 9631a8c4..bb6d147b 100644 --- a/integration_tests/dbt_project.yml +++ b/integration_tests/dbt_project.yml @@ -8,16 +8,17 @@ profile: 'integration_tests' config-version: 2 -source-paths: ["models"] +model-paths: ["models"] analysis-paths: ["analysis"] test-paths: ["tests"] -data-paths: ["data"] +seed-paths: ["data"] macro-paths: ["macros"] target-path: "target" # directory which will store compiled SQL files clean-targets: # directories to be removed by `dbt clean` - "target" - "dbt_modules" + - "dbt_packages" dispatch: - macro_namespace: 'dbt_utils' @@ -56,9 +57,8 @@ seeds: +schema: events data_get_column_values_dropped: - # TODO: Ideally this would use the adapter, but it gives a "Tried to drop relation, but its type is null" error. - #+post-hook: "{% do adapter.drop_relation(this) %}" - +post-hook: "drop table {{ this }}" + # this.incorporate() to hardcode the node's type as otherwise dbt doesn't know it yet + +post-hook: "{% do adapter.drop_relation(this.incorporate(type='table')) %}" schema_tests: