From 3a876fc9fe5375fb94e7548e0746a18c14a92078 Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Mon, 17 Jul 2023 17:19:42 -0500 Subject: [PATCH 01/45] add datadog env vars (#539) * add datadog env vars * move end vars --- .github/workflows/integration.yml | 7 ++++++- dev-requirements.txt | 1 + tox.ini | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 0d6d91855..3eec2b27f 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -134,6 +134,11 @@ jobs: TOXENV: integration-${{ matrix.adapter }} PYTEST_ADDOPTS: "-v --color=yes -n4 --csv integration_results.csv" DBT_INVOCATION_ENV: github-actions + DD_CIVISIBILITY_AGENTLESS_ENABLED: true + DD_API_KEY: ${{ secrets.DATADOG_API_KEY }} + DD_SITE: datadoghq.com + DD_ENV: ci + DD_SERVICE: ${{ github.event.repository.name }} steps: - name: Check out the repository @@ -180,7 +185,7 @@ jobs: DBT_TEST_USER_1: dbt_test_user_1 DBT_TEST_USER_2: dbt_test_user_2 DBT_TEST_USER_3: dbt_test_user_3 - run: tox + run: tox -- --ddtrace - uses: actions/upload-artifact@v3 if: always() diff --git a/dev-requirements.txt b/dev-requirements.txt index f4e1ecdae..03e853f9a 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -9,6 +9,7 @@ git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-postgres&subdirectory=plugi black~=23.3 bumpversion~=0.6.0 click~=8.1 +ddtrace~=1.16 flake8~=6.0 flaky~=3.7 freezegun~=1.2 diff --git a/tox.ini b/tox.ini index 285c1e738..e594c943a 100644 --- a/tox.ini +++ b/tox.ini @@ -20,6 +20,8 @@ passenv = DBT_* REDSHIFT_TEST_* PYTEST_ADDOPTS + DD_SERVICE + DD_ENV commands = {envpython} -m pytest --dist=loadscope {posargs} tests/functional -k "not tests/functional/adapter/utils" {envpython} -m pytest --dist=loadscope {posargs} tests/functional/adapter/utils From 18c315004d53e50fb822e93fb8eb25cfeb6eebdf Mon Sep 17 00:00:00 2001 From: FishtownBuildBot <77737458+FishtownBuildBot@users.noreply.github.com> Date: Tue, 18 Jul 2023 12:00:14 -0500 Subject: [PATCH 02/45] Cleanup main after cutting new 1.6.latest branch (#542) * Clean up changelog on main * pre-commit * pre-commit * re trigger tests --------- Co-authored-by: Matthew McKnight Co-authored-by: Matthew McKnight <91097623+McKnight-42@users.noreply.github.com> --- .bumpversion.cfg | 2 +- .changes/0.0.0.md | 1 + .changes/1.6.0-a1.md | 1 - .changes/1.6.0-b1.md | 10 --- .changes/1.6.0-b2.md | 11 --- .changes/1.6.0-b3.md | 23 ------ .changes/1.6.0-b4.md | 12 ---- .changes/1.6.0-b5.md | 5 -- .../Breaking Changes-20230522-111945.yaml | 7 -- .../Breaking Changes-20230530-165542.yaml | 6 -- .../Breaking Changes-20230614-144743.yaml | 6 -- .../1.6.0/Dependencies-20230421-032407.yaml | 6 -- .changes/1.6.0/Features-20230330-165842.yaml | 6 -- .changes/1.6.0/Features-20230604-041410.yaml | 6 -- .changes/1.6.0/Fixes-20230428-142321.yaml | 6 -- .changes/1.6.0/Fixes-20230508-094834.yaml | 6 -- .changes/1.6.0/Fixes-20230509-143721.yaml | 6 -- .changes/1.6.0/Fixes-20230512-082027.yaml | 6 -- .changes/1.6.0/Fixes-20230520-043039.yaml | 6 -- .changes/1.6.0/Fixes-20230524-151825.yaml | 6 -- .changes/1.6.0/Fixes-20230524-165236.yaml | 6 -- .changes/1.6.0/Fixes-20230531-153347.yaml | 7 -- .changes/1.6.0/Fixes-20230608-180130.yaml | 6 -- .changes/1.6.0/Fixes-20230612-114853.yaml | 6 -- .../1.6.0/Under the Hood-20230511-162623.yaml | 6 -- .../Dependencies-20230515-195952.yaml | 6 -- .../Dependencies-20230523-195945.yaml | 6 -- .../Dependencies-20230605-195944.yaml | 6 -- .../Dependencies-20230620-195844.yaml | 6 -- .../Dependencies-20230624-182902.yaml | 6 -- .../Dependencies-20230626-195917.yaml | 6 -- .../Dependencies-20230626-195934.yaml | 6 -- .../Dependencies-20230703-190419.yaml | 6 -- .../unreleased/Features-20230407-104723.yaml | 5 -- .../unreleased/Features-20230613-144752.yaml | 6 -- .../unreleased/Features-20230622-144649.yaml | 6 -- .../unreleased/Features-20230714-160100.yaml | 6 -- .../unreleased/Fixes-20230628-123227.yaml | 6 -- .../unreleased/Fixes-20230706-001056.yaml | 6 -- .../unreleased/Fixes-20230706-012233.yaml | 6 -- .../unreleased/Fixes-20230706-123329.yaml | 6 -- .../unreleased/Fixes-20230713-105351.yaml | 6 -- .../unreleased/Fixes-20230713-190412.yaml | 6 -- CHANGELOG.md | 71 +------------------ dbt/adapters/redshift/__version__.py | 2 +- 45 files changed, 4 insertions(+), 345 deletions(-) delete mode 100644 .changes/1.6.0-a1.md delete mode 100644 .changes/1.6.0-b1.md delete mode 100644 .changes/1.6.0-b2.md delete mode 100644 .changes/1.6.0-b3.md delete mode 100644 .changes/1.6.0-b4.md delete mode 100644 .changes/1.6.0-b5.md delete mode 100644 .changes/1.6.0/Breaking Changes-20230522-111945.yaml delete mode 100644 .changes/1.6.0/Breaking Changes-20230530-165542.yaml delete mode 100644 .changes/1.6.0/Breaking Changes-20230614-144743.yaml delete mode 100644 .changes/1.6.0/Dependencies-20230421-032407.yaml delete mode 100644 .changes/1.6.0/Features-20230330-165842.yaml delete mode 100644 .changes/1.6.0/Features-20230604-041410.yaml delete mode 100644 .changes/1.6.0/Fixes-20230428-142321.yaml delete mode 100644 .changes/1.6.0/Fixes-20230508-094834.yaml delete mode 100644 .changes/1.6.0/Fixes-20230509-143721.yaml delete mode 100644 .changes/1.6.0/Fixes-20230512-082027.yaml delete mode 100644 .changes/1.6.0/Fixes-20230520-043039.yaml delete mode 100644 .changes/1.6.0/Fixes-20230524-151825.yaml delete mode 100644 .changes/1.6.0/Fixes-20230524-165236.yaml delete mode 100644 .changes/1.6.0/Fixes-20230531-153347.yaml delete mode 100644 .changes/1.6.0/Fixes-20230608-180130.yaml delete mode 100644 .changes/1.6.0/Fixes-20230612-114853.yaml delete mode 100644 .changes/1.6.0/Under the Hood-20230511-162623.yaml delete mode 100644 .changes/unreleased/Dependencies-20230515-195952.yaml delete mode 100644 .changes/unreleased/Dependencies-20230523-195945.yaml delete mode 100644 .changes/unreleased/Dependencies-20230605-195944.yaml delete mode 100644 .changes/unreleased/Dependencies-20230620-195844.yaml delete mode 100644 .changes/unreleased/Dependencies-20230624-182902.yaml delete mode 100644 .changes/unreleased/Dependencies-20230626-195917.yaml delete mode 100644 .changes/unreleased/Dependencies-20230626-195934.yaml delete mode 100644 .changes/unreleased/Dependencies-20230703-190419.yaml delete mode 100644 .changes/unreleased/Features-20230407-104723.yaml delete mode 100644 .changes/unreleased/Features-20230613-144752.yaml delete mode 100644 .changes/unreleased/Features-20230622-144649.yaml delete mode 100644 .changes/unreleased/Features-20230714-160100.yaml delete mode 100644 .changes/unreleased/Fixes-20230628-123227.yaml delete mode 100644 .changes/unreleased/Fixes-20230706-001056.yaml delete mode 100644 .changes/unreleased/Fixes-20230706-012233.yaml delete mode 100644 .changes/unreleased/Fixes-20230706-123329.yaml delete mode 100644 .changes/unreleased/Fixes-20230713-105351.yaml delete mode 100644 .changes/unreleased/Fixes-20230713-190412.yaml diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 46022b789..cffe9f374 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.6.0b5 +current_version = 1.7.0a1 parse = (?P[\d]+) # major version number \.(?P[\d]+) # minor version number \.(?P[\d]+) # patch version number diff --git a/.changes/0.0.0.md b/.changes/0.0.0.md index 4c3cb6b65..f6d8d31d5 100644 --- a/.changes/0.0.0.md +++ b/.changes/0.0.0.md @@ -1,5 +1,6 @@ ## Previous Releases For information on prior major and minor releases, see their changelogs: +- [1.6](https://github.com/dbt-labs/dbt-redshift/blob/1.6.latest/CHANGELOG.md) - [1.5](https://github.com/dbt-labs/dbt-redshift/blob/1.5.latest/CHANGELOG.md) - [1.4](https://github.com/dbt-labs/dbt-redshift/blob/1.4.latest/CHANGELOG.md) - [1.3](https://github.com/dbt-labs/dbt-redshift/blob/1.3.latest/CHANGELOG.md) diff --git a/.changes/1.6.0-a1.md b/.changes/1.6.0-a1.md deleted file mode 100644 index 57e14b79c..000000000 --- a/.changes/1.6.0-a1.md +++ /dev/null @@ -1 +0,0 @@ -## dbt-redshift 1.6.0-a1 - April 17, 2023 diff --git a/.changes/1.6.0-b1.md b/.changes/1.6.0-b1.md deleted file mode 100644 index 07e7c693a..000000000 --- a/.changes/1.6.0-b1.md +++ /dev/null @@ -1,10 +0,0 @@ -## dbt-redshift 1.6.0-b1 - May 12, 2023 - -### Fixes - -- Adding region as independent param in profiles ([#419](https://github.com/dbt-labs/dbt-redshift/issues/419)) -- Update signature for execute method ([#'](https://github.com/dbt-labs/dbt-redshift/issues/'), [#'](https://github.com/dbt-labs/dbt-redshift/issues/')) - -### Dependencies - -- Update pytest requirement from ~=7.2 to ~=7.3 ([#414](https://github.com/dbt-labs/dbt-redshift/pull/414)) diff --git a/.changes/1.6.0-b2.md b/.changes/1.6.0-b2.md deleted file mode 100644 index d0f1d2871..000000000 --- a/.changes/1.6.0-b2.md +++ /dev/null @@ -1,11 +0,0 @@ -## dbt-redshift 1.6.0-b2 - May 25, 2023 - -### Fixes - -- Fix redshift_connector issue of timing out after 30s ([#427](https://github.com/dbt-labs/dbt-redshift/issues/427)) -- Add a new connection param to reenable certain Redshift commands in macros. ([#463](https://github.com/dbt-labs/dbt-redshift/issues/463)) -- Escape `%` symbols in table/view/column comments ([#441](https://github.com/dbt-labs/dbt-redshift/issues/441)) -- Use smaller default batch size for seeds ([#347](https://github.com/dbt-labs/dbt-redshift/issues/347)) - -### Contributors -- [@jiezhen-chen](https://github.com/jiezhen-chen) ([#427](https://github.com/dbt-labs/dbt-redshift/issues/427)) diff --git a/.changes/1.6.0-b3.md b/.changes/1.6.0-b3.md deleted file mode 100644 index 31cc589a9..000000000 --- a/.changes/1.6.0-b3.md +++ /dev/null @@ -1,23 +0,0 @@ -## dbt-redshift 1.6.0-b3 - June 09, 2023 - -### Breaking Changes - -- sslmode behavior has changed. To connect without ssl, set sslmode = disable. To connect using ssl, set sslmode to verify-ca, or verify-full. ([#429](https://github.com/dbt-labs/dbt-redshift/issues/429)) -- Drop support for python 3.7 ([#dbt-core/7082](https://github.com/dbt-labs/dbt-redshift/issues/dbt-core/7082)) - -### Features - -- Standardize the _connection_keys and debug_query for `dbt debug`. ([#PR754](https://github.com/dbt-labs/dbt-redshift/issues/PR754)) - -### Fixes - -- translate psycopg2 sslmode to ssl and sslmode in redshift_connector ([#429](https://github.com/dbt-labs/dbt-redshift/issues/429)) -- Get autocommit on by default to restore old semantics users had relied on prior to 1.5. Add tests. ([#425](https://github.com/dbt-labs/dbt-redshift/issues/425)) -- remove depdency on postgres__list_relations_without_caching macro ([#488](https://github.com/dbt-labs/dbt-redshift/issues/488)) - -### Under the Hood - -- test constraint rendering of foreign key and unique constraints ([#7417](https://github.com/dbt-labs/dbt-redshift/issues/7417)) - -### Contributors -- [@jiezhen-chen](https://github.com/jiezhen-chen) ([#429](https://github.com/dbt-labs/dbt-redshift/issues/429), [#429](https://github.com/dbt-labs/dbt-redshift/issues/429)) diff --git a/.changes/1.6.0-b4.md b/.changes/1.6.0-b4.md deleted file mode 100644 index d633633ea..000000000 --- a/.changes/1.6.0-b4.md +++ /dev/null @@ -1,12 +0,0 @@ -## dbt-redshift 1.6.0-b4 - June 16, 2023 - -### Breaking Changes - -- require latest version of redshift_connector driver ([#492](https://github.com/dbt-labs/dbt-redshift/issues/492)) - -### Fixes - -- remove requirement for region param ([#484](https://github.com/dbt-labs/dbt-redshift/issues/484)) - -### Contributors -- [@dataders](https://github.com/dataders) ([#492](https://github.com/dbt-labs/dbt-redshift/issues/492)) diff --git a/.changes/1.6.0-b5.md b/.changes/1.6.0-b5.md deleted file mode 100644 index 3263cb06e..000000000 --- a/.changes/1.6.0-b5.md +++ /dev/null @@ -1,5 +0,0 @@ -## dbt-redshift 1.6.0-b5 - June 23, 2023 - -### Features - -- Add support for materialized views ([#dbt-labs/dbt-core#6911](https://github.com/dbt-labs/dbt-redshift/issues/dbt-labs/dbt-core#6911)) diff --git a/.changes/1.6.0/Breaking Changes-20230522-111945.yaml b/.changes/1.6.0/Breaking Changes-20230522-111945.yaml deleted file mode 100644 index 63a03b3ba..000000000 --- a/.changes/1.6.0/Breaking Changes-20230522-111945.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: Breaking Changes -body: sslmode behavior has changed. To connect without ssl, set sslmode = disable. - To connect using ssl, set sslmode to verify-ca, or verify-full. -time: 2023-05-22T11:19:45.927903-07:00 -custom: - Author: jiezhen-chen - Issue: "429" diff --git a/.changes/1.6.0/Breaking Changes-20230530-165542.yaml b/.changes/1.6.0/Breaking Changes-20230530-165542.yaml deleted file mode 100644 index 68b4bfdda..000000000 --- a/.changes/1.6.0/Breaking Changes-20230530-165542.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Breaking Changes -body: Drop support for python 3.7 -time: 2023-05-30T16:55:42.393416-04:00 -custom: - Author: mikealfare - Issue: dbt-core/7082 diff --git a/.changes/1.6.0/Breaking Changes-20230614-144743.yaml b/.changes/1.6.0/Breaking Changes-20230614-144743.yaml deleted file mode 100644 index c83a7db5e..000000000 --- a/.changes/1.6.0/Breaking Changes-20230614-144743.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Breaking Changes -body: require latest version of redshift_connector driver -time: 2023-06-14T14:47:43.90505-04:00 -custom: - Author: dataders - Issue: "492" diff --git a/.changes/1.6.0/Dependencies-20230421-032407.yaml b/.changes/1.6.0/Dependencies-20230421-032407.yaml deleted file mode 100644 index 5b08ed592..000000000 --- a/.changes/1.6.0/Dependencies-20230421-032407.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Dependencies -body: "Update pytest requirement from ~=7.2 to ~=7.3" -time: 2023-04-21T03:24:07.00000Z -custom: - Author: mikealfare - PR: 414 diff --git a/.changes/1.6.0/Features-20230330-165842.yaml b/.changes/1.6.0/Features-20230330-165842.yaml deleted file mode 100644 index 4f03197aa..000000000 --- a/.changes/1.6.0/Features-20230330-165842.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Features -body: Add support for materialized views -time: 2023-03-30T16:58:42.413699-04:00 -custom: - Author: mikealfare McKnight-42 - Issue: dbt-labs/dbt-core#6911 diff --git a/.changes/1.6.0/Features-20230604-041410.yaml b/.changes/1.6.0/Features-20230604-041410.yaml deleted file mode 100644 index e617e3561..000000000 --- a/.changes/1.6.0/Features-20230604-041410.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Features -body: Standardize the _connection_keys and debug_query for `dbt debug`. -time: 2023-06-04T04:14:10.191263-07:00 -custom: - Author: versusfacit - Issue: PR754 diff --git a/.changes/1.6.0/Fixes-20230428-142321.yaml b/.changes/1.6.0/Fixes-20230428-142321.yaml deleted file mode 100644 index c7fefda43..000000000 --- a/.changes/1.6.0/Fixes-20230428-142321.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: Adding region as independent param in profiles -time: 2023-04-28T14:23:21.041865-07:00 -custom: - Author: nssalian - Issue: "419" diff --git a/.changes/1.6.0/Fixes-20230508-094834.yaml b/.changes/1.6.0/Fixes-20230508-094834.yaml deleted file mode 100644 index 378c428e3..000000000 --- a/.changes/1.6.0/Fixes-20230508-094834.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: Fix redshift_connector issue of timing out after 30s -time: 2023-05-08T09:48:34.019843-07:00 -custom: - Author: jiezhen-chen - Issue: "427" diff --git a/.changes/1.6.0/Fixes-20230509-143721.yaml b/.changes/1.6.0/Fixes-20230509-143721.yaml deleted file mode 100644 index 6d80abf7c..000000000 --- a/.changes/1.6.0/Fixes-20230509-143721.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: Update signature for execute method -time: 2023-05-09T14:37:21.163869-07:00 -custom: - Author: nssalian - Issue: ''' ''' diff --git a/.changes/1.6.0/Fixes-20230512-082027.yaml b/.changes/1.6.0/Fixes-20230512-082027.yaml deleted file mode 100644 index 7116257d8..000000000 --- a/.changes/1.6.0/Fixes-20230512-082027.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: translate psycopg2 sslmode to ssl and sslmode in redshift_connector -time: 2023-05-12T08:20:27.486301-07:00 -custom: - Author: jiezhen-chen - Issue: "429" diff --git a/.changes/1.6.0/Fixes-20230520-043039.yaml b/.changes/1.6.0/Fixes-20230520-043039.yaml deleted file mode 100644 index 1cb97526e..000000000 --- a/.changes/1.6.0/Fixes-20230520-043039.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: Add a new connection param to reenable certain Redshift commands in macros. -time: 2023-05-20T04:30:39.358755-07:00 -custom: - Author: versusfacit - Issue: "463" diff --git a/.changes/1.6.0/Fixes-20230524-151825.yaml b/.changes/1.6.0/Fixes-20230524-151825.yaml deleted file mode 100644 index bed2f78e4..000000000 --- a/.changes/1.6.0/Fixes-20230524-151825.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: Escape `%` symbols in table/view/column comments -time: 2023-05-24T15:18:25.834088-06:00 -custom: - Author: dbeatty10 - Issue: "441" diff --git a/.changes/1.6.0/Fixes-20230524-165236.yaml b/.changes/1.6.0/Fixes-20230524-165236.yaml deleted file mode 100644 index 083191405..000000000 --- a/.changes/1.6.0/Fixes-20230524-165236.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: Use smaller default batch size for seeds -time: 2023-05-24T16:52:36.915348-06:00 -custom: - Author: dbeatty10 - Issue: "347" diff --git a/.changes/1.6.0/Fixes-20230531-153347.yaml b/.changes/1.6.0/Fixes-20230531-153347.yaml deleted file mode 100644 index 4c4d324ad..000000000 --- a/.changes/1.6.0/Fixes-20230531-153347.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: Fixes -body: Get autocommit on by default to restore old semantics users had relied on prior - to 1.5. Add tests. -time: 2023-05-31T15:33:47.180508-07:00 -custom: - Author: versusfacit - Issue: "425" diff --git a/.changes/1.6.0/Fixes-20230608-180130.yaml b/.changes/1.6.0/Fixes-20230608-180130.yaml deleted file mode 100644 index 47dfda72c..000000000 --- a/.changes/1.6.0/Fixes-20230608-180130.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: remove depdency on postgres__list_relations_without_caching macro -time: 2023-06-08T18:01:30.954976-07:00 -custom: - Author: colin-rogers-dbt - Issue: "488" diff --git a/.changes/1.6.0/Fixes-20230612-114853.yaml b/.changes/1.6.0/Fixes-20230612-114853.yaml deleted file mode 100644 index 1650c5704..000000000 --- a/.changes/1.6.0/Fixes-20230612-114853.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: remove requirement for region param -time: 2023-06-12T11:48:53.980327-07:00 -custom: - Author: colin-rogers-dbt - Issue: "484" diff --git a/.changes/1.6.0/Under the Hood-20230511-162623.yaml b/.changes/1.6.0/Under the Hood-20230511-162623.yaml deleted file mode 100644 index 9166641af..000000000 --- a/.changes/1.6.0/Under the Hood-20230511-162623.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Under the Hood -body: test constraint rendering of foreign key and unique constraints -time: 2023-05-11T16:26:23.49096-04:00 -custom: - Author: michelleark - Issue: "7417" diff --git a/.changes/unreleased/Dependencies-20230515-195952.yaml b/.changes/unreleased/Dependencies-20230515-195952.yaml deleted file mode 100644 index 6cfb3a14c..000000000 --- a/.changes/unreleased/Dependencies-20230515-195952.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update pytest-xdist requirement from ~=3.2 to ~=3.3" -time: 2023-05-15T19:59:52.00000Z -custom: - Author: dependabot[bot] - PR: 449 diff --git a/.changes/unreleased/Dependencies-20230523-195945.yaml b/.changes/unreleased/Dependencies-20230523-195945.yaml deleted file mode 100644 index c2a8a363d..000000000 --- a/.changes/unreleased/Dependencies-20230523-195945.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update types-requests requirement from ~=2.28 to ~=2.31" -time: 2023-05-23T19:59:45.00000Z -custom: - Author: dependabot[bot] - PR: 461 diff --git a/.changes/unreleased/Dependencies-20230605-195944.yaml b/.changes/unreleased/Dependencies-20230605-195944.yaml deleted file mode 100644 index 52e3ab254..000000000 --- a/.changes/unreleased/Dependencies-20230605-195944.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update tox requirement from ~=4.5 to ~=4.6" -time: 2023-06-05T19:59:44.00000Z -custom: - Author: dependabot[bot] - PR: 481 diff --git a/.changes/unreleased/Dependencies-20230620-195844.yaml b/.changes/unreleased/Dependencies-20230620-195844.yaml deleted file mode 100644 index 86b482554..000000000 --- a/.changes/unreleased/Dependencies-20230620-195844.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Bump mypy from 1.2.0 to 1.4.0" -time: 2023-06-20T19:58:44.00000Z -custom: - Author: dependabot[bot] - PR: 503 diff --git a/.changes/unreleased/Dependencies-20230624-182902.yaml b/.changes/unreleased/Dependencies-20230624-182902.yaml deleted file mode 100644 index 763f74040..000000000 --- a/.changes/unreleased/Dependencies-20230624-182902.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update pre-commit requirement from ~=2.21 to ~=3.3" -time: 2023-06-24T18:29:02.00000Z -custom: - Author: dependabot[bot] - PR: 426 diff --git a/.changes/unreleased/Dependencies-20230626-195917.yaml b/.changes/unreleased/Dependencies-20230626-195917.yaml deleted file mode 100644 index c1dcdc504..000000000 --- a/.changes/unreleased/Dependencies-20230626-195917.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update pytest requirement from ~=7.3 to ~=7.4" -time: 2023-06-26T19:59:17.00000Z -custom: - Author: dependabot[bot] - PR: 507 diff --git a/.changes/unreleased/Dependencies-20230626-195934.yaml b/.changes/unreleased/Dependencies-20230626-195934.yaml deleted file mode 100644 index 4bb681e34..000000000 --- a/.changes/unreleased/Dependencies-20230626-195934.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Bump mypy from 1.4.0 to 1.4.1" -time: 2023-06-26T19:59:34.00000Z -custom: - Author: dependabot[bot] - PR: 508 diff --git a/.changes/unreleased/Dependencies-20230703-190419.yaml b/.changes/unreleased/Dependencies-20230703-190419.yaml deleted file mode 100644 index d736196a3..000000000 --- a/.changes/unreleased/Dependencies-20230703-190419.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update pip-tools requirement from ~=6.13 to ~=6.14" -time: 2023-07-03T19:04:19.00000Z -custom: - Author: dependabot[bot] - PR: 517 diff --git a/.changes/unreleased/Features-20230407-104723.yaml b/.changes/unreleased/Features-20230407-104723.yaml deleted file mode 100644 index 44344e249..000000000 --- a/.changes/unreleased/Features-20230407-104723.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: Features -time: 2023-04-07T10:47:23.105369-07:00 -custom: - Author: jiezhen-chen - Issue: 179 diff --git a/.changes/unreleased/Features-20230613-144752.yaml b/.changes/unreleased/Features-20230613-144752.yaml deleted file mode 100644 index 2b254a9ce..000000000 --- a/.changes/unreleased/Features-20230613-144752.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Features -body: add merge as a new incremental strategy for redshift -time: 2023-06-13T14:47:52.054853-07:00 -custom: - Author: jiezhen-chen - Issue: "402" diff --git a/.changes/unreleased/Features-20230622-144649.yaml b/.changes/unreleased/Features-20230622-144649.yaml deleted file mode 100644 index 009dcb861..000000000 --- a/.changes/unreleased/Features-20230622-144649.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Features -body: add dbt-redshift portion of dbt_clone functionality -time: 2023-06-22T14:46:49.037145-05:00 -custom: - Author: McKnight-42 aranke - Issue: "504" diff --git a/.changes/unreleased/Features-20230714-160100.yaml b/.changes/unreleased/Features-20230714-160100.yaml deleted file mode 100644 index 44bddf227..000000000 --- a/.changes/unreleased/Features-20230714-160100.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Features -body: Enumerate implemented materialized view features via integration test flags and change `autorefresh` to `auto_refresh` -time: 2023-07-14T16:01:00.54015-04:00 -custom: - Author: mikealfare - Issue: dbt-labs/dbt-core#6911 diff --git a/.changes/unreleased/Fixes-20230628-123227.yaml b/.changes/unreleased/Fixes-20230628-123227.yaml deleted file mode 100644 index 4ece8f404..000000000 --- a/.changes/unreleased/Fixes-20230628-123227.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: Remove dependent_projects argument from PartialProject call in unit tests -time: 2023-06-28T12:32:27.637669-04:00 -custom: - Author: mikealfare - Issue: "7955" diff --git a/.changes/unreleased/Fixes-20230706-001056.yaml b/.changes/unreleased/Fixes-20230706-001056.yaml deleted file mode 100644 index 79b205caf..000000000 --- a/.changes/unreleased/Fixes-20230706-001056.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: Fix regression in redshift-connector==2.0.912 -time: 2023-07-06T00:10:56.337407-04:00 -custom: - Author: mikealfare - Issue: "518" diff --git a/.changes/unreleased/Fixes-20230706-012233.yaml b/.changes/unreleased/Fixes-20230706-012233.yaml deleted file mode 100644 index bc28b2eec..000000000 --- a/.changes/unreleased/Fixes-20230706-012233.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: Fixed unit test that broke following dbt clone work -time: 2023-07-06T01:22:33.840137-04:00 -custom: - Author: mikealfare - Issue: "518" diff --git a/.changes/unreleased/Fixes-20230706-123329.yaml b/.changes/unreleased/Fixes-20230706-123329.yaml deleted file mode 100644 index afda869d0..000000000 --- a/.changes/unreleased/Fixes-20230706-123329.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: cast the port as an int -time: 2023-07-06T12:33:29.799921-07:00 -custom: - Author: jiezhen-chen - Issue: "518" diff --git a/.changes/unreleased/Fixes-20230713-105351.yaml b/.changes/unreleased/Fixes-20230713-105351.yaml deleted file mode 100644 index 47193a357..000000000 --- a/.changes/unreleased/Fixes-20230713-105351.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: hard pin dep on redshift_connector -time: 2023-07-13T10:53:51.463072-04:00 -custom: - Author: dataders - Issue: 531 532 diff --git a/.changes/unreleased/Fixes-20230713-190412.yaml b/.changes/unreleased/Fixes-20230713-190412.yaml deleted file mode 100644 index d50ab7a1f..000000000 --- a/.changes/unreleased/Fixes-20230713-190412.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: re-enable query commenting -time: 2023-07-13T19:04:12.580073-04:00 -custom: - Author: dataders - Issue: "536" diff --git a/CHANGELOG.md b/CHANGELOG.md index dd2d5cafc..04a8e7db1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,78 +5,9 @@ - "Breaking changes" listed under a version may require action from end users or external maintainers when upgrading to that version. - Do not edit this file directly. This file is auto-generated using [changie](https://github.com/miniscruff/changie). For details on how to document a change, see [the contributing guide](https://github.com/dbt-labs/dbt-redshift/blob/main/CONTRIBUTING.md#adding-changelog-entry) -## dbt-redshift 1.6.0-b5 - June 23, 2023 - -### Features - -- Add support for materialized views ([#dbt-labs/dbt-core#6911](https://github.com/dbt-labs/dbt-redshift/issues/dbt-labs/dbt-core#6911)) - - - -## dbt-redshift 1.6.0-b4 - June 16, 2023 - -### Breaking Changes - -- require latest version of redshift_connector driver ([#492](https://github.com/dbt-labs/dbt-redshift/issues/492)) - -### Fixes - -- remove requirement for region param ([#484](https://github.com/dbt-labs/dbt-redshift/issues/484)) - -### Contributors -- [@dataders](https://github.com/dataders) ([#492](https://github.com/dbt-labs/dbt-redshift/issues/492)) - -## dbt-redshift 1.6.0-b3 - June 09, 2023 - -### Breaking Changes - -- sslmode behavior has changed. To connect without ssl, set sslmode = disable. To connect using ssl, set sslmode to verify-ca, or verify-full. ([#429](https://github.com/dbt-labs/dbt-redshift/issues/429)) -- Drop support for python 3.7 ([#dbt-core/7082](https://github.com/dbt-labs/dbt-redshift/issues/dbt-core/7082)) - -### Features - -- Standardize the _connection_keys and debug_query for `dbt debug`. ([#PR754](https://github.com/dbt-labs/dbt-redshift/issues/PR754)) - -### Fixes - -- translate psycopg2 sslmode to ssl and sslmode in redshift_connector ([#429](https://github.com/dbt-labs/dbt-redshift/issues/429)) -- Get autocommit on by default to restore old semantics users had relied on prior to 1.5. Add tests. ([#425](https://github.com/dbt-labs/dbt-redshift/issues/425)) -- remove depdency on postgres__list_relations_without_caching macro ([#488](https://github.com/dbt-labs/dbt-redshift/issues/488)) - -### Under the Hood - -- test constraint rendering of foreign key and unique constraints ([#7417](https://github.com/dbt-labs/dbt-redshift/issues/7417)) - -### Contributors -- [@jiezhen-chen](https://github.com/jiezhen-chen) ([#429](https://github.com/dbt-labs/dbt-redshift/issues/429), [#429](https://github.com/dbt-labs/dbt-redshift/issues/429)) - -## dbt-redshift 1.6.0-b2 - May 25, 2023 - -### Fixes - -- Fix redshift_connector issue of timing out after 30s ([#427](https://github.com/dbt-labs/dbt-redshift/issues/427)) -- Add a new connection param to reenable certain Redshift commands in macros. ([#463](https://github.com/dbt-labs/dbt-redshift/issues/463)) -- Escape `%` symbols in table/view/column comments ([#441](https://github.com/dbt-labs/dbt-redshift/issues/441)) -- Use smaller default batch size for seeds ([#347](https://github.com/dbt-labs/dbt-redshift/issues/347)) - -### Contributors -- [@jiezhen-chen](https://github.com/jiezhen-chen) ([#427](https://github.com/dbt-labs/dbt-redshift/issues/427)) - -## dbt-redshift 1.6.0-b1 - May 12, 2023 - -### Fixes - -- Adding region as independent param in profiles ([#419](https://github.com/dbt-labs/dbt-redshift/issues/419)) -- Update signature for execute method ([#'](https://github.com/dbt-labs/dbt-redshift/issues/'), [#'](https://github.com/dbt-labs/dbt-redshift/issues/')) - -### Dependencies - -- Update pytest requirement from ~=7.2 to ~=7.3 ([#414](https://github.com/dbt-labs/dbt-redshift/pull/414)) - -## dbt-redshift 1.6.0-a1 - April 17, 2023 - ## Previous Releases For information on prior major and minor releases, see their changelogs: +- [1.6](https://github.com/dbt-labs/dbt-redshift/blob/1.6.latest/CHANGELOG.md) - [1.5](https://github.com/dbt-labs/dbt-redshift/blob/1.5.latest/CHANGELOG.md) - [1.4](https://github.com/dbt-labs/dbt-redshift/blob/1.4.latest/CHANGELOG.md) - [1.3](https://github.com/dbt-labs/dbt-redshift/blob/1.3.latest/CHANGELOG.md) diff --git a/dbt/adapters/redshift/__version__.py b/dbt/adapters/redshift/__version__.py index da9f11e34..874bd74c8 100644 --- a/dbt/adapters/redshift/__version__.py +++ b/dbt/adapters/redshift/__version__.py @@ -1 +1 @@ -version = "1.6.0b5" +version = "1.7.0a1" From a41df68aa524ed6260109a7f76f513e745dd003b Mon Sep 17 00:00:00 2001 From: Mike Alfare <13974384+mikealfare@users.noreply.github.com> Date: Tue, 25 Jul 2023 10:10:14 -0400 Subject: [PATCH 03/45] update stale workflow to use the centralized version (#552) --- .../Under the Hood-20230724-164439.yaml | 6 ++++++ .github/workflows/stale.yml | 17 +++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 .changes/unreleased/Under the Hood-20230724-164439.yaml diff --git a/.changes/unreleased/Under the Hood-20230724-164439.yaml b/.changes/unreleased/Under the Hood-20230724-164439.yaml new file mode 100644 index 000000000..59f929e69 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20230724-164439.yaml @@ -0,0 +1,6 @@ +kind: Under the Hood +body: Update stale workflow to use the centralized version +time: 2023-07-24T16:44:39.683995-04:00 +custom: + Author: mikealfare + Issue: "552" diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index a56455d55..d902340a9 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,15 +1,12 @@ -name: 'Close stale issues and PRs' +name: "Close stale issues and PRs" on: schedule: - cron: "30 1 * * *" + +permissions: + issues: write + pull-requests: write + jobs: stale: - runs-on: ubuntu-latest - steps: - # pinned at v4 (https://github.com/actions/stale/releases/tag/v4.0.0) - - uses: actions/stale@cdf15f641adb27a71842045a94023bef6945e3aa - with: - stale-issue-message: "This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue, or it will be closed in 7 days." - stale-pr-message: "This PR has been marked as Stale because it has been open for 180 days with no activity. If you would like the PR to remain open, please remove the stale label or comment on the PR, or it will be closed in 7 days." - # mark issues/PRs stale when they haven't seen activity in 180 days - days-before-stale: 180 + uses: dbt-labs/actions/.github/workflows/stale-bot-matrix.yml@main From 8b301035a346543b253d6f843ac65d166b24c1ac Mon Sep 17 00:00:00 2001 From: Doug Beatty <44704949+dbeatty10@users.noreply.github.com> Date: Wed, 2 Aug 2023 12:29:13 -0600 Subject: [PATCH 04/45] Insert values of `merge_exclude_columns` when not matched (#564) --- .changes/unreleased/Fixes-20230802-103350.yaml | 6 ++++++ .../macros/materializations/incremental_merge.sql | 5 +++-- .../test_incremental_merge_exclude_columns.py | 12 +----------- 3 files changed, 10 insertions(+), 13 deletions(-) create mode 100644 .changes/unreleased/Fixes-20230802-103350.yaml diff --git a/.changes/unreleased/Fixes-20230802-103350.yaml b/.changes/unreleased/Fixes-20230802-103350.yaml new file mode 100644 index 000000000..5c5a1fe79 --- /dev/null +++ b/.changes/unreleased/Fixes-20230802-103350.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Insert values of `merge_exclude_columns` when not matched +time: 2023-08-02T10:33:50.107228-06:00 +custom: + Author: dbeatty10 + Issue: "563" diff --git a/dbt/include/redshift/macros/materializations/incremental_merge.sql b/dbt/include/redshift/macros/materializations/incremental_merge.sql index fb49a3820..59a3391e3 100644 --- a/dbt/include/redshift/macros/materializations/incremental_merge.sql +++ b/dbt/include/redshift/macros/materializations/incremental_merge.sql @@ -16,6 +16,7 @@ {%- set merge_update_columns = config.get('merge_update_columns') -%} {%- set merge_exclude_columns = config.get('merge_exclude_columns') -%} {%- set update_columns = get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) -%} + {%- set insert_columns = get_merge_update_columns(none, none, dest_columns) -%} {%- set sql_header = config.get('sql_header', none) -%} {% if unique_key %} @@ -51,13 +52,13 @@ {% endif %} when not matched then insert ( - {% for column_name in update_columns -%} + {% for column_name in insert_columns -%} {{ column_name }} {%- if not loop.last %}, {% endif %} {% endfor %} ) values ( - {% for column_name in update_columns -%} + {% for column_name in insert_columns -%} DBT_INTERNAL_SOURCE.{{ column_name }} {%- if not loop.last %}, {% endif %} {% endfor %} diff --git a/tests/functional/adapter/incremental/test_incremental_merge_exclude_columns.py b/tests/functional/adapter/incremental/test_incremental_merge_exclude_columns.py index c719ae059..022ebca07 100644 --- a/tests/functional/adapter/incremental/test_incremental_merge_exclude_columns.py +++ b/tests/functional/adapter/incremental/test_incremental_merge_exclude_columns.py @@ -1,17 +1,7 @@ -import pytest from dbt.tests.adapter.incremental.test_incremental_merge_exclude_columns import ( BaseMergeExcludeColumns, ) -seeds__expected_merge_exclude_columns_csv = """id,msg,color -1,hello,blue -2,goodbye,green -3,NULL,purple -""" - - class TestMergeExcludeColumns(BaseMergeExcludeColumns): - @pytest.fixture(scope="class") - def seeds(self): - return {"expected_merge_exclude_columns.csv": seeds__expected_merge_exclude_columns_csv} + pass From 83a0231264f1b9a4a415387cfa3d016214d993c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 16:42:22 -0400 Subject: [PATCH 05/45] Update wheel requirement from ~=0.40 to ~=0.41 (#551) * Update wheel requirement from ~=0.40 to ~=0.41 Updates the requirements on [wheel](https://github.com/pypa/wheel) to permit the latest version. - [Changelog](https://github.com/pypa/wheel/blob/main/docs/news.rst) - [Commits](https://github.com/pypa/wheel/compare/0.40.0...0.41.0) --- updated-dependencies: - dependency-name: wheel dependency-type: direct:development ... Signed-off-by: dependabot[bot] * Add automated changelog yaml from template for bot PR * remove extra line at eof in the changelog and the workflow that generates the changelog --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Github Build Bot Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com> Co-authored-by: Mike Alfare --- .changes/unreleased/Dependencies-20230724-190537.yaml | 6 ++++++ .github/workflows/bot-changelog.yml | 2 +- dev-requirements.txt | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changes/unreleased/Dependencies-20230724-190537.yaml diff --git a/.changes/unreleased/Dependencies-20230724-190537.yaml b/.changes/unreleased/Dependencies-20230724-190537.yaml new file mode 100644 index 000000000..c61cb9df3 --- /dev/null +++ b/.changes/unreleased/Dependencies-20230724-190537.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Update wheel requirement from ~=0.40 to ~=0.41" +time: 2023-07-24T19:05:37.00000Z +custom: + Author: dependabot[bot] + PR: 551 diff --git a/.github/workflows/bot-changelog.yml b/.github/workflows/bot-changelog.yml index 94498d25f..fcd344802 100644 --- a/.github/workflows/bot-changelog.yml +++ b/.github/workflows/bot-changelog.yml @@ -57,4 +57,4 @@ jobs: commit_message: "Add automated changelog yaml from template for bot PR" changie_kind: ${{ matrix.changie_kind }} label: ${{ matrix.label }} - custom_changelog_string: "custom:\n Author: ${{ github.event.pull_request.user.login }}\n PR: ${{ github.event.pull_request.number }}\n" + custom_changelog_string: "custom:\n Author: ${{ github.event.pull_request.user.login }}\n PR: ${{ github.event.pull_request.number }}" diff --git a/dev-requirements.txt b/dev-requirements.txt index 03e853f9a..9cc4fcad7 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -28,4 +28,4 @@ tox~=4.6 types-pytz~=2023.3 types-requests~=2.31 twine~=4.0 -wheel~=0.40 +wheel~=0.41 From 94ff8ecf545f9c77149d767b36c9987fedcfb069 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 18:04:03 -0400 Subject: [PATCH 06/45] Update flake8 requirement from ~=6.0 to ~=6.1 (#562) * Update flake8 requirement from ~=6.0 to ~=6.1 Updates the requirements on [flake8](https://github.com/pycqa/flake8) to permit the latest version. - [Commits](https://github.com/pycqa/flake8/compare/6.0.0...6.1.0) --- updated-dependencies: - dependency-name: flake8 dependency-type: direct:development ... Signed-off-by: dependabot[bot] * Add automated changelog yaml from template for bot PR * remove extra line at eof in the changelog --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Github Build Bot Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com> Co-authored-by: Mike Alfare --- .changes/unreleased/Dependencies-20230731-194135.yaml | 6 ++++++ dev-requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Dependencies-20230731-194135.yaml diff --git a/.changes/unreleased/Dependencies-20230731-194135.yaml b/.changes/unreleased/Dependencies-20230731-194135.yaml new file mode 100644 index 000000000..c9990b89a --- /dev/null +++ b/.changes/unreleased/Dependencies-20230731-194135.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Update flake8 requirement from ~=6.0 to ~=6.1" +time: 2023-07-31T19:41:35.00000Z +custom: + Author: dependabot[bot] + PR: 562 diff --git a/dev-requirements.txt b/dev-requirements.txt index 9cc4fcad7..eb4592f83 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -10,7 +10,7 @@ black~=23.3 bumpversion~=0.6.0 click~=8.1 ddtrace~=1.16 -flake8~=6.0 +flake8~=6.1 flaky~=3.7 freezegun~=1.2 ipdb~=0.13.13 From 4efb30eb2eb42aafbbd1a2b45d699cc7811ef5e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Aug 2023 09:15:28 -0400 Subject: [PATCH 07/45] Update pip-tools requirement from ~=6.14 to ~=7.0 (#541) * Update pip-tools requirement from ~=6.14 to ~=7.0 Updates the requirements on [pip-tools](https://github.com/jazzband/pip-tools) to permit the latest version. - [Release notes](https://github.com/jazzband/pip-tools/releases) - [Changelog](https://github.com/jazzband/pip-tools/blob/main/CHANGELOG.md) - [Commits](https://github.com/jazzband/pip-tools/compare/6.14.0...7.0.0) --- updated-dependencies: - dependency-name: pip-tools dependency-type: direct:development ... Signed-off-by: dependabot[bot] * Add automated changelog yaml from template for bot PR * remove extra line at eof in the changelog --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Github Build Bot Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com> Co-authored-by: Mike Alfare --- .changes/unreleased/Dependencies-20230717-195349.yaml | 6 ++++++ dev-requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Dependencies-20230717-195349.yaml diff --git a/.changes/unreleased/Dependencies-20230717-195349.yaml b/.changes/unreleased/Dependencies-20230717-195349.yaml new file mode 100644 index 000000000..542970ab8 --- /dev/null +++ b/.changes/unreleased/Dependencies-20230717-195349.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Update pip-tools requirement from ~=6.14 to ~=7.0" +time: 2023-07-17T19:53:49.00000Z +custom: + Author: dependabot[bot] + PR: 541 diff --git a/dev-requirements.txt b/dev-requirements.txt index eb4592f83..836c8e4bd 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -15,7 +15,7 @@ flaky~=3.7 freezegun~=1.2 ipdb~=0.13.13 mypy==1.4.1 # patch updates have historically introduced breaking changes -pip-tools~=6.14 +pip-tools~=7.0 pre-commit~=3.3 pre-commit-hooks~=4.4 pytest~=7.4 From 6f31211a1fc84a346ba6588072fcb0de8dc890fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Aug 2023 12:02:33 -0400 Subject: [PATCH 08/45] Update pip-tools requirement from ~=7.0 to ~=7.2 (#567) * Update pip-tools requirement from ~=7.0 to ~=7.2 Updates the requirements on [pip-tools](https://github.com/jazzband/pip-tools) to permit the latest version. - [Release notes](https://github.com/jazzband/pip-tools/releases) - [Changelog](https://github.com/jazzband/pip-tools/blob/main/CHANGELOG.md) - [Commits](https://github.com/jazzband/pip-tools/compare/7.0.0...7.2.0) --- updated-dependencies: - dependency-name: pip-tools dependency-type: direct:development ... Signed-off-by: dependabot[bot] * Add automated changelog yaml from template for bot PR --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Github Build Bot --- .changes/unreleased/Dependencies-20230803-131633.yaml | 6 ++++++ dev-requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Dependencies-20230803-131633.yaml diff --git a/.changes/unreleased/Dependencies-20230803-131633.yaml b/.changes/unreleased/Dependencies-20230803-131633.yaml new file mode 100644 index 000000000..d6755cd13 --- /dev/null +++ b/.changes/unreleased/Dependencies-20230803-131633.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Update pip-tools requirement from ~=7.0 to ~=7.2" +time: 2023-08-03T13:16:33.00000Z +custom: + Author: dependabot[bot] + PR: 567 diff --git a/dev-requirements.txt b/dev-requirements.txt index 836c8e4bd..22958e270 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -15,7 +15,7 @@ flaky~=3.7 freezegun~=1.2 ipdb~=0.13.13 mypy==1.4.1 # patch updates have historically introduced breaking changes -pip-tools~=7.0 +pip-tools~=7.2 pre-commit~=3.3 pre-commit-hooks~=4.4 pytest~=7.4 From f92fcbd891bfbdfdb320114a7efde78329e5d773 Mon Sep 17 00:00:00 2001 From: Nathaniel May Date: Thu, 3 Aug 2023 14:41:13 -0400 Subject: [PATCH 09/45] move alerts (#525) --- .github/workflows/integration.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 3eec2b27f..9d1fe0807 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -241,4 +241,4 @@ jobs: notification_title: 'Redshift nightly integration test failed' status: ${{ job.status }} env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEV_CORE_ALERTS }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEV_ADAPTER_ALERTS }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1c0885001..88942e251 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -225,4 +225,4 @@ jobs: status: "failure" secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEV_CORE_ALERTS }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEV_ADAPTER_ALERTS }} From 17b2cb56cd179cf53d783c86be09abbf24e46c05 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Aug 2023 16:57:40 -0400 Subject: [PATCH 10/45] Update black requirement from ~=23.3 to ~=23.7 (#529) * Update black requirement from ~=23.3 to ~=23.7 Updates the requirements on [black](https://github.com/psf/black) to permit the latest version. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/compare/23.3.0...23.7.0) --- updated-dependencies: - dependency-name: black dependency-type: direct:development ... Signed-off-by: dependabot[bot] * Add automated changelog yaml from template for bot PR * remove extra line at eof in the changelog --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Github Build Bot Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com> Co-authored-by: Mike Alfare --- .changes/unreleased/Dependencies-20230711-192047.yaml | 6 ++++++ dev-requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Dependencies-20230711-192047.yaml diff --git a/.changes/unreleased/Dependencies-20230711-192047.yaml b/.changes/unreleased/Dependencies-20230711-192047.yaml new file mode 100644 index 000000000..fa7c1df80 --- /dev/null +++ b/.changes/unreleased/Dependencies-20230711-192047.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Update black requirement from ~=23.3 to ~=23.7" +time: 2023-07-11T19:20:47.00000Z +custom: + Author: dependabot[bot] + PR: 529 diff --git a/dev-requirements.txt b/dev-requirements.txt index 22958e270..d14b3e1fc 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -6,7 +6,7 @@ git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-postgres&subdirectory=plugi # if version 1.x or greater -> pin to major version # if version 0.x -> pin to minor -black~=23.3 +black~=23.7 bumpversion~=0.6.0 click~=8.1 ddtrace~=1.16 From b86f5a6d4b1a48fc7d87ae0e1dbf04c0610cf67a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Aug 2023 18:44:36 -0400 Subject: [PATCH 11/45] Update ddtrace requirement from ~=1.16 to ~=1.17 (#550) * Update ddtrace requirement from ~=1.16 to ~=1.17 Updates the requirements on [ddtrace](https://github.com/DataDog/dd-trace-py) to permit the latest version. - [Release notes](https://github.com/DataDog/dd-trace-py/releases) - [Changelog](https://github.com/DataDog/dd-trace-py/blob/1.x/CHANGELOG.md) - [Commits](https://github.com/DataDog/dd-trace-py/compare/v1.16.0...v1.17.0) --- updated-dependencies: - dependency-name: ddtrace dependency-type: direct:development ... Signed-off-by: dependabot[bot] * Add automated changelog yaml from template for bot PR * remove extra line at eof in the changelog --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Github Build Bot Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com> Co-authored-by: Mike Alfare --- .changes/unreleased/Dependencies-20230720-191748.yaml | 6 ++++++ dev-requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Dependencies-20230720-191748.yaml diff --git a/.changes/unreleased/Dependencies-20230720-191748.yaml b/.changes/unreleased/Dependencies-20230720-191748.yaml new file mode 100644 index 000000000..eb79676d4 --- /dev/null +++ b/.changes/unreleased/Dependencies-20230720-191748.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Update ddtrace requirement from ~=1.16 to ~=1.17" +time: 2023-07-20T19:17:48.00000Z +custom: + Author: dependabot[bot] + PR: 550 diff --git a/dev-requirements.txt b/dev-requirements.txt index d14b3e1fc..07364088f 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -9,7 +9,7 @@ git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-postgres&subdirectory=plugi black~=23.7 bumpversion~=0.6.0 click~=8.1 -ddtrace~=1.16 +ddtrace~=1.17 flake8~=6.1 flaky~=3.7 freezegun~=1.2 From 73dfc8286979fe9d0d89b64741878fd16cf1b1ac Mon Sep 17 00:00:00 2001 From: William Ayd Date: Thu, 3 Aug 2023 21:34:30 -0400 Subject: [PATCH 12/45] Support DISTSTYLE for seeds (#256) * Initial attempt at adding diststyle * Changelog entry * Functional test for `diststyle all` --------- Co-authored-by: Anders Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com> Co-authored-by: Doug Beatty Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com> --- .../unreleased/Features-20230803-111146.yaml | 6 +++ .../macros/materializations/seeds/helpers.sql | 24 ++++++++++++ tests/functional/adapter/test_simple_seed.py | 38 +++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 .changes/unreleased/Features-20230803-111146.yaml diff --git a/.changes/unreleased/Features-20230803-111146.yaml b/.changes/unreleased/Features-20230803-111146.yaml new file mode 100644 index 000000000..098e8888e --- /dev/null +++ b/.changes/unreleased/Features-20230803-111146.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Support DISTSTYLE for seeds +time: 2023-08-03T11:11:46.571996-06:00 +custom: + Author: WillAyd + Issue: "255" diff --git a/dbt/include/redshift/macros/materializations/seeds/helpers.sql b/dbt/include/redshift/macros/materializations/seeds/helpers.sql index 34f83548a..32afdae81 100644 --- a/dbt/include/redshift/macros/materializations/seeds/helpers.sql +++ b/dbt/include/redshift/macros/materializations/seeds/helpers.sql @@ -1,3 +1,27 @@ +{% macro redshift__create_csv_table(model, agate_table) %} + {%- set column_override = model['config'].get('column_types', {}) -%} + {%- set quote_seed_column = model['config'].get('quote_columns', None) -%} + {%- set _dist = model['config'].get('dist', None) -%} + + {% set sql %} + create table {{ this.render() }} ( + {%- for col_name in agate_table.column_names -%} + {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%} + {%- set type = column_override.get(col_name, inferred_type) -%} + {%- set column_name = (col_name | string) -%} + {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%} + {%- endfor -%} + ) + {{ dist(_dist) }} + {% endset %} + + {% call statement('_') -%} + {{ sql }} + {%- endcall %} + + {{ return(sql) }} +{% endmacro %} + {% macro redshift__get_batch_size() %} {{ return(500) }} {% endmacro %} diff --git a/tests/functional/adapter/test_simple_seed.py b/tests/functional/adapter/test_simple_seed.py index 1e8cc1cd5..3e5ea5b23 100644 --- a/tests/functional/adapter/test_simple_seed.py +++ b/tests/functional/adapter/test_simple_seed.py @@ -53,6 +53,24 @@ """.lstrip() +properties__schema_yml = """ +version: 2 + +seeds: + - name: seed_dist_all + config: + dist: all +""" + + +seeds__dist_all_csv = """ +seed_id,weekday +1,Saturday +2,Sunday +3,Monday +""".lstrip() + + class TestSimpleSeedColumnOverride(BaseSimpleSeedColumnOverride): @pytest.fixture(scope="class") def schema(self): @@ -82,3 +100,23 @@ def test_redshift_simple_seed_with_column_override_redshift(self, project): assert len(seed_results) == 2 test_results = run_dbt(["test"]) assert len(test_results) == 10 + + +class BaseSimpleSeedDiststyleAll: + @pytest.fixture(scope="class") + def models(self): + return { + "schema.yml": properties__schema_yml, + } + + @pytest.fixture(scope="class") + def seeds(self): + return {"seed_dist_all.csv": seeds__dist_all_csv} + + def test_simple_seed_with_diststyle_all(self, project): + seed_results = run_dbt(["seed", "--show"]) + assert len(seed_results) == 1 + + +class TestSimpleSeedDiststyleAll(BaseSimpleSeedDiststyleAll): + pass From 69203338b31e65cfc7ef27f0cd0ac2b681d53be9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Aug 2023 00:35:27 -0400 Subject: [PATCH 13/45] Update tox requirement from ~=4.6 to ~=4.7 (#570) * Update tox requirement from ~=4.6 to ~=4.7 Updates the requirements on [tox](https://github.com/tox-dev/tox) to permit the latest version. - [Release notes](https://github.com/tox-dev/tox/releases) - [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst) - [Commits](https://github.com/tox-dev/tox/compare/4.6.0...4.7.0) --- updated-dependencies: - dependency-name: tox dependency-type: direct:development ... Signed-off-by: dependabot[bot] * Add automated changelog yaml from template for bot PR --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Github Build Bot --- .changes/unreleased/Dependencies-20230808-194553.yaml | 6 ++++++ dev-requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Dependencies-20230808-194553.yaml diff --git a/.changes/unreleased/Dependencies-20230808-194553.yaml b/.changes/unreleased/Dependencies-20230808-194553.yaml new file mode 100644 index 000000000..95c0b6dd1 --- /dev/null +++ b/.changes/unreleased/Dependencies-20230808-194553.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Update tox requirement from ~=4.6 to ~=4.7" +time: 2023-08-08T19:45:53.00000Z +custom: + Author: dependabot[bot] + PR: 570 diff --git a/dev-requirements.txt b/dev-requirements.txt index 07364088f..69671bced 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -24,7 +24,7 @@ pytest-dotenv~=0.5.2 pytest-logbook~=1.2 pytest-xdist~=3.3 pytz~=2023.3 -tox~=4.6 +tox~=4.7 types-pytz~=2023.3 types-requests~=2.31 twine~=4.0 From cbb411d841c0cef5456c0f45fa0cdb1182beabaf Mon Sep 17 00:00:00 2001 From: Mike Alfare <13974384+mikealfare@users.noreply.github.com> Date: Wed, 9 Aug 2023 20:20:51 -0400 Subject: [PATCH 14/45] ADAP-761: Add retry logic to flaky MV tests to avoid "cannot open relation with OID" error (#569) * add retry logic to materialized view tests to avoid "could not open relation with OID" error * changie * update utility method name to be scope specific --- .../Under the Hood-20230808-141645.yaml | 7 ++ .../test_materialized_views.py | 76 ++++++++++++++++++- .../adapter/materialized_view_tests/utils.py | 20 ++++- 3 files changed, 99 insertions(+), 4 deletions(-) create mode 100644 .changes/unreleased/Under the Hood-20230808-141645.yaml diff --git a/.changes/unreleased/Under the Hood-20230808-141645.yaml b/.changes/unreleased/Under the Hood-20230808-141645.yaml new file mode 100644 index 000000000..051bf0e33 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20230808-141645.yaml @@ -0,0 +1,7 @@ +kind: Under the Hood +body: Update flaky MV tests to use retry logic to avoid "cannot open relation with + OID" error +time: 2023-08-08T14:16:45.227308-04:00 +custom: + Author: mikealfare + Issue: "569" diff --git a/tests/functional/adapter/materialized_view_tests/test_materialized_views.py b/tests/functional/adapter/materialized_view_tests/test_materialized_views.py index d4c3e8a11..7bb5bcee6 100644 --- a/tests/functional/adapter/materialized_view_tests/test_materialized_views.py +++ b/tests/functional/adapter/materialized_view_tests/test_materialized_views.py @@ -12,13 +12,14 @@ MaterializedViewChangesFailMixin, ) from dbt.tests.adapter.materialized_view.files import MY_TABLE, MY_VIEW -from dbt.tests.util import get_model_file, set_model_file +from dbt.tests.util import assert_message_in_logs, get_model_file, set_model_file from tests.functional.adapter.materialized_view_tests.utils import ( query_autorefresh, query_dist, query_relation_type, query_sort, + run_dbt_and_capture_with_retries_redshift_mv, ) @@ -61,6 +62,14 @@ def query_row_count(project, relation: BaseRelation) -> int: def query_relation_type(project, relation: BaseRelation) -> Optional[str]: return query_relation_type(project, relation) + def test_materialized_view_create_idempotent(self, project, my_materialized_view): + # setup creates it once; verify it's there and run once + assert self.query_relation_type(project, my_materialized_view) == "materialized_view" + run_dbt_and_capture_with_retries_redshift_mv( + ["run", "--models", my_materialized_view.identifier] + ) + assert self.query_relation_type(project, my_materialized_view) == "materialized_view" + @pytest.mark.skip( "The current implementation does not support overwriting materialized views with tables." ) @@ -120,16 +129,77 @@ def check_state_replace_change_is_applied(project, materialized_view): class TestRedshiftMaterializedViewChangesApply( RedshiftMaterializedViewChanges, MaterializedViewChangesApplyMixin ): - pass + def test_change_is_applied_via_alter(self, project, my_materialized_view): + self.check_start_state(project, my_materialized_view) + + self.change_config_via_alter(project, my_materialized_view) + _, logs = run_dbt_and_capture_with_retries_redshift_mv( + ["--debug", "run", "--models", my_materialized_view.name] + ) + + self.check_state_alter_change_is_applied(project, my_materialized_view) + + assert_message_in_logs(f"Applying ALTER to: {my_materialized_view}", logs) + assert_message_in_logs(f"Applying REPLACE to: {my_materialized_view}", logs, False) + + def test_change_is_applied_via_replace(self, project, my_materialized_view): + self.check_start_state(project, my_materialized_view) + + self.change_config_via_alter(project, my_materialized_view) + self.change_config_via_replace(project, my_materialized_view) + _, logs = run_dbt_and_capture_with_retries_redshift_mv( + ["--debug", "run", "--models", my_materialized_view.name] + ) + + self.check_state_alter_change_is_applied(project, my_materialized_view) + self.check_state_replace_change_is_applied(project, my_materialized_view) + + assert_message_in_logs(f"Applying REPLACE to: {my_materialized_view}", logs) class TestRedshiftMaterializedViewChangesContinue( RedshiftMaterializedViewChanges, MaterializedViewChangesContinueMixin ): - pass + def test_change_is_not_applied_via_alter(self, project, my_materialized_view): + self.check_start_state(project, my_materialized_view) + + self.change_config_via_alter(project, my_materialized_view) + _, logs = run_dbt_and_capture_with_retries_redshift_mv( + ["--debug", "run", "--models", my_materialized_view.name] + ) + + self.check_start_state(project, my_materialized_view) + + assert_message_in_logs( + f"Configuration changes were identified and `on_configuration_change` was set" + f" to `continue` for `{my_materialized_view}`", + logs, + ) + assert_message_in_logs(f"Applying ALTER to: {my_materialized_view}", logs, False) + assert_message_in_logs(f"Applying REPLACE to: {my_materialized_view}", logs, False) + + def test_change_is_not_applied_via_replace(self, project, my_materialized_view): + self.check_start_state(project, my_materialized_view) + + self.change_config_via_alter(project, my_materialized_view) + self.change_config_via_replace(project, my_materialized_view) + _, logs = run_dbt_and_capture_with_retries_redshift_mv( + ["--debug", "run", "--models", my_materialized_view.name] + ) + + self.check_start_state(project, my_materialized_view) + + assert_message_in_logs( + f"Configuration changes were identified and `on_configuration_change` was set" + f" to `continue` for `{my_materialized_view}`", + logs, + ) + assert_message_in_logs(f"Applying ALTER to: {my_materialized_view}", logs, False) + assert_message_in_logs(f"Applying REPLACE to: {my_materialized_view}", logs, False) class TestRedshiftMaterializedViewChangesFail( RedshiftMaterializedViewChanges, MaterializedViewChangesFailMixin ): + # Note: using retries doesn't work when we expect `dbt_run` to fail pass diff --git a/tests/functional/adapter/materialized_view_tests/utils.py b/tests/functional/adapter/materialized_view_tests/utils.py index 5ca1b939b..bc172be69 100644 --- a/tests/functional/adapter/materialized_view_tests/utils.py +++ b/tests/functional/adapter/materialized_view_tests/utils.py @@ -1,6 +1,7 @@ -from typing import Optional +from typing import List, Optional from dbt.adapters.base.relation import BaseRelation +from dbt.tests.util import run_dbt_and_capture from dbt.adapters.redshift.relation import RedshiftRelation @@ -67,3 +68,20 @@ def query_autorefresh(project, relation: RedshiftRelation) -> bool: and trim(mv.db_name) ilike '{ relation.database }' """ return project.run_sql(sql, fetch="one")[0] + + +def run_dbt_and_capture_with_retries_redshift_mv(args: List[str], max_retries: int = 10): + """ + We need to retry `run_dbt` calls on Redshift because we get sporadic failures of the form: + + Database Error in model my_materialized_view (models/my_materialized_view.sql) + could not open relation with OID 14957412 + """ + retries = 0 + while retries < max_retries: + try: + # there's no point to using this with expect_pass=False + return run_dbt_and_capture(args, expect_pass=True) + except AssertionError: + retries += 1 + return None From 764f839bba5a85b3783c17d324145193523a1f75 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Aug 2023 12:19:50 -0400 Subject: [PATCH 15/45] Bump mypy from 1.4.1 to 1.5.0 (#573) * Bump mypy from 1.4.1 to 1.5.0 Bumps [mypy](https://github.com/python/mypy) from 1.4.1 to 1.5.0. - [Commits](https://github.com/python/mypy/compare/v1.4.1...v1.5.0) --- updated-dependencies: - dependency-name: mypy dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Add automated changelog yaml from template for bot PR --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Github Build Bot --- .changes/unreleased/Dependencies-20230810-193150.yaml | 6 ++++++ dev-requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Dependencies-20230810-193150.yaml diff --git a/.changes/unreleased/Dependencies-20230810-193150.yaml b/.changes/unreleased/Dependencies-20230810-193150.yaml new file mode 100644 index 000000000..e2b0c1250 --- /dev/null +++ b/.changes/unreleased/Dependencies-20230810-193150.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Bump mypy from 1.4.1 to 1.5.0" +time: 2023-08-10T19:31:50.00000Z +custom: + Author: dependabot[bot] + PR: 573 diff --git a/dev-requirements.txt b/dev-requirements.txt index 69671bced..e3444fde8 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -14,7 +14,7 @@ flake8~=6.1 flaky~=3.7 freezegun~=1.2 ipdb~=0.13.13 -mypy==1.4.1 # patch updates have historically introduced breaking changes +mypy==1.5.0 # patch updates have historically introduced breaking changes pip-tools~=7.2 pre-commit~=3.3 pre-commit-hooks~=4.4 From 89b18e20840e47819c543561370ab6f0eed619f7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Aug 2023 16:22:02 +0000 Subject: [PATCH 16/45] Update pip-tools requirement from ~=7.2 to ~=7.3 (#572) * Update pip-tools requirement from ~=7.2 to ~=7.3 Updates the requirements on [pip-tools](https://github.com/jazzband/pip-tools) to permit the latest version. - [Release notes](https://github.com/jazzband/pip-tools/releases) - [Changelog](https://github.com/jazzband/pip-tools/blob/main/CHANGELOG.md) - [Commits](https://github.com/jazzband/pip-tools/compare/7.2.0...7.3.0) --- updated-dependencies: - dependency-name: pip-tools dependency-type: direct:development ... Signed-off-by: dependabot[bot] * Add automated changelog yaml from template for bot PR --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Github Build Bot Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com> --- .changes/unreleased/Dependencies-20230810-193846.yaml | 6 ++++++ dev-requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Dependencies-20230810-193846.yaml diff --git a/.changes/unreleased/Dependencies-20230810-193846.yaml b/.changes/unreleased/Dependencies-20230810-193846.yaml new file mode 100644 index 000000000..4a55d3114 --- /dev/null +++ b/.changes/unreleased/Dependencies-20230810-193846.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Update pip-tools requirement from ~=7.2 to ~=7.3" +time: 2023-08-10T19:38:46.00000Z +custom: + Author: dependabot[bot] + PR: 572 diff --git a/dev-requirements.txt b/dev-requirements.txt index e3444fde8..08ac7987f 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -15,7 +15,7 @@ flaky~=3.7 freezegun~=1.2 ipdb~=0.13.13 mypy==1.5.0 # patch updates have historically introduced breaking changes -pip-tools~=7.2 +pip-tools~=7.3 pre-commit~=3.3 pre-commit-hooks~=4.4 pytest~=7.4 From 68afcbaf4bc7e2bae2e79cd0ccc57fe541333474 Mon Sep 17 00:00:00 2001 From: Mike Alfare <13974384+mikealfare@users.noreply.github.com> Date: Fri, 11 Aug 2023 17:49:29 -0400 Subject: [PATCH 17/45] add datadog env vars to tox.ini (#576) --- tox.ini | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index e594c943a..12c25b37e 100644 --- a/tox.ini +++ b/tox.ini @@ -20,8 +20,11 @@ passenv = DBT_* REDSHIFT_TEST_* PYTEST_ADDOPTS - DD_SERVICE + DD_CIVISIBILITY_AGENTLESS_ENABLED + DD_API_KEY + DD_SITE DD_ENV + DD_SERVICE commands = {envpython} -m pytest --dist=loadscope {posargs} tests/functional -k "not tests/functional/adapter/utils" {envpython} -m pytest --dist=loadscope {posargs} tests/functional/adapter/utils From ae6609d35aa7ae88763fbf9cfa3e951a52576eeb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 12 Aug 2023 03:03:16 +0000 Subject: [PATCH 18/45] Update ddtrace requirement from ~=1.17 to ~=1.18 (#575) * Update ddtrace requirement from ~=1.17 to ~=1.18 Updates the requirements on [ddtrace](https://github.com/DataDog/dd-trace-py) to permit the latest version. - [Release notes](https://github.com/DataDog/dd-trace-py/releases) - [Changelog](https://github.com/DataDog/dd-trace-py/blob/1.x/CHANGELOG.md) - [Commits](https://github.com/DataDog/dd-trace-py/compare/v1.17.0...v1.18.0) --- updated-dependencies: - dependency-name: ddtrace dependency-type: direct:development ... Signed-off-by: dependabot[bot] * Add automated changelog yaml from template for bot PR --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Github Build Bot --- .changes/unreleased/Dependencies-20230811-195421.yaml | 6 ++++++ dev-requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Dependencies-20230811-195421.yaml diff --git a/.changes/unreleased/Dependencies-20230811-195421.yaml b/.changes/unreleased/Dependencies-20230811-195421.yaml new file mode 100644 index 000000000..5cc2f61bf --- /dev/null +++ b/.changes/unreleased/Dependencies-20230811-195421.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Update ddtrace requirement from ~=1.17 to ~=1.18" +time: 2023-08-11T19:54:21.00000Z +custom: + Author: dependabot[bot] + PR: 575 diff --git a/dev-requirements.txt b/dev-requirements.txt index 08ac7987f..187a7f4a4 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -9,7 +9,7 @@ git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-postgres&subdirectory=plugi black~=23.7 bumpversion~=0.6.0 click~=8.1 -ddtrace~=1.17 +ddtrace~=1.18 flake8~=6.1 flaky~=3.7 freezegun~=1.2 From 8d66c92c4ddec5ed427c9c4f73c0e382001950fd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Aug 2023 12:25:28 -0400 Subject: [PATCH 19/45] Update tox requirement from ~=4.7 to ~=4.8 (#581) * Update tox requirement from ~=4.7 to ~=4.8 Updates the requirements on [tox](https://github.com/tox-dev/tox) to permit the latest version. - [Release notes](https://github.com/tox-dev/tox/releases) - [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst) - [Commits](https://github.com/tox-dev/tox/compare/4.7.0...4.8.0) --- updated-dependencies: - dependency-name: tox dependency-type: direct:development ... Signed-off-by: dependabot[bot] * Add automated changelog yaml from template for bot PR --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Github Build Bot --- .changes/unreleased/Dependencies-20230814-190800.yaml | 6 ++++++ dev-requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Dependencies-20230814-190800.yaml diff --git a/.changes/unreleased/Dependencies-20230814-190800.yaml b/.changes/unreleased/Dependencies-20230814-190800.yaml new file mode 100644 index 000000000..0e39e5ba7 --- /dev/null +++ b/.changes/unreleased/Dependencies-20230814-190800.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Update tox requirement from ~=4.7 to ~=4.8" +time: 2023-08-14T19:08:00.00000Z +custom: + Author: dependabot[bot] + PR: 581 diff --git a/dev-requirements.txt b/dev-requirements.txt index 187a7f4a4..d65049019 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -24,7 +24,7 @@ pytest-dotenv~=0.5.2 pytest-logbook~=1.2 pytest-xdist~=3.3 pytz~=2023.3 -tox~=4.7 +tox~=4.8 types-pytz~=2023.3 types-requests~=2.31 twine~=4.0 From 8eb13b1e51cedfc705c0e7867d2f2b74c8de6e43 Mon Sep 17 00:00:00 2001 From: Mike Alfare <13974384+mikealfare@users.noreply.github.com> Date: Wed, 16 Aug 2023 14:06:27 -0400 Subject: [PATCH 20/45] split out integration tests to fit on the windows free tier (#582) Co-authored-by: colin-rogers-dbt <111200756+colin-rogers-dbt@users.noreply.github.com> --- tox.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 12c25b37e..c490fed9a 100644 --- a/tox.ini +++ b/tox.ini @@ -26,8 +26,9 @@ passenv = DD_ENV DD_SERVICE commands = - {envpython} -m pytest --dist=loadscope {posargs} tests/functional -k "not tests/functional/adapter/utils" + {envpython} -m pytest --dist=loadscope {posargs} tests/functional -k "not tests/functional/adapter/utils and not tests/functional/adapter/incremental" {envpython} -m pytest --dist=loadscope {posargs} tests/functional/adapter/utils + {envpython} -m pytest --dist=loadscope {posargs} tests/functional/adapter/incremental deps = -rdev-requirements.txt -e. From 41d0799fd226aea631d7fdb4a4df51de52409f0c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Aug 2023 15:23:25 -0500 Subject: [PATCH 21/45] Update tox requirement from ~=4.8 to ~=4.9 (#586) * Update tox requirement from ~=4.8 to ~=4.9 Updates the requirements on [tox](https://github.com/tox-dev/tox) to permit the latest version. - [Release notes](https://github.com/tox-dev/tox/releases) - [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst) - [Commits](https://github.com/tox-dev/tox/compare/4.8.0...4.9.0) --- updated-dependencies: - dependency-name: tox dependency-type: direct:development ... Signed-off-by: dependabot[bot] * Add automated changelog yaml from template for bot PR --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Github Build Bot --- .changes/unreleased/Dependencies-20230816-195442.yaml | 6 ++++++ dev-requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Dependencies-20230816-195442.yaml diff --git a/.changes/unreleased/Dependencies-20230816-195442.yaml b/.changes/unreleased/Dependencies-20230816-195442.yaml new file mode 100644 index 000000000..850982f99 --- /dev/null +++ b/.changes/unreleased/Dependencies-20230816-195442.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Update tox requirement from ~=4.8 to ~=4.9" +time: 2023-08-16T19:54:42.00000Z +custom: + Author: dependabot[bot] + PR: 586 diff --git a/dev-requirements.txt b/dev-requirements.txt index d65049019..b49896c69 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -24,7 +24,7 @@ pytest-dotenv~=0.5.2 pytest-logbook~=1.2 pytest-xdist~=3.3 pytz~=2023.3 -tox~=4.8 +tox~=4.9 types-pytz~=2023.3 types-requests~=2.31 twine~=4.0 From 47ae94c9020eceb5d55e77d846aa32285877cb76 Mon Sep 17 00:00:00 2001 From: Github Build Bot Date: Thu, 17 Aug 2023 21:48:32 +0000 Subject: [PATCH 22/45] Bumping version to 1.7.0b1 and generate changelog --- .bumpversion.cfg | 2 +- .changes/1.7.0-b1.md | 32 +++++++++++++++++ .../Dependencies-20230711-192047.yaml | 0 .../Dependencies-20230717-195349.yaml | 0 .../Dependencies-20230720-191748.yaml | 0 .../Dependencies-20230724-190537.yaml | 0 .../Dependencies-20230731-194135.yaml | 0 .../Dependencies-20230803-131633.yaml | 0 .../Dependencies-20230808-194553.yaml | 0 .../Dependencies-20230810-193150.yaml | 0 .../Dependencies-20230810-193846.yaml | 0 .../Dependencies-20230811-195421.yaml | 0 .../Dependencies-20230814-190800.yaml | 0 .../Dependencies-20230816-195442.yaml | 0 .../Features-20230803-111146.yaml | 0 .../Fixes-20230802-103350.yaml | 0 .../Under the Hood-20230724-164439.yaml | 0 .../Under the Hood-20230808-141645.yaml | 0 CHANGELOG.md | 34 +++++++++++++++++++ dbt/adapters/redshift/__version__.py | 2 +- 20 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 .changes/1.7.0-b1.md rename .changes/{unreleased => 1.7.0}/Dependencies-20230711-192047.yaml (100%) rename .changes/{unreleased => 1.7.0}/Dependencies-20230717-195349.yaml (100%) rename .changes/{unreleased => 1.7.0}/Dependencies-20230720-191748.yaml (100%) rename .changes/{unreleased => 1.7.0}/Dependencies-20230724-190537.yaml (100%) rename .changes/{unreleased => 1.7.0}/Dependencies-20230731-194135.yaml (100%) rename .changes/{unreleased => 1.7.0}/Dependencies-20230803-131633.yaml (100%) rename .changes/{unreleased => 1.7.0}/Dependencies-20230808-194553.yaml (100%) rename .changes/{unreleased => 1.7.0}/Dependencies-20230810-193150.yaml (100%) rename .changes/{unreleased => 1.7.0}/Dependencies-20230810-193846.yaml (100%) rename .changes/{unreleased => 1.7.0}/Dependencies-20230811-195421.yaml (100%) rename .changes/{unreleased => 1.7.0}/Dependencies-20230814-190800.yaml (100%) rename .changes/{unreleased => 1.7.0}/Dependencies-20230816-195442.yaml (100%) rename .changes/{unreleased => 1.7.0}/Features-20230803-111146.yaml (100%) rename .changes/{unreleased => 1.7.0}/Fixes-20230802-103350.yaml (100%) rename .changes/{unreleased => 1.7.0}/Under the Hood-20230724-164439.yaml (100%) rename .changes/{unreleased => 1.7.0}/Under the Hood-20230808-141645.yaml (100%) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index cffe9f374..b3daceb77 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.7.0a1 +current_version = 1.7.0b1 parse = (?P[\d]+) # major version number \.(?P[\d]+) # minor version number \.(?P[\d]+) # patch version number diff --git a/.changes/1.7.0-b1.md b/.changes/1.7.0-b1.md new file mode 100644 index 000000000..be669a9db --- /dev/null +++ b/.changes/1.7.0-b1.md @@ -0,0 +1,32 @@ +## dbt-redshift 1.7.0-b1 - August 17, 2023 + +### Features + +- Support DISTSTYLE for seeds ([#255](https://github.com/dbt-labs/dbt-redshift/issues/255)) + +### Fixes + +- Insert values of `merge_exclude_columns` when not matched ([#563](https://github.com/dbt-labs/dbt-redshift/issues/563)) + +### Under the Hood + +- Update stale workflow to use the centralized version ([#552](https://github.com/dbt-labs/dbt-redshift/issues/552)) +- Update flaky MV tests to use retry logic to avoid "cannot open relation with OID" error ([#569](https://github.com/dbt-labs/dbt-redshift/issues/569)) + +### Dependencies + +- Update black requirement from ~=23.3 to ~=23.7 ([#529](https://github.com/dbt-labs/dbt-redshift/pull/529)) +- Update pip-tools requirement from ~=6.14 to ~=7.0 ([#541](https://github.com/dbt-labs/dbt-redshift/pull/541)) +- Update ddtrace requirement from ~=1.16 to ~=1.17 ([#550](https://github.com/dbt-labs/dbt-redshift/pull/550)) +- Update wheel requirement from ~=0.40 to ~=0.41 ([#551](https://github.com/dbt-labs/dbt-redshift/pull/551)) +- Update flake8 requirement from ~=6.0 to ~=6.1 ([#562](https://github.com/dbt-labs/dbt-redshift/pull/562)) +- Update pip-tools requirement from ~=7.0 to ~=7.2 ([#567](https://github.com/dbt-labs/dbt-redshift/pull/567)) +- Update tox requirement from ~=4.6 to ~=4.7 ([#570](https://github.com/dbt-labs/dbt-redshift/pull/570)) +- Bump mypy from 1.4.1 to 1.5.0 ([#573](https://github.com/dbt-labs/dbt-redshift/pull/573)) +- Update pip-tools requirement from ~=7.2 to ~=7.3 ([#572](https://github.com/dbt-labs/dbt-redshift/pull/572)) +- Update ddtrace requirement from ~=1.17 to ~=1.18 ([#575](https://github.com/dbt-labs/dbt-redshift/pull/575)) +- Update tox requirement from ~=4.7 to ~=4.8 ([#581](https://github.com/dbt-labs/dbt-redshift/pull/581)) +- Update tox requirement from ~=4.8 to ~=4.9 ([#586](https://github.com/dbt-labs/dbt-redshift/pull/586)) + +### Contributors +- [@WillAyd](https://github.com/WillAyd) ([#255](https://github.com/dbt-labs/dbt-redshift/issues/255)) diff --git a/.changes/unreleased/Dependencies-20230711-192047.yaml b/.changes/1.7.0/Dependencies-20230711-192047.yaml similarity index 100% rename from .changes/unreleased/Dependencies-20230711-192047.yaml rename to .changes/1.7.0/Dependencies-20230711-192047.yaml diff --git a/.changes/unreleased/Dependencies-20230717-195349.yaml b/.changes/1.7.0/Dependencies-20230717-195349.yaml similarity index 100% rename from .changes/unreleased/Dependencies-20230717-195349.yaml rename to .changes/1.7.0/Dependencies-20230717-195349.yaml diff --git a/.changes/unreleased/Dependencies-20230720-191748.yaml b/.changes/1.7.0/Dependencies-20230720-191748.yaml similarity index 100% rename from .changes/unreleased/Dependencies-20230720-191748.yaml rename to .changes/1.7.0/Dependencies-20230720-191748.yaml diff --git a/.changes/unreleased/Dependencies-20230724-190537.yaml b/.changes/1.7.0/Dependencies-20230724-190537.yaml similarity index 100% rename from .changes/unreleased/Dependencies-20230724-190537.yaml rename to .changes/1.7.0/Dependencies-20230724-190537.yaml diff --git a/.changes/unreleased/Dependencies-20230731-194135.yaml b/.changes/1.7.0/Dependencies-20230731-194135.yaml similarity index 100% rename from .changes/unreleased/Dependencies-20230731-194135.yaml rename to .changes/1.7.0/Dependencies-20230731-194135.yaml diff --git a/.changes/unreleased/Dependencies-20230803-131633.yaml b/.changes/1.7.0/Dependencies-20230803-131633.yaml similarity index 100% rename from .changes/unreleased/Dependencies-20230803-131633.yaml rename to .changes/1.7.0/Dependencies-20230803-131633.yaml diff --git a/.changes/unreleased/Dependencies-20230808-194553.yaml b/.changes/1.7.0/Dependencies-20230808-194553.yaml similarity index 100% rename from .changes/unreleased/Dependencies-20230808-194553.yaml rename to .changes/1.7.0/Dependencies-20230808-194553.yaml diff --git a/.changes/unreleased/Dependencies-20230810-193150.yaml b/.changes/1.7.0/Dependencies-20230810-193150.yaml similarity index 100% rename from .changes/unreleased/Dependencies-20230810-193150.yaml rename to .changes/1.7.0/Dependencies-20230810-193150.yaml diff --git a/.changes/unreleased/Dependencies-20230810-193846.yaml b/.changes/1.7.0/Dependencies-20230810-193846.yaml similarity index 100% rename from .changes/unreleased/Dependencies-20230810-193846.yaml rename to .changes/1.7.0/Dependencies-20230810-193846.yaml diff --git a/.changes/unreleased/Dependencies-20230811-195421.yaml b/.changes/1.7.0/Dependencies-20230811-195421.yaml similarity index 100% rename from .changes/unreleased/Dependencies-20230811-195421.yaml rename to .changes/1.7.0/Dependencies-20230811-195421.yaml diff --git a/.changes/unreleased/Dependencies-20230814-190800.yaml b/.changes/1.7.0/Dependencies-20230814-190800.yaml similarity index 100% rename from .changes/unreleased/Dependencies-20230814-190800.yaml rename to .changes/1.7.0/Dependencies-20230814-190800.yaml diff --git a/.changes/unreleased/Dependencies-20230816-195442.yaml b/.changes/1.7.0/Dependencies-20230816-195442.yaml similarity index 100% rename from .changes/unreleased/Dependencies-20230816-195442.yaml rename to .changes/1.7.0/Dependencies-20230816-195442.yaml diff --git a/.changes/unreleased/Features-20230803-111146.yaml b/.changes/1.7.0/Features-20230803-111146.yaml similarity index 100% rename from .changes/unreleased/Features-20230803-111146.yaml rename to .changes/1.7.0/Features-20230803-111146.yaml diff --git a/.changes/unreleased/Fixes-20230802-103350.yaml b/.changes/1.7.0/Fixes-20230802-103350.yaml similarity index 100% rename from .changes/unreleased/Fixes-20230802-103350.yaml rename to .changes/1.7.0/Fixes-20230802-103350.yaml diff --git a/.changes/unreleased/Under the Hood-20230724-164439.yaml b/.changes/1.7.0/Under the Hood-20230724-164439.yaml similarity index 100% rename from .changes/unreleased/Under the Hood-20230724-164439.yaml rename to .changes/1.7.0/Under the Hood-20230724-164439.yaml diff --git a/.changes/unreleased/Under the Hood-20230808-141645.yaml b/.changes/1.7.0/Under the Hood-20230808-141645.yaml similarity index 100% rename from .changes/unreleased/Under the Hood-20230808-141645.yaml rename to .changes/1.7.0/Under the Hood-20230808-141645.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 04a8e7db1..44a71a8bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,40 @@ - "Breaking changes" listed under a version may require action from end users or external maintainers when upgrading to that version. - Do not edit this file directly. This file is auto-generated using [changie](https://github.com/miniscruff/changie). For details on how to document a change, see [the contributing guide](https://github.com/dbt-labs/dbt-redshift/blob/main/CONTRIBUTING.md#adding-changelog-entry) +## dbt-redshift 1.7.0-b1 - August 17, 2023 + +### Features + +- Support DISTSTYLE for seeds ([#255](https://github.com/dbt-labs/dbt-redshift/issues/255)) + +### Fixes + +- Insert values of `merge_exclude_columns` when not matched ([#563](https://github.com/dbt-labs/dbt-redshift/issues/563)) + +### Under the Hood + +- Update stale workflow to use the centralized version ([#552](https://github.com/dbt-labs/dbt-redshift/issues/552)) +- Update flaky MV tests to use retry logic to avoid "cannot open relation with OID" error ([#569](https://github.com/dbt-labs/dbt-redshift/issues/569)) + +### Dependencies + +- Update black requirement from ~=23.3 to ~=23.7 ([#529](https://github.com/dbt-labs/dbt-redshift/pull/529)) +- Update pip-tools requirement from ~=6.14 to ~=7.0 ([#541](https://github.com/dbt-labs/dbt-redshift/pull/541)) +- Update ddtrace requirement from ~=1.16 to ~=1.17 ([#550](https://github.com/dbt-labs/dbt-redshift/pull/550)) +- Update wheel requirement from ~=0.40 to ~=0.41 ([#551](https://github.com/dbt-labs/dbt-redshift/pull/551)) +- Update flake8 requirement from ~=6.0 to ~=6.1 ([#562](https://github.com/dbt-labs/dbt-redshift/pull/562)) +- Update pip-tools requirement from ~=7.0 to ~=7.2 ([#567](https://github.com/dbt-labs/dbt-redshift/pull/567)) +- Update tox requirement from ~=4.6 to ~=4.7 ([#570](https://github.com/dbt-labs/dbt-redshift/pull/570)) +- Bump mypy from 1.4.1 to 1.5.0 ([#573](https://github.com/dbt-labs/dbt-redshift/pull/573)) +- Update pip-tools requirement from ~=7.2 to ~=7.3 ([#572](https://github.com/dbt-labs/dbt-redshift/pull/572)) +- Update ddtrace requirement from ~=1.17 to ~=1.18 ([#575](https://github.com/dbt-labs/dbt-redshift/pull/575)) +- Update tox requirement from ~=4.7 to ~=4.8 ([#581](https://github.com/dbt-labs/dbt-redshift/pull/581)) +- Update tox requirement from ~=4.8 to ~=4.9 ([#586](https://github.com/dbt-labs/dbt-redshift/pull/586)) + +### Contributors +- [@WillAyd](https://github.com/WillAyd) ([#255](https://github.com/dbt-labs/dbt-redshift/issues/255)) + + ## Previous Releases For information on prior major and minor releases, see their changelogs: - [1.6](https://github.com/dbt-labs/dbt-redshift/blob/1.6.latest/CHANGELOG.md) diff --git a/dbt/adapters/redshift/__version__.py b/dbt/adapters/redshift/__version__.py index 874bd74c8..48607b01f 100644 --- a/dbt/adapters/redshift/__version__.py +++ b/dbt/adapters/redshift/__version__.py @@ -1 +1 @@ -version = "1.7.0a1" +version = "1.7.0b1" From 6322063227c93e9276fa7a5c6d09026946d29685 Mon Sep 17 00:00:00 2001 From: Matthew McKnight <91097623+McKnight-42@users.noreply.github.com> Date: Tue, 29 Aug 2023 10:10:42 -0500 Subject: [PATCH 23/45] Auto-refresh on MVs not working as expected (#583) * initial change for autorefresh * add tests for different values of autorefresh * changelog --- .../unreleased/Fixes-20230815-151655.yaml | 6 +++ .../relation_configs/materialized_view.py | 18 +++++++- .../test_materialized_views.py | 42 +++++++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Fixes-20230815-151655.yaml diff --git a/.changes/unreleased/Fixes-20230815-151655.yaml b/.changes/unreleased/Fixes-20230815-151655.yaml new file mode 100644 index 000000000..15829017b --- /dev/null +++ b/.changes/unreleased/Fixes-20230815-151655.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: allow auto_refresh to take in boolean and str values for materialized views +time: 2023-08-15T15:16:55.771712-05:00 +custom: + Author: McKnight-42 + Issue: "560" diff --git a/dbt/adapters/redshift/relation_configs/materialized_view.py b/dbt/adapters/redshift/relation_configs/materialized_view.py index 5c76e949b..e69469476 100644 --- a/dbt/adapters/redshift/relation_configs/materialized_view.py +++ b/dbt/adapters/redshift/relation_configs/materialized_view.py @@ -123,9 +123,25 @@ def parse_model_node(cls, model_node: ModelNode) -> dict: "schema_name": model_node.schema, "database_name": model_node.database, "backup": model_node.config.extra.get("backup"), - "autorefresh": model_node.config.extra.get("auto_refresh"), } + autorefresh_value = model_node.config.extra.get("auto_refresh") + if autorefresh_value is not None: + if isinstance(autorefresh_value, bool): + config_dict["autorefresh"] = autorefresh_value + elif isinstance(autorefresh_value, str): + lower_autorefresh = autorefresh_value.lower() + if lower_autorefresh == "true": + config_dict["autorefresh"] = True + elif lower_autorefresh == "false": + config_dict["autorefresh"] = False + else: + raise ValueError( + "Invalid autorefresh representation. Please use accepted value ex.( True, 'true', 'True')" + ) + else: + raise TypeError("Invalid autorefresh value: expecting boolean or str.") + if query := model_node.compiled_code: config_dict.update({"query": query.strip()}) diff --git a/tests/functional/adapter/materialized_view_tests/test_materialized_views.py b/tests/functional/adapter/materialized_view_tests/test_materialized_views.py index 7bb5bcee6..be5414122 100644 --- a/tests/functional/adapter/materialized_view_tests/test_materialized_views.py +++ b/tests/functional/adapter/materialized_view_tests/test_materialized_views.py @@ -108,10 +108,26 @@ def change_config_via_alter(project, materialized_view): new_model = initial_model.replace("dist='id',", "dist='id', auto_refresh=True") set_model_file(project, materialized_view, new_model) + @staticmethod + def change_config_via_alter_str_true(project, materialized_view): + initial_model = get_model_file(project, materialized_view) + new_model = initial_model.replace("dist='id',", "dist='id', auto_refresh='true'") + set_model_file(project, materialized_view, new_model) + + @staticmethod + def change_config_via_alter_str_false(project, materialized_view): + initial_model = get_model_file(project, materialized_view) + new_model = initial_model.replace("dist='id',", "dist='id', auto_refresh='False'") + set_model_file(project, materialized_view, new_model) + @staticmethod def check_state_alter_change_is_applied(project, materialized_view): assert query_autorefresh(project, materialized_view) is True + @staticmethod + def check_state_alter_change_is_applied_str_false(project, materialized_view): + assert query_autorefresh(project, materialized_view) is False + @staticmethod def change_config_via_replace(project, materialized_view): initial_model = get_model_file(project, materialized_view) @@ -142,6 +158,32 @@ def test_change_is_applied_via_alter(self, project, my_materialized_view): assert_message_in_logs(f"Applying ALTER to: {my_materialized_view}", logs) assert_message_in_logs(f"Applying REPLACE to: {my_materialized_view}", logs, False) + def test_change_is_applied_via_alter_str_true(self, project, my_materialized_view): + self.check_start_state(project, my_materialized_view) + + self.change_config_via_alter_str_true(project, my_materialized_view) + _, logs = run_dbt_and_capture_with_retries_redshift_mv( + ["--debug", "run", "--models", my_materialized_view.name] + ) + + self.check_state_alter_change_is_applied(project, my_materialized_view) + + assert_message_in_logs(f"Applying ALTER to: {my_materialized_view}", logs) + assert_message_in_logs(f"Applying REPLACE to: {my_materialized_view}", logs, False) + + def test_change_is_applied_via_alter_str_false(self, project, my_materialized_view): + self.check_start_state(project, my_materialized_view) + + self.change_config_via_alter_str_false(project, my_materialized_view) + _, logs = run_dbt_and_capture_with_retries_redshift_mv( + ["--debug", "run", "--models", my_materialized_view.name] + ) + + self.check_state_alter_change_is_applied_str_false(project, my_materialized_view) + + assert_message_in_logs(f"Applying ALTER to: {my_materialized_view}", logs) + assert_message_in_logs(f"Applying REPLACE to: {my_materialized_view}", logs, False) + def test_change_is_applied_via_replace(self, project, my_materialized_view): self.check_start_state(project, my_materialized_view) From e95685fc78f3af5f6c27c672ead473d90f2a3a29 Mon Sep 17 00:00:00 2001 From: Gerda Shank Date: Wed, 30 Aug 2023 18:02:44 -0400 Subject: [PATCH 24/45] Remove import of FieldEncoder from hologram (#592) * Remove import of FieldEncoder from hologram * Update Fixes-20230830-164611.yaml --------- Co-authored-by: colin-rogers-dbt <111200756+colin-rogers-dbt@users.noreply.github.com> --- .changes/unreleased/Fixes-20230830-164611.yaml | 6 ++++++ dbt/adapters/redshift/connections.py | 16 ++-------------- 2 files changed, 8 insertions(+), 14 deletions(-) create mode 100644 .changes/unreleased/Fixes-20230830-164611.yaml diff --git a/.changes/unreleased/Fixes-20230830-164611.yaml b/.changes/unreleased/Fixes-20230830-164611.yaml new file mode 100644 index 000000000..ba8d47c01 --- /dev/null +++ b/.changes/unreleased/Fixes-20230830-164611.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Fix to support removal of hologram, remove unused IAMDuration encoder +time: 2023-08-30T16:46:11.83975-04:00 +custom: + Author: gshank + Issue: "591" diff --git a/dbt/adapters/redshift/connections.py b/dbt/adapters/redshift/connections.py index 500de430f..83d05b587 100644 --- a/dbt/adapters/redshift/connections.py +++ b/dbt/adapters/redshift/connections.py @@ -1,7 +1,7 @@ import re from multiprocessing import Lock from contextlib import contextmanager -from typing import NewType, Tuple, Union, Optional, List +from typing import Tuple, Union, Optional, List from dataclasses import dataclass, field import agate @@ -12,7 +12,7 @@ from dbt.adapters.sql import SQLConnectionManager from dbt.contracts.connection import AdapterResponse, Connection, Credentials from dbt.contracts.util import Replaceable -from dbt.dataclass_schema import FieldEncoder, dbtClassMixin, StrEnum, ValidationError +from dbt.dataclass_schema import dbtClassMixin, StrEnum, ValidationError from dbt.events import AdapterLogger from dbt.exceptions import DbtRuntimeError, CompilationError import dbt.flags @@ -36,18 +36,6 @@ def get_message(self) -> str: drop_lock: Lock = dbt.flags.MP_CONTEXT.Lock() # type: ignore -IAMDuration = NewType("IAMDuration", int) - - -class IAMDurationEncoder(FieldEncoder): - @property - def json_schema(self): - return {"type": "integer", "minimum": 0, "maximum": 65535} - - -dbtClassMixin.register_field_encoders({IAMDuration: IAMDurationEncoder()}) - - class RedshiftConnectionMethod(StrEnum): DATABASE = "database" IAM = "iam" From aab62b151b5a4bfafee899791f6db55cfbea50b7 Mon Sep 17 00:00:00 2001 From: Mike Alfare <13974384+mikealfare@users.noreply.github.com> Date: Thu, 31 Aug 2023 16:50:24 -0400 Subject: [PATCH 25/45] Feature/materialized views/adap 841 (#590) * changie * break out materialized view ddl, leave config changes in materialization file * move generic drop statement into macros/relations/drop.sql --- .../Under the Hood-20230829-113206.yaml | 7 ++ dbt/include/redshift/macros/adapters.sql | 9 -- .../materializations/materialized_view.sql | 101 ------------------ .../redshift/macros/relations/drop.sql | 7 ++ .../relations/materialized_view/_replace.sql | 4 + .../relations/materialized_view/alter.sql | 26 +++++ .../relations/materialized_view/create.sql | 15 +++ .../relations/materialized_view/describe.sql | 38 +++++++ .../relations/materialized_view/drop.sql | 3 + .../relations/materialized_view/refresh.sql | 3 + 10 files changed, 103 insertions(+), 110 deletions(-) create mode 100644 .changes/unreleased/Under the Hood-20230829-113206.yaml create mode 100644 dbt/include/redshift/macros/relations/drop.sql create mode 100644 dbt/include/redshift/macros/relations/materialized_view/_replace.sql create mode 100644 dbt/include/redshift/macros/relations/materialized_view/alter.sql create mode 100644 dbt/include/redshift/macros/relations/materialized_view/create.sql create mode 100644 dbt/include/redshift/macros/relations/materialized_view/describe.sql create mode 100644 dbt/include/redshift/macros/relations/materialized_view/drop.sql create mode 100644 dbt/include/redshift/macros/relations/materialized_view/refresh.sql diff --git a/.changes/unreleased/Under the Hood-20230829-113206.yaml b/.changes/unreleased/Under the Hood-20230829-113206.yaml new file mode 100644 index 000000000..d9dafe59c --- /dev/null +++ b/.changes/unreleased/Under the Hood-20230829-113206.yaml @@ -0,0 +1,7 @@ +kind: Under the Hood +body: Restructure macro files to be more granular; organize macros by relation and + type (create, drop, etc.) +time: 2023-08-29T11:32:06.653271-04:00 +custom: + Author: mikealfare + Issue: "590" diff --git a/dbt/include/redshift/macros/adapters.sql b/dbt/include/redshift/macros/adapters.sql index 557f582a5..5da047f58 100644 --- a/dbt/include/redshift/macros/adapters.sql +++ b/dbt/include/redshift/macros/adapters.sql @@ -312,12 +312,3 @@ {% endif %} {% endmacro %} - - -{% macro redshift__get_drop_relation_sql(relation) %} - {%- if relation.is_materialized_view -%} - {{ redshift__drop_materialized_view(relation) }} - {%- else -%} - drop {{ relation.type }} if exists {{ relation }} cascade - {%- endif -%} -{% endmacro %} diff --git a/dbt/include/redshift/macros/materializations/materialized_view.sql b/dbt/include/redshift/macros/materializations/materialized_view.sql index 736eaacca..5cdb26504 100644 --- a/dbt/include/redshift/macros/materializations/materialized_view.sql +++ b/dbt/include/redshift/macros/materializations/materialized_view.sql @@ -1,106 +1,5 @@ -{% macro redshift__get_alter_materialized_view_as_sql( - relation, - configuration_changes, - sql, - existing_relation, - backup_relation, - intermediate_relation -) %} - - -- apply a full refresh immediately if needed - {% if configuration_changes.requires_full_refresh %} - - {{ get_replace_materialized_view_as_sql(relation, sql, existing_relation, backup_relation, intermediate_relation) }} - - -- otherwise apply individual changes as needed - {% else %} - - {%- set autorefresh = configuration_changes.autorefresh -%} - {%- if autorefresh -%}{{- log('Applying UPDATE AUTOREFRESH to: ' ~ relation) -}}{%- endif -%} - - alter materialized view {{ relation }} - auto refresh {% if autorefresh.context %}yes{% else %}no{% endif %} - - {%- endif -%} - -{% endmacro %} - - -{% macro redshift__get_create_materialized_view_as_sql(relation, sql) %} - - {%- set materialized_view = relation.from_runtime_config(config) -%} - - create materialized view {{ materialized_view.path }} - backup {% if materialized_view.backup %}yes{% else %}no{% endif %} - diststyle {{ materialized_view.dist.diststyle }} - {% if materialized_view.dist.distkey %}distkey ({{ materialized_view.dist.distkey }}){% endif %} - {% if materialized_view.sort.sortkey %}sortkey ({{ ','.join(materialized_view.sort.sortkey) }}){% endif %} - auto refresh {% if materialized_view.autorefresh %}yes{% else %}no{% endif %} - as ( - {{ materialized_view.query }} - ); - -{% endmacro %} - - -{% macro redshift__get_replace_materialized_view_as_sql(relation, sql, existing_relation, backup_relation, intermediate_relation) %} - {{ redshift__get_drop_relation_sql(existing_relation) }}; - {{ get_create_materialized_view_as_sql(relation, sql) }} -{% endmacro %} - - {% macro redshift__get_materialized_view_configuration_changes(existing_relation, new_config) %} {% set _existing_materialized_view = redshift__describe_materialized_view(existing_relation) %} {% set _configuration_changes = existing_relation.materialized_view_config_changeset(_existing_materialized_view, new_config) %} {% do return(_configuration_changes) %} {% endmacro %} - - -{% macro redshift__refresh_materialized_view(relation) -%} - refresh materialized view {{ relation }} -{% endmacro %} - - -{% macro redshift__describe_materialized_view(relation) %} - {#- - These need to be separate queries because redshift will not let you run queries - against svv_table_info and pg_views in the same query. The same is true of svv_redshift_columns. - -#} - - {%- set _materialized_view_sql -%} - select - tb.database, - tb.schema, - tb.table, - tb.diststyle, - tb.sortkey1, - mv.autorefresh - from svv_table_info tb - left join stv_mv_info mv - on mv.db_name = tb.database - and mv.schema = tb.schema - and mv.name = tb.table - where tb.table ilike '{{ relation.identifier }}' - and tb.schema ilike '{{ relation.schema }}' - and tb.database ilike '{{ relation.database }}' - {%- endset %} - {% set _materialized_view = run_query(_materialized_view_sql) %} - - {%- set _query_sql -%} - select - vw.definition - from pg_views vw - where vw.viewname = '{{ relation.identifier }}' - and vw.schemaname = '{{ relation.schema }}' - and vw.definition ilike '%create materialized view%' - {%- endset %} - {% set _query = run_query(_query_sql) %} - - {% do return({'materialized_view': _materialized_view, 'query': _query}) %} - -{% endmacro %} - - -{% macro redshift__drop_materialized_view(relation) -%} - drop materialized view if exists {{ relation }} -{%- endmacro %} diff --git a/dbt/include/redshift/macros/relations/drop.sql b/dbt/include/redshift/macros/relations/drop.sql new file mode 100644 index 000000000..2709f7763 --- /dev/null +++ b/dbt/include/redshift/macros/relations/drop.sql @@ -0,0 +1,7 @@ +{% macro redshift__get_drop_relation_sql(relation) %} + {%- if relation.is_materialized_view -%} + {{ redshift__drop_materialized_view(relation) }} + {%- else -%} + drop {{ relation.type }} if exists {{ relation }} cascade + {%- endif -%} +{% endmacro %} diff --git a/dbt/include/redshift/macros/relations/materialized_view/_replace.sql b/dbt/include/redshift/macros/relations/materialized_view/_replace.sql new file mode 100644 index 000000000..2146e0967 --- /dev/null +++ b/dbt/include/redshift/macros/relations/materialized_view/_replace.sql @@ -0,0 +1,4 @@ +{% macro redshift__get_replace_materialized_view_as_sql(relation, sql, existing_relation, backup_relation, intermediate_relation) %} + {{ redshift__get_drop_relation_sql(existing_relation) }}; + {{ get_create_materialized_view_as_sql(relation, sql) }} +{% endmacro %} diff --git a/dbt/include/redshift/macros/relations/materialized_view/alter.sql b/dbt/include/redshift/macros/relations/materialized_view/alter.sql new file mode 100644 index 000000000..6165e441d --- /dev/null +++ b/dbt/include/redshift/macros/relations/materialized_view/alter.sql @@ -0,0 +1,26 @@ +{% macro redshift__get_alter_materialized_view_as_sql( + relation, + configuration_changes, + sql, + existing_relation, + backup_relation, + intermediate_relation +) %} + + -- apply a full refresh immediately if needed + {% if configuration_changes.requires_full_refresh %} + + {{ get_replace_materialized_view_as_sql(relation, sql, existing_relation, backup_relation, intermediate_relation) }} + + -- otherwise apply individual changes as needed + {% else %} + + {%- set autorefresh = configuration_changes.autorefresh -%} + {%- if autorefresh -%}{{- log('Applying UPDATE AUTOREFRESH to: ' ~ relation) -}}{%- endif -%} + + alter materialized view {{ relation }} + auto refresh {% if autorefresh.context %}yes{% else %}no{% endif %} + + {%- endif -%} + +{% endmacro %} diff --git a/dbt/include/redshift/macros/relations/materialized_view/create.sql b/dbt/include/redshift/macros/relations/materialized_view/create.sql new file mode 100644 index 000000000..b84680525 --- /dev/null +++ b/dbt/include/redshift/macros/relations/materialized_view/create.sql @@ -0,0 +1,15 @@ +{% macro redshift__get_create_materialized_view_as_sql(relation, sql) %} + + {%- set materialized_view = relation.from_runtime_config(config) -%} + + create materialized view {{ materialized_view.path }} + backup {% if materialized_view.backup %}yes{% else %}no{% endif %} + diststyle {{ materialized_view.dist.diststyle }} + {% if materialized_view.dist.distkey %}distkey ({{ materialized_view.dist.distkey }}){% endif %} + {% if materialized_view.sort.sortkey %}sortkey ({{ ','.join(materialized_view.sort.sortkey) }}){% endif %} + auto refresh {% if materialized_view.autorefresh %}yes{% else %}no{% endif %} + as ( + {{ materialized_view.query }} + ); + +{% endmacro %} diff --git a/dbt/include/redshift/macros/relations/materialized_view/describe.sql b/dbt/include/redshift/macros/relations/materialized_view/describe.sql new file mode 100644 index 000000000..5a8213068 --- /dev/null +++ b/dbt/include/redshift/macros/relations/materialized_view/describe.sql @@ -0,0 +1,38 @@ +{% macro redshift__describe_materialized_view(relation) %} + {#- + These need to be separate queries because redshift will not let you run queries + against svv_table_info and pg_views in the same query. The same is true of svv_redshift_columns. + -#} + + {%- set _materialized_view_sql -%} + select + tb.database, + tb.schema, + tb.table, + tb.diststyle, + tb.sortkey1, + mv.autorefresh + from svv_table_info tb + left join stv_mv_info mv + on mv.db_name = tb.database + and mv.schema = tb.schema + and mv.name = tb.table + where tb.table ilike '{{ relation.identifier }}' + and tb.schema ilike '{{ relation.schema }}' + and tb.database ilike '{{ relation.database }}' + {%- endset %} + {% set _materialized_view = run_query(_materialized_view_sql) %} + + {%- set _query_sql -%} + select + vw.definition + from pg_views vw + where vw.viewname = '{{ relation.identifier }}' + and vw.schemaname = '{{ relation.schema }}' + and vw.definition ilike '%create materialized view%' + {%- endset %} + {% set _query = run_query(_query_sql) %} + + {% do return({'materialized_view': _materialized_view, 'query': _query}) %} + +{% endmacro %} diff --git a/dbt/include/redshift/macros/relations/materialized_view/drop.sql b/dbt/include/redshift/macros/relations/materialized_view/drop.sql new file mode 100644 index 000000000..76f92e0e9 --- /dev/null +++ b/dbt/include/redshift/macros/relations/materialized_view/drop.sql @@ -0,0 +1,3 @@ +{% macro redshift__drop_materialized_view(relation) -%} + drop materialized view if exists {{ relation }} +{%- endmacro %} diff --git a/dbt/include/redshift/macros/relations/materialized_view/refresh.sql b/dbt/include/redshift/macros/relations/materialized_view/refresh.sql new file mode 100644 index 000000000..c53ed2786 --- /dev/null +++ b/dbt/include/redshift/macros/relations/materialized_view/refresh.sql @@ -0,0 +1,3 @@ +{% macro redshift__refresh_materialized_view(relation) -%} + refresh materialized view {{ relation }} +{% endmacro %} From aaf6c6e22a3f8553aa81816f580ef2c014b3f444 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Sep 2023 22:55:31 +0000 Subject: [PATCH 26/45] Bump mypy from 1.5.0 to 1.5.1 (#585) * Bump mypy from 1.5.0 to 1.5.1 Bumps [mypy](https://github.com/python/mypy) from 1.5.0 to 1.5.1. - [Commits](https://github.com/python/mypy/compare/v1.5.0...v1.5.1) --- updated-dependencies: - dependency-name: mypy dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Add automated changelog yaml from template for bot PR --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Github Build Bot Co-authored-by: Matthew McKnight <91097623+McKnight-42@users.noreply.github.com> Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com> --- .changes/unreleased/Dependencies-20230816-195425.yaml | 6 ++++++ dev-requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Dependencies-20230816-195425.yaml diff --git a/.changes/unreleased/Dependencies-20230816-195425.yaml b/.changes/unreleased/Dependencies-20230816-195425.yaml new file mode 100644 index 000000000..989b20103 --- /dev/null +++ b/.changes/unreleased/Dependencies-20230816-195425.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Bump mypy from 1.5.0 to 1.5.1" +time: 2023-08-16T19:54:25.00000Z +custom: + Author: dependabot[bot] + PR: 585 diff --git a/dev-requirements.txt b/dev-requirements.txt index b49896c69..a049951e4 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -14,7 +14,7 @@ flake8~=6.1 flaky~=3.7 freezegun~=1.2 ipdb~=0.13.13 -mypy==1.5.0 # patch updates have historically introduced breaking changes +mypy==1.5.1 # patch updates have historically introduced breaking changes pip-tools~=7.3 pre-commit~=3.3 pre-commit-hooks~=4.4 From f2ef004e6587374c9755237e3bd7de6f8c678454 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Sep 2023 23:08:09 +0000 Subject: [PATCH 27/45] Update tox requirement from ~=4.9 to ~=4.10 (#588) * Update tox requirement from ~=4.9 to ~=4.10 Updates the requirements on [tox](https://github.com/tox-dev/tox) to permit the latest version. - [Release notes](https://github.com/tox-dev/tox/releases) - [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst) - [Commits](https://github.com/tox-dev/tox/compare/4.9.0...4.10.0) --- updated-dependencies: - dependency-name: tox dependency-type: direct:development ... Signed-off-by: dependabot[bot] * Add automated changelog yaml from template for bot PR --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Github Build Bot --- .changes/unreleased/Dependencies-20230821-192842.yaml | 6 ++++++ dev-requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Dependencies-20230821-192842.yaml diff --git a/.changes/unreleased/Dependencies-20230821-192842.yaml b/.changes/unreleased/Dependencies-20230821-192842.yaml new file mode 100644 index 000000000..c6e5a7a6b --- /dev/null +++ b/.changes/unreleased/Dependencies-20230821-192842.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Update tox requirement from ~=4.9 to ~=4.10" +time: 2023-08-21T19:28:42.00000Z +custom: + Author: dependabot[bot] + PR: 588 diff --git a/dev-requirements.txt b/dev-requirements.txt index a049951e4..f887fe214 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -24,7 +24,7 @@ pytest-dotenv~=0.5.2 pytest-logbook~=1.2 pytest-xdist~=3.3 pytz~=2023.3 -tox~=4.9 +tox~=4.10 types-pytz~=2023.3 types-requests~=2.31 twine~=4.0 From 4c5e49bb5826dd48001156c14445eabde8dee4b5 Mon Sep 17 00:00:00 2001 From: Matthew McKnight <91097623+McKnight-42@users.noreply.github.com> Date: Mon, 11 Sep 2023 11:41:29 -0500 Subject: [PATCH 28/45] change expected_stat types to match agate_helper change in dbt-core (#598) --- .changes/unreleased/Fixes-20230908-113019.yaml | 6 ++++++ tests/functional/adapter/expected_stats.py | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .changes/unreleased/Fixes-20230908-113019.yaml diff --git a/.changes/unreleased/Fixes-20230908-113019.yaml b/.changes/unreleased/Fixes-20230908-113019.yaml new file mode 100644 index 000000000..ed5957317 --- /dev/null +++ b/.changes/unreleased/Fixes-20230908-113019.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: changes expected value types to AnyInteger to take into account changes in core +time: 2023-09-08T11:30:19.77143-05:00 +custom: + Author: McKnight-42 + Issue: "597" diff --git a/tests/functional/adapter/expected_stats.py b/tests/functional/adapter/expected_stats.py index 9e635bdbb..265ae225a 100644 --- a/tests/functional/adapter/expected_stats.py +++ b/tests/functional/adapter/expected_stats.py @@ -1,4 +1,4 @@ -from dbt.tests.util import AnyStringWith, AnyFloat, AnyString +from dbt.tests.util import AnyStringWith, AnyInteger, AnyString, AnyFloat def redshift_stats(): @@ -27,14 +27,14 @@ def redshift_stats(): "max_varchar": { "id": "max_varchar", "label": "Max Varchar", - "value": AnyFloat(), + "value": AnyInteger(), "description": "Size of the largest column that uses a VARCHAR data type.", "include": True, }, "size": { "id": "size", "label": "Approximate Size", - "value": AnyFloat(), + "value": AnyInteger(), "description": "Approximate size of the table, calculated from a count of 1MB blocks", "include": True, }, From 9effccedff00885827bffe8b25de01906e425341 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 00:20:29 +0000 Subject: [PATCH 29/45] Update tox requirement from ~=4.10 to ~=4.11 (#594) * Update tox requirement from ~=4.10 to ~=4.11 Updates the requirements on [tox](https://github.com/tox-dev/tox) to permit the latest version. - [Release notes](https://github.com/tox-dev/tox/releases) - [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst) - [Commits](https://github.com/tox-dev/tox/compare/4.10.0...4.11.1) --- updated-dependencies: - dependency-name: tox dependency-type: direct:development ... Signed-off-by: dependabot[bot] * Add automated changelog yaml from template for bot PR --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Github Build Bot --- .changes/unreleased/Dependencies-20230901-230919.yaml | 6 ++++++ dev-requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Dependencies-20230901-230919.yaml diff --git a/.changes/unreleased/Dependencies-20230901-230919.yaml b/.changes/unreleased/Dependencies-20230901-230919.yaml new file mode 100644 index 000000000..178fc9ff5 --- /dev/null +++ b/.changes/unreleased/Dependencies-20230901-230919.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Update tox requirement from ~=4.10 to ~=4.11" +time: 2023-09-01T23:09:19.00000Z +custom: + Author: dependabot[bot] + PR: 594 diff --git a/dev-requirements.txt b/dev-requirements.txt index f887fe214..c4b2df3aa 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -24,7 +24,7 @@ pytest-dotenv~=0.5.2 pytest-logbook~=1.2 pytest-xdist~=3.3 pytz~=2023.3 -tox~=4.10 +tox~=4.11 types-pytz~=2023.3 types-requests~=2.31 twine~=4.0 From 5f242f646d710a37787e22c08bdaa820998e45e1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 00:25:56 +0000 Subject: [PATCH 30/45] Update pre-commit requirement from ~=3.3 to ~=3.4 (#596) * Update pre-commit requirement from ~=3.3 to ~=3.4 Updates the requirements on [pre-commit](https://github.com/pre-commit/pre-commit) to permit the latest version. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.3.0...v3.4.0) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development ... Signed-off-by: dependabot[bot] * Add automated changelog yaml from template for bot PR --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Github Build Bot Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com> --- .changes/unreleased/Dependencies-20230904-193307.yaml | 6 ++++++ dev-requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Dependencies-20230904-193307.yaml diff --git a/.changes/unreleased/Dependencies-20230904-193307.yaml b/.changes/unreleased/Dependencies-20230904-193307.yaml new file mode 100644 index 000000000..11707de31 --- /dev/null +++ b/.changes/unreleased/Dependencies-20230904-193307.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Update pre-commit requirement from ~=3.3 to ~=3.4" +time: 2023-09-04T19:33:07.00000Z +custom: + Author: dependabot[bot] + PR: 596 diff --git a/dev-requirements.txt b/dev-requirements.txt index c4b2df3aa..d558aa109 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -16,7 +16,7 @@ freezegun~=1.2 ipdb~=0.13.13 mypy==1.5.1 # patch updates have historically introduced breaking changes pip-tools~=7.3 -pre-commit~=3.3 +pre-commit~=3.4 pre-commit-hooks~=4.4 pytest~=7.4 pytest-csv~=3.0 From 538ad793769269454ff390135566a85d729fcdcc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 02:04:35 +0000 Subject: [PATCH 31/45] Update black requirement from ~=23.7 to ~=23.9 (#600) * Update black requirement from ~=23.7 to ~=23.9 Updates the requirements on [black](https://github.com/psf/black) to permit the latest version. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/compare/23.7.0...23.9.1) --- updated-dependencies: - dependency-name: black dependency-type: direct:development ... Signed-off-by: dependabot[bot] * Add automated changelog yaml from template for bot PR --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com> Co-authored-by: Github Build Bot --- .changes/unreleased/Dependencies-20230912-002353.yaml | 6 ++++++ dev-requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Dependencies-20230912-002353.yaml diff --git a/.changes/unreleased/Dependencies-20230912-002353.yaml b/.changes/unreleased/Dependencies-20230912-002353.yaml new file mode 100644 index 000000000..be7230348 --- /dev/null +++ b/.changes/unreleased/Dependencies-20230912-002353.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Update black requirement from ~=23.7 to ~=23.9" +time: 2023-09-12T00:23:53.00000Z +custom: + Author: dependabot[bot] + PR: 600 diff --git a/dev-requirements.txt b/dev-requirements.txt index d558aa109..96f252ebe 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -6,7 +6,7 @@ git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-postgres&subdirectory=plugi # if version 1.x or greater -> pin to major version # if version 0.x -> pin to minor -black~=23.7 +black~=23.9 bumpversion~=0.6.0 click~=8.1 ddtrace~=1.18 From 9bb38835b651a1fa85925f1db4b550d15eb74dc0 Mon Sep 17 00:00:00 2001 From: colin-rogers-dbt <111200756+colin-rogers-dbt@users.noreply.github.com> Date: Tue, 12 Sep 2023 14:19:33 -0700 Subject: [PATCH 32/45] Fix replace sql macro (#602) * use get_replace_sql in redshift__get_alter_materialized_view_as_sql * add changie --- .changes/unreleased/Fixes-20230912-133327.yaml | 5 +++++ .../redshift/macros/relations/materialized_view/alter.sql | 2 +- tests/functional/adapter/materialized_view_tests/utils.py | 5 +++-- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .changes/unreleased/Fixes-20230912-133327.yaml diff --git a/.changes/unreleased/Fixes-20230912-133327.yaml b/.changes/unreleased/Fixes-20230912-133327.yaml new file mode 100644 index 000000000..afa2f3657 --- /dev/null +++ b/.changes/unreleased/Fixes-20230912-133327.yaml @@ -0,0 +1,5 @@ +kind: Fixes +body: use get_replace_sql in redshift__get_alter_materialized_view_as_sql +time: 2023-09-12T13:33:27.451042-07:00 +custom: + Author: colin-rogers-dbt diff --git a/dbt/include/redshift/macros/relations/materialized_view/alter.sql b/dbt/include/redshift/macros/relations/materialized_view/alter.sql index 6165e441d..7f0379847 100644 --- a/dbt/include/redshift/macros/relations/materialized_view/alter.sql +++ b/dbt/include/redshift/macros/relations/materialized_view/alter.sql @@ -10,7 +10,7 @@ -- apply a full refresh immediately if needed {% if configuration_changes.requires_full_refresh %} - {{ get_replace_materialized_view_as_sql(relation, sql, existing_relation, backup_relation, intermediate_relation) }} + {{ get_replace_sql(existing_relation, relation, sql) }} -- otherwise apply individual changes as needed {% else %} diff --git a/tests/functional/adapter/materialized_view_tests/utils.py b/tests/functional/adapter/materialized_view_tests/utils.py index bc172be69..112ae3057 100644 --- a/tests/functional/adapter/materialized_view_tests/utils.py +++ b/tests/functional/adapter/materialized_view_tests/utils.py @@ -82,6 +82,7 @@ def run_dbt_and_capture_with_retries_redshift_mv(args: List[str], max_retries: i try: # there's no point to using this with expect_pass=False return run_dbt_and_capture(args, expect_pass=True) - except AssertionError: + except AssertionError as e: retries += 1 - return None + if retries == max_retries: + raise e From 56af9123dcde326c21d3f360589cc60cbe674aa0 Mon Sep 17 00:00:00 2001 From: colin-rogers-dbt <111200756+colin-rogers-dbt@users.noreply.github.com> Date: Wed, 13 Sep 2023 11:50:58 -0700 Subject: [PATCH 33/45] add relation macros and add relation renameable/replaceable config (#603) * add relation macros and add relation renameable/replaceable config * formatting cleanup * PR fixes * make tables irreplaceable --- .../unreleased/Fixes-20230912-133327.yaml | 4 +- dbt/adapters/redshift/relation.py | 11 +++ .../macros/materializations/table.sql | 69 +++++++++++++++++ .../redshift/macros/materializations/view.sql | 77 +++++++++++++++++++ .../redshift/macros/relations/drop.sql | 7 -- .../relations/materialized_view/_replace.sql | 4 - .../redshift/macros/relations/table/drop.sql | 3 + .../macros/relations/table/rename.sql | 3 + .../redshift/macros/relations/view/drop.sql | 3 + .../redshift/macros/relations/view/rename.sql | 3 + .../macros/relations/view/replace.sql | 18 +++++ .../test_materialized_views.py | 12 --- 12 files changed, 189 insertions(+), 25 deletions(-) create mode 100644 dbt/include/redshift/macros/materializations/table.sql create mode 100644 dbt/include/redshift/macros/materializations/view.sql delete mode 100644 dbt/include/redshift/macros/relations/drop.sql delete mode 100644 dbt/include/redshift/macros/relations/materialized_view/_replace.sql create mode 100644 dbt/include/redshift/macros/relations/table/drop.sql create mode 100644 dbt/include/redshift/macros/relations/table/rename.sql create mode 100644 dbt/include/redshift/macros/relations/view/drop.sql create mode 100644 dbt/include/redshift/macros/relations/view/rename.sql create mode 100644 dbt/include/redshift/macros/relations/view/replace.sql diff --git a/.changes/unreleased/Fixes-20230912-133327.yaml b/.changes/unreleased/Fixes-20230912-133327.yaml index afa2f3657..14528cad6 100644 --- a/.changes/unreleased/Fixes-20230912-133327.yaml +++ b/.changes/unreleased/Fixes-20230912-133327.yaml @@ -1,5 +1,5 @@ -kind: Fixes -body: use get_replace_sql in redshift__get_alter_materialized_view_as_sql +kind: Features +body: use get_replace_sql in redshift__get_alter_materialized_view_as_sql, avoid renaming materialized views with custom table.sql and view.sql time: 2023-09-12T13:33:27.451042-07:00 custom: Author: colin-rogers-dbt diff --git a/dbt/adapters/redshift/relation.py b/dbt/adapters/redshift/relation.py index 0ef4fe276..182b9b810 100644 --- a/dbt/adapters/redshift/relation.py +++ b/dbt/adapters/redshift/relation.py @@ -32,6 +32,17 @@ class RedshiftRelation(BaseRelation): relation_configs = { RelationType.MaterializedView.value: RedshiftMaterializedViewConfig, } + renameable_relations = frozenset( + { + RelationType.View, + RelationType.Table, + } + ) + replaceable_relations = frozenset( + { + RelationType.View, + } + ) def __post_init__(self): # Check for length of Redshift table/view names. diff --git a/dbt/include/redshift/macros/materializations/table.sql b/dbt/include/redshift/macros/materializations/table.sql new file mode 100644 index 000000000..907c83874 --- /dev/null +++ b/dbt/include/redshift/macros/materializations/table.sql @@ -0,0 +1,69 @@ +{% materialization table, adapter='redshift' %} + + {%- set existing_relation = load_cached_relation(this) -%} + {%- set target_relation = this.incorporate(type='table') %} + {%- set intermediate_relation = make_intermediate_relation(target_relation) -%} + -- the intermediate_relation should not already exist in the database; get_relation + -- will return None in that case. Otherwise, we get a relation that we can drop + -- later, before we try to use this name for the current operation + {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%} + /* + See ../view/view.sql for more information about this relation. + */ + {%- set backup_relation_type = 'table' if existing_relation is none else existing_relation.type -%} + {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%} + -- as above, the backup_relation should not already exist + {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%} + -- grab current tables grants config for comparision later on + {% set grant_config = config.get('grants') %} + + -- drop the temp relations if they exist already in the database + {{ drop_relation_if_exists(preexisting_intermediate_relation) }} + {{ drop_relation_if_exists(preexisting_backup_relation) }} + + {{ run_hooks(pre_hooks, inside_transaction=False) }} + + -- `BEGIN` happens here: + {{ run_hooks(pre_hooks, inside_transaction=True) }} + + -- build model + {% call statement('main') -%} + {{ get_create_table_as_sql(False, intermediate_relation, sql) }} + {%- endcall %} + + -- cleanup + {% if existing_relation is not none %} + /* Do the equivalent of rename_if_exists. 'existing_relation' could have been dropped + since the variable was first set. */ + {% set existing_relation = load_cached_relation(existing_relation) %} + {% if existing_relation is not none %} + {% if existing_relation.can_be_renamed %} + {{ adapter.rename_relation(existing_relation, backup_relation) }} + {% else %} + {{ drop_relation_if_exists(existing_relation) }} + {% endif %} + {% endif %} + {% endif %} + + + {{ adapter.rename_relation(intermediate_relation, target_relation) }} + + {% do create_indexes(target_relation) %} + + {{ run_hooks(post_hooks, inside_transaction=True) }} + + {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %} + {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %} + + {% do persist_docs(target_relation, model) %} + + -- `COMMIT` happens here + {{ adapter.commit() }} + + -- finally, drop the existing/backup relation after the commit + {{ drop_relation_if_exists(backup_relation) }} + + {{ run_hooks(post_hooks, inside_transaction=False) }} + + {{ return({'relations': [target_relation]}) }} +{% endmaterialization %} diff --git a/dbt/include/redshift/macros/materializations/view.sql b/dbt/include/redshift/macros/materializations/view.sql new file mode 100644 index 000000000..f353f913f --- /dev/null +++ b/dbt/include/redshift/macros/materializations/view.sql @@ -0,0 +1,77 @@ +{%- materialization view, adapter='redshift' -%} + + {%- set existing_relation = load_cached_relation(this) -%} + {%- set target_relation = this.incorporate(type='view') -%} + {%- set intermediate_relation = make_intermediate_relation(target_relation) -%} + + -- the intermediate_relation should not already exist in the database; get_relation + -- will return None in that case. Otherwise, we get a relation that we can drop + -- later, before we try to use this name for the current operation + {%- set preexisting_intermediate_relation = load_cached_relation(intermediate_relation) -%} + /* + This relation (probably) doesn't exist yet. If it does exist, it's a leftover from + a previous run, and we're going to try to drop it immediately. At the end of this + materialization, we're going to rename the "existing_relation" to this identifier, + and then we're going to drop it. In order to make sure we run the correct one of: + - drop view ... + - drop table ... + + We need to set the type of this relation to be the type of the existing_relation, if it exists, + or else "view" as a sane default if it does not. Note that if the existing_relation does not + exist, then there is nothing to move out of the way and subsequentally drop. In that case, + this relation will be effectively unused. + */ + {%- set backup_relation_type = 'view' if existing_relation is none else existing_relation.type -%} + {%- set backup_relation = make_backup_relation(target_relation, backup_relation_type) -%} + -- as above, the backup_relation should not already exist + {%- set preexisting_backup_relation = load_cached_relation(backup_relation) -%} + -- grab current tables grants config for comparision later on + {% set grant_config = config.get('grants') %} + + {{ run_hooks(pre_hooks, inside_transaction=False) }} + + -- drop the temp relations if they exist already in the database + {{ drop_relation_if_exists(preexisting_intermediate_relation) }} + {{ drop_relation_if_exists(preexisting_backup_relation) }} + + -- `BEGIN` happens here: + {{ run_hooks(pre_hooks, inside_transaction=True) }} + + -- build model + {% call statement('main') -%} + {{ get_create_view_as_sql(intermediate_relation, sql) }} + {%- endcall %} + + -- cleanup + -- move the existing view out of the way + {% if existing_relation is not none %} + /* Do the equivalent of rename_if_exists. 'existing_relation' could have been dropped + since the variable was first set. */ + {% set existing_relation = load_cached_relation(existing_relation) %} + {% if existing_relation is not none %} + {% if existing_relation.can_be_renamed %} + {{ adapter.rename_relation(existing_relation, backup_relation) }} + {% else %} + {{ drop_relation_if_exists(existing_relation) }} + {% endif %} + {% endif %} + {% endif %} + + {{ adapter.rename_relation(intermediate_relation, target_relation) }} + + {% set should_revoke = should_revoke(existing_relation, full_refresh_mode=True) %} + {% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %} + + {% do persist_docs(target_relation, model) %} + + {{ run_hooks(post_hooks, inside_transaction=True) }} + + {{ adapter.commit() }} + + {{ drop_relation_if_exists(backup_relation) }} + + {{ run_hooks(post_hooks, inside_transaction=False) }} + + {{ return({'relations': [target_relation]}) }} + +{%- endmaterialization -%} diff --git a/dbt/include/redshift/macros/relations/drop.sql b/dbt/include/redshift/macros/relations/drop.sql deleted file mode 100644 index 2709f7763..000000000 --- a/dbt/include/redshift/macros/relations/drop.sql +++ /dev/null @@ -1,7 +0,0 @@ -{% macro redshift__get_drop_relation_sql(relation) %} - {%- if relation.is_materialized_view -%} - {{ redshift__drop_materialized_view(relation) }} - {%- else -%} - drop {{ relation.type }} if exists {{ relation }} cascade - {%- endif -%} -{% endmacro %} diff --git a/dbt/include/redshift/macros/relations/materialized_view/_replace.sql b/dbt/include/redshift/macros/relations/materialized_view/_replace.sql deleted file mode 100644 index 2146e0967..000000000 --- a/dbt/include/redshift/macros/relations/materialized_view/_replace.sql +++ /dev/null @@ -1,4 +0,0 @@ -{% macro redshift__get_replace_materialized_view_as_sql(relation, sql, existing_relation, backup_relation, intermediate_relation) %} - {{ redshift__get_drop_relation_sql(existing_relation) }}; - {{ get_create_materialized_view_as_sql(relation, sql) }} -{% endmacro %} diff --git a/dbt/include/redshift/macros/relations/table/drop.sql b/dbt/include/redshift/macros/relations/table/drop.sql new file mode 100644 index 000000000..64ffc1f22 --- /dev/null +++ b/dbt/include/redshift/macros/relations/table/drop.sql @@ -0,0 +1,3 @@ +{%- macro redshift__drop_table(relation) -%} + drop table if exists {{ relation }} cascade +{%- endmacro -%} diff --git a/dbt/include/redshift/macros/relations/table/rename.sql b/dbt/include/redshift/macros/relations/table/rename.sql new file mode 100644 index 000000000..08fd5a172 --- /dev/null +++ b/dbt/include/redshift/macros/relations/table/rename.sql @@ -0,0 +1,3 @@ +{% macro redshift__get_rename_table_sql(relation, new_name) %} + alter table {{ relation }} rename to {{ new_name }} +{% endmacro %} diff --git a/dbt/include/redshift/macros/relations/view/drop.sql b/dbt/include/redshift/macros/relations/view/drop.sql new file mode 100644 index 000000000..cba066a53 --- /dev/null +++ b/dbt/include/redshift/macros/relations/view/drop.sql @@ -0,0 +1,3 @@ +{%- macro redshift__drop_view(relation) -%} + drop view if exists {{ relation }} cascade +{%- endmacro -%} diff --git a/dbt/include/redshift/macros/relations/view/rename.sql b/dbt/include/redshift/macros/relations/view/rename.sql new file mode 100644 index 000000000..0c6cdcdfa --- /dev/null +++ b/dbt/include/redshift/macros/relations/view/rename.sql @@ -0,0 +1,3 @@ +{% macro redshift__get_rename_view_sql(relation, new_name) %} + alter view {{ relation }} rename to {{ new_name }} +{% endmacro %} diff --git a/dbt/include/redshift/macros/relations/view/replace.sql b/dbt/include/redshift/macros/relations/view/replace.sql new file mode 100644 index 000000000..25a9d8b38 --- /dev/null +++ b/dbt/include/redshift/macros/relations/view/replace.sql @@ -0,0 +1,18 @@ +{% macro redshift__get_replace_view_sql(relation, sql) -%} + + {%- set binding = config.get('bind', default=True) -%} + + {% set bind_qualifier = '' if binding else 'with no schema binding' %} + {%- set sql_header = config.get('sql_header', none) -%} + + {{ sql_header if sql_header is not none }} + + create or replace view {{ relation }} + {%- set contract_config = config.get('contract') -%} + {%- if contract_config.enforced -%} + {{ get_assert_columns_equivalent(sql) }} + {%- endif %} as ( + {{ sql }} + ) {{ bind_qualifier }}; + +{%- endmacro %} diff --git a/tests/functional/adapter/materialized_view_tests/test_materialized_views.py b/tests/functional/adapter/materialized_view_tests/test_materialized_views.py index be5414122..e61737036 100644 --- a/tests/functional/adapter/materialized_view_tests/test_materialized_views.py +++ b/tests/functional/adapter/materialized_view_tests/test_materialized_views.py @@ -70,18 +70,6 @@ def test_materialized_view_create_idempotent(self, project, my_materialized_view ) assert self.query_relation_type(project, my_materialized_view) == "materialized_view" - @pytest.mark.skip( - "The current implementation does not support overwriting materialized views with tables." - ) - def test_table_replaces_materialized_view(self, project, my_materialized_view): - super().test_table_replaces_materialized_view(project, my_materialized_view) - - @pytest.mark.skip( - "The current implementation does not support overwriting materialized views with views." - ) - def test_view_replaces_materialized_view(self, project, my_materialized_view): - super().test_view_replaces_materialized_view(project, my_materialized_view) - class RedshiftMaterializedViewChanges(MaterializedViewChanges): @pytest.fixture(scope="class", autouse=True) From b84691d3fdd247e5be31d28cbd01554aabbc55fe Mon Sep 17 00:00:00 2001 From: colin-rogers-dbt <111200756+colin-rogers-dbt@users.noreply.github.com> Date: Thu, 14 Sep 2023 17:22:02 -0700 Subject: [PATCH 34/45] allow for bool/str input to backup/autorefresh when configuring materialized views (#604) * allow for bool/str input to backup/autorefresh when configuring materialized views * add assert to backup test * add changie --- .../Under the Hood-20230914-135547.yaml | 6 ++ .../relation_configs/materialized_view.py | 22 +++----- dbt/adapters/redshift/utility.py | 25 +++++++++ .../test_materialized_views.py | 36 +++++++++++- .../test_materialized_view.py | 55 +++++++++++++++++++ 5 files changed, 126 insertions(+), 18 deletions(-) create mode 100644 .changes/unreleased/Under the Hood-20230914-135547.yaml create mode 100644 dbt/adapters/redshift/utility.py create mode 100644 tests/unit/relation_configs/test_materialized_view.py diff --git a/.changes/unreleased/Under the Hood-20230914-135547.yaml b/.changes/unreleased/Under the Hood-20230914-135547.yaml new file mode 100644 index 000000000..a910ae660 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20230914-135547.yaml @@ -0,0 +1,6 @@ +kind: Under the Hood +body: allow for bool/str input to backup/autorefresh when configuring materialized + views +time: 2023-09-14T13:55:47.951848-07:00 +custom: + Author: colin-rogers-dbt diff --git a/dbt/adapters/redshift/relation_configs/materialized_view.py b/dbt/adapters/redshift/relation_configs/materialized_view.py index e69469476..1c6fb229a 100644 --- a/dbt/adapters/redshift/relation_configs/materialized_view.py +++ b/dbt/adapters/redshift/relation_configs/materialized_view.py @@ -23,6 +23,7 @@ RedshiftSortConfig, RedshiftSortConfigChange, ) +from dbt.adapters.redshift.utility import evaluate_bool @dataclass(frozen=True, eq=True, unsafe_hash=True) @@ -122,25 +123,16 @@ def parse_model_node(cls, model_node: ModelNode) -> dict: "mv_name": model_node.identifier, "schema_name": model_node.schema, "database_name": model_node.database, - "backup": model_node.config.extra.get("backup"), } + # backup/autorefresh can be bools or strings + backup_value = model_node.config.extra.get("backup") + if backup_value is not None: + config_dict["backup"] = evaluate_bool(backup_value) + autorefresh_value = model_node.config.extra.get("auto_refresh") if autorefresh_value is not None: - if isinstance(autorefresh_value, bool): - config_dict["autorefresh"] = autorefresh_value - elif isinstance(autorefresh_value, str): - lower_autorefresh = autorefresh_value.lower() - if lower_autorefresh == "true": - config_dict["autorefresh"] = True - elif lower_autorefresh == "false": - config_dict["autorefresh"] = False - else: - raise ValueError( - "Invalid autorefresh representation. Please use accepted value ex.( True, 'true', 'True')" - ) - else: - raise TypeError("Invalid autorefresh value: expecting boolean or str.") + config_dict["autorefresh"] = evaluate_bool(autorefresh_value) if query := model_node.compiled_code: config_dict.update({"query": query.strip()}) diff --git a/dbt/adapters/redshift/utility.py b/dbt/adapters/redshift/utility.py new file mode 100644 index 000000000..64f5e9cd8 --- /dev/null +++ b/dbt/adapters/redshift/utility.py @@ -0,0 +1,25 @@ +from typing import Union + + +def evaluate_bool_str(value: str) -> bool: + value = value.strip().lower() + if value == "true": + return True + elif value == "false": + return False + else: + raise ValueError(f"Invalid boolean string value: {value}") + + +def evaluate_bool(value: Union[str, bool]) -> bool: + if not value: + return False + if isinstance(value, bool): + return value + elif isinstance(value, str): + return evaluate_bool_str(value) + else: + raise TypeError( + f"Invalid type for boolean evaluation, " + f"expecting boolean or str, recieved: {type(value)}" + ) diff --git a/tests/functional/adapter/materialized_view_tests/test_materialized_views.py b/tests/functional/adapter/materialized_view_tests/test_materialized_views.py index e61737036..cf7d433c7 100644 --- a/tests/functional/adapter/materialized_view_tests/test_materialized_views.py +++ b/tests/functional/adapter/materialized_view_tests/test_materialized_views.py @@ -11,8 +11,13 @@ MaterializedViewChangesContinueMixin, MaterializedViewChangesFailMixin, ) -from dbt.tests.adapter.materialized_view.files import MY_TABLE, MY_VIEW -from dbt.tests.util import assert_message_in_logs, get_model_file, set_model_file +from dbt.tests.adapter.materialized_view.files import MY_TABLE, MY_VIEW, MY_SEED +from dbt.tests.util import ( + assert_message_in_logs, + get_model_file, + set_model_file, + run_dbt, +) from tests.functional.adapter.materialized_view_tests.utils import ( query_autorefresh, @@ -22,7 +27,6 @@ run_dbt_and_capture_with_retries_redshift_mv, ) - MY_MATERIALIZED_VIEW = """ {{ config( materialized='materialized_view', @@ -233,3 +237,29 @@ class TestRedshiftMaterializedViewChangesFail( ): # Note: using retries doesn't work when we expect `dbt_run` to fail pass + + +NO_BACKUP_MATERIALIZED_VIEW = """ +{{ config( + materialized='materialized_view', + backup=False +) }} +select * from {{ ref('my_seed') }} +""" + + +class TestRedshiftMaterializedViewWithBackupConfig: + @pytest.fixture(scope="class", autouse=True) + def models(self): + yield { + "my_materialized_view.sql": NO_BACKUP_MATERIALIZED_VIEW, + } + + @pytest.fixture(scope="class", autouse=True) + def seeds(self): + return {"my_seed.csv": MY_SEED} + + def test_running_mv_with_backup_false_succeeds(self, project): + run_dbt(["seed"]) + result = run_dbt(["run"]) + assert result[0].node.config_call_dict["backup"] is False diff --git a/tests/unit/relation_configs/test_materialized_view.py b/tests/unit/relation_configs/test_materialized_view.py new file mode 100644 index 000000000..42a3223d0 --- /dev/null +++ b/tests/unit/relation_configs/test_materialized_view.py @@ -0,0 +1,55 @@ +from unittest.mock import Mock + +import pytest + +from dbt.adapters.redshift.relation_configs import RedshiftMaterializedViewConfig + + +@pytest.mark.parametrize("bool_value", [True, False, "True", "False", "true", "false"]) +def test_redshift_materialized_view_config_handles_all_valid_bools(bool_value): + config = RedshiftMaterializedViewConfig( + database_name="somedb", + schema_name="public", + mv_name="someview", + query="select * from sometable", + ) + model_node = Mock() + model_node.config.extra.get = ( + lambda x, y=None: bool_value if x in ["auto_refresh", "backup"] else "someDistValue" + ) + config_dict = config.parse_model_node(model_node) + assert isinstance(config_dict["autorefresh"], bool) + assert isinstance(config_dict["backup"], bool) + + +@pytest.mark.parametrize("bool_value", [1]) +def test_redshift_materialized_view_config_throws_expected_exception_with_invalid_types( + bool_value, +): + config = RedshiftMaterializedViewConfig( + database_name="somedb", + schema_name="public", + mv_name="someview", + query="select * from sometable", + ) + model_node = Mock() + model_node.config.extra.get = ( + lambda x, y=None: bool_value if x in ["auto_refresh", "backup"] else "someDistValue" + ) + with pytest.raises(TypeError): + config.parse_model_node(model_node) + + +def test_redshift_materialized_view_config_throws_expected_exception_with_invalid_str(): + config = RedshiftMaterializedViewConfig( + database_name="somedb", + schema_name="public", + mv_name="someview", + query="select * from sometable", + ) + model_node = Mock() + model_node.config.extra.get = ( + lambda x, y=None: "notABool" if x in ["auto_refresh", "backup"] else "someDistValue" + ) + with pytest.raises(ValueError): + config.parse_model_node(model_node) From 2b5c446dd0672341a6e97cbe9fc9e9dd4a591648 Mon Sep 17 00:00:00 2001 From: colin-rogers-dbt <111200756+colin-rogers-dbt@users.noreply.github.com> Date: Fri, 15 Sep 2023 11:03:11 -0700 Subject: [PATCH 35/45] Update Fixes-20230912-133327.yaml (#607) --- .changes/unreleased/Fixes-20230912-133327.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.changes/unreleased/Fixes-20230912-133327.yaml b/.changes/unreleased/Fixes-20230912-133327.yaml index 14528cad6..e5aa98d47 100644 --- a/.changes/unreleased/Fixes-20230912-133327.yaml +++ b/.changes/unreleased/Fixes-20230912-133327.yaml @@ -3,3 +3,4 @@ body: use get_replace_sql in redshift__get_alter_materialized_view_as_sql, avoid time: 2023-09-12T13:33:27.451042-07:00 custom: Author: colin-rogers-dbt + Issue: "606" From 893e58eac7f8a21f581d064b3fc962e6054152f0 Mon Sep 17 00:00:00 2001 From: colin-rogers-dbt <111200756+colin-rogers-dbt@users.noreply.github.com> Date: Fri, 15 Sep 2023 11:28:33 -0700 Subject: [PATCH 36/45] Update Under the Hood-20230914-135547.yaml (#608) --- .changes/unreleased/Under the Hood-20230914-135547.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.changes/unreleased/Under the Hood-20230914-135547.yaml b/.changes/unreleased/Under the Hood-20230914-135547.yaml index a910ae660..3bb8e3c8a 100644 --- a/.changes/unreleased/Under the Hood-20230914-135547.yaml +++ b/.changes/unreleased/Under the Hood-20230914-135547.yaml @@ -4,3 +4,4 @@ body: allow for bool/str input to backup/autorefresh when configuring materializ time: 2023-09-14T13:55:47.951848-07:00 custom: Author: colin-rogers-dbt + Issue: "606" From be5b39e384eab6ca0dc866423ba639f9512a10be Mon Sep 17 00:00:00 2001 From: Github Build Bot Date: Fri, 15 Sep 2023 18:33:16 +0000 Subject: [PATCH 37/45] Bumping version to 1.7.0b2 and generate changelog --- .bumpversion.cfg | 2 +- .changes/1.7.0-b2.md | 24 ++++++++++++++++ .../Dependencies-20230816-195425.yaml | 0 .../Dependencies-20230821-192842.yaml | 0 .../Dependencies-20230901-230919.yaml | 0 .../Dependencies-20230904-193307.yaml | 0 .../Dependencies-20230912-002353.yaml | 0 .../Fixes-20230815-151655.yaml | 0 .../Fixes-20230830-164611.yaml | 0 .../Fixes-20230908-113019.yaml | 0 .../Fixes-20230912-133327.yaml | 0 .../Under the Hood-20230829-113206.yaml | 0 .../Under the Hood-20230914-135547.yaml | 0 CHANGELOG.md | 28 ++++++++++++++++++- dbt/adapters/redshift/__version__.py | 2 +- 15 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 .changes/1.7.0-b2.md rename .changes/{unreleased => 1.7.0}/Dependencies-20230816-195425.yaml (100%) rename .changes/{unreleased => 1.7.0}/Dependencies-20230821-192842.yaml (100%) rename .changes/{unreleased => 1.7.0}/Dependencies-20230901-230919.yaml (100%) rename .changes/{unreleased => 1.7.0}/Dependencies-20230904-193307.yaml (100%) rename .changes/{unreleased => 1.7.0}/Dependencies-20230912-002353.yaml (100%) rename .changes/{unreleased => 1.7.0}/Fixes-20230815-151655.yaml (100%) rename .changes/{unreleased => 1.7.0}/Fixes-20230830-164611.yaml (100%) rename .changes/{unreleased => 1.7.0}/Fixes-20230908-113019.yaml (100%) rename .changes/{unreleased => 1.7.0}/Fixes-20230912-133327.yaml (100%) rename .changes/{unreleased => 1.7.0}/Under the Hood-20230829-113206.yaml (100%) rename .changes/{unreleased => 1.7.0}/Under the Hood-20230914-135547.yaml (100%) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index b3daceb77..56940f15e 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.7.0b1 +current_version = 1.7.0b2 parse = (?P[\d]+) # major version number \.(?P[\d]+) # minor version number \.(?P[\d]+) # patch version number diff --git a/.changes/1.7.0-b2.md b/.changes/1.7.0-b2.md new file mode 100644 index 000000000..c7dd145a1 --- /dev/null +++ b/.changes/1.7.0-b2.md @@ -0,0 +1,24 @@ +## dbt-redshift 1.7.0-b2 - September 15, 2023 + +### Features + +- use get_replace_sql in redshift__get_alter_materialized_view_as_sql, avoid renaming materialized views with custom table.sql and view.sql ([#606](https://github.com/dbt-labs/dbt-redshift/issues/606)) + +### Fixes + +- allow auto_refresh to take in boolean and str values for materialized views ([#560](https://github.com/dbt-labs/dbt-redshift/issues/560)) +- Fix to support removal of hologram, remove unused IAMDuration encoder ([#591](https://github.com/dbt-labs/dbt-redshift/issues/591)) +- changes expected value types to AnyInteger to take into account changes in core ([#597](https://github.com/dbt-labs/dbt-redshift/issues/597)) + +### Under the Hood + +- Restructure macro files to be more granular; organize macros by relation and type (create, drop, etc.) ([#590](https://github.com/dbt-labs/dbt-redshift/issues/590)) +- allow for bool/str input to backup/autorefresh when configuring materialized views ([#606](https://github.com/dbt-labs/dbt-redshift/issues/606)) + +### Dependencies + +- Bump mypy from 1.5.0 to 1.5.1 ([#585](https://github.com/dbt-labs/dbt-redshift/pull/585)) +- Update tox requirement from ~=4.9 to ~=4.10 ([#588](https://github.com/dbt-labs/dbt-redshift/pull/588)) +- Update tox requirement from ~=4.10 to ~=4.11 ([#594](https://github.com/dbt-labs/dbt-redshift/pull/594)) +- Update pre-commit requirement from ~=3.3 to ~=3.4 ([#596](https://github.com/dbt-labs/dbt-redshift/pull/596)) +- Update black requirement from ~=23.7 to ~=23.9 ([#600](https://github.com/dbt-labs/dbt-redshift/pull/600)) diff --git a/.changes/unreleased/Dependencies-20230816-195425.yaml b/.changes/1.7.0/Dependencies-20230816-195425.yaml similarity index 100% rename from .changes/unreleased/Dependencies-20230816-195425.yaml rename to .changes/1.7.0/Dependencies-20230816-195425.yaml diff --git a/.changes/unreleased/Dependencies-20230821-192842.yaml b/.changes/1.7.0/Dependencies-20230821-192842.yaml similarity index 100% rename from .changes/unreleased/Dependencies-20230821-192842.yaml rename to .changes/1.7.0/Dependencies-20230821-192842.yaml diff --git a/.changes/unreleased/Dependencies-20230901-230919.yaml b/.changes/1.7.0/Dependencies-20230901-230919.yaml similarity index 100% rename from .changes/unreleased/Dependencies-20230901-230919.yaml rename to .changes/1.7.0/Dependencies-20230901-230919.yaml diff --git a/.changes/unreleased/Dependencies-20230904-193307.yaml b/.changes/1.7.0/Dependencies-20230904-193307.yaml similarity index 100% rename from .changes/unreleased/Dependencies-20230904-193307.yaml rename to .changes/1.7.0/Dependencies-20230904-193307.yaml diff --git a/.changes/unreleased/Dependencies-20230912-002353.yaml b/.changes/1.7.0/Dependencies-20230912-002353.yaml similarity index 100% rename from .changes/unreleased/Dependencies-20230912-002353.yaml rename to .changes/1.7.0/Dependencies-20230912-002353.yaml diff --git a/.changes/unreleased/Fixes-20230815-151655.yaml b/.changes/1.7.0/Fixes-20230815-151655.yaml similarity index 100% rename from .changes/unreleased/Fixes-20230815-151655.yaml rename to .changes/1.7.0/Fixes-20230815-151655.yaml diff --git a/.changes/unreleased/Fixes-20230830-164611.yaml b/.changes/1.7.0/Fixes-20230830-164611.yaml similarity index 100% rename from .changes/unreleased/Fixes-20230830-164611.yaml rename to .changes/1.7.0/Fixes-20230830-164611.yaml diff --git a/.changes/unreleased/Fixes-20230908-113019.yaml b/.changes/1.7.0/Fixes-20230908-113019.yaml similarity index 100% rename from .changes/unreleased/Fixes-20230908-113019.yaml rename to .changes/1.7.0/Fixes-20230908-113019.yaml diff --git a/.changes/unreleased/Fixes-20230912-133327.yaml b/.changes/1.7.0/Fixes-20230912-133327.yaml similarity index 100% rename from .changes/unreleased/Fixes-20230912-133327.yaml rename to .changes/1.7.0/Fixes-20230912-133327.yaml diff --git a/.changes/unreleased/Under the Hood-20230829-113206.yaml b/.changes/1.7.0/Under the Hood-20230829-113206.yaml similarity index 100% rename from .changes/unreleased/Under the Hood-20230829-113206.yaml rename to .changes/1.7.0/Under the Hood-20230829-113206.yaml diff --git a/.changes/unreleased/Under the Hood-20230914-135547.yaml b/.changes/1.7.0/Under the Hood-20230914-135547.yaml similarity index 100% rename from .changes/unreleased/Under the Hood-20230914-135547.yaml rename to .changes/1.7.0/Under the Hood-20230914-135547.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 44a71a8bd..2bb546acc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,33 @@ - "Breaking changes" listed under a version may require action from end users or external maintainers when upgrading to that version. - Do not edit this file directly. This file is auto-generated using [changie](https://github.com/miniscruff/changie). For details on how to document a change, see [the contributing guide](https://github.com/dbt-labs/dbt-redshift/blob/main/CONTRIBUTING.md#adding-changelog-entry) +## dbt-redshift 1.7.0-b2 - September 15, 2023 + +### Features + +- use get_replace_sql in redshift__get_alter_materialized_view_as_sql, avoid renaming materialized views with custom table.sql and view.sql ([#606](https://github.com/dbt-labs/dbt-redshift/issues/606)) + +### Fixes + +- allow auto_refresh to take in boolean and str values for materialized views ([#560](https://github.com/dbt-labs/dbt-redshift/issues/560)) +- Fix to support removal of hologram, remove unused IAMDuration encoder ([#591](https://github.com/dbt-labs/dbt-redshift/issues/591)) +- changes expected value types to AnyInteger to take into account changes in core ([#597](https://github.com/dbt-labs/dbt-redshift/issues/597)) + +### Under the Hood + +- Restructure macro files to be more granular; organize macros by relation and type (create, drop, etc.) ([#590](https://github.com/dbt-labs/dbt-redshift/issues/590)) +- allow for bool/str input to backup/autorefresh when configuring materialized views ([#606](https://github.com/dbt-labs/dbt-redshift/issues/606)) + +### Dependencies + +- Bump mypy from 1.5.0 to 1.5.1 ([#585](https://github.com/dbt-labs/dbt-redshift/pull/585)) +- Update tox requirement from ~=4.9 to ~=4.10 ([#588](https://github.com/dbt-labs/dbt-redshift/pull/588)) +- Update tox requirement from ~=4.10 to ~=4.11 ([#594](https://github.com/dbt-labs/dbt-redshift/pull/594)) +- Update pre-commit requirement from ~=3.3 to ~=3.4 ([#596](https://github.com/dbt-labs/dbt-redshift/pull/596)) +- Update black requirement from ~=23.7 to ~=23.9 ([#600](https://github.com/dbt-labs/dbt-redshift/pull/600)) + + + ## dbt-redshift 1.7.0-b1 - August 17, 2023 ### Features @@ -38,7 +65,6 @@ ### Contributors - [@WillAyd](https://github.com/WillAyd) ([#255](https://github.com/dbt-labs/dbt-redshift/issues/255)) - ## Previous Releases For information on prior major and minor releases, see their changelogs: - [1.6](https://github.com/dbt-labs/dbt-redshift/blob/1.6.latest/CHANGELOG.md) diff --git a/dbt/adapters/redshift/__version__.py b/dbt/adapters/redshift/__version__.py index 48607b01f..3f5d3c0b7 100644 --- a/dbt/adapters/redshift/__version__.py +++ b/dbt/adapters/redshift/__version__.py @@ -1 +1 @@ -version = "1.7.0b1" +version = "1.7.0b2" From 9385b49c15373b4843943780c1f20b7d587ca360 Mon Sep 17 00:00:00 2001 From: Wen Date: Mon, 25 Sep 2023 14:10:09 -0400 Subject: [PATCH 38/45] Avoid nested loop in query planner execution (#612) * Adjust not equals application order - Move relation name not equals from outer SELECT `where` clause to dependency CTE - Seems to more reliably push query planner to avoid a nested loop - Should preserve original intent, i.e. to exclude self-references from final result - Execution plan suggests this reduces the row estimate for the outer SELECT - Real-world testing on internal company cluster under conditions where nested loop is used for original, shows that the new approach continues to perform and behave as expected (no nested loop) * Add changie entry --- .changes/unreleased/Fixes-20230923-091155.yaml | 6 ++++++ dbt/include/redshift/macros/relations.sql | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Fixes-20230923-091155.yaml diff --git a/.changes/unreleased/Fixes-20230923-091155.yaml b/.changes/unreleased/Fixes-20230923-091155.yaml new file mode 100644 index 000000000..055d4dc7e --- /dev/null +++ b/.changes/unreleased/Fixes-20230923-091155.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: avoid nested loop in query planner execution of redshift__get_relations +time: 2023-09-23T09:11:55.2152725-04:00 +custom: + Author: slin30 + Issue: "609" diff --git a/dbt/include/redshift/macros/relations.sql b/dbt/include/redshift/macros/relations.sql index 28c6bc377..6d83c36b9 100644 --- a/dbt/include/redshift/macros/relations.sql +++ b/dbt/include/redshift/macros/relations.sql @@ -24,6 +24,7 @@ with from pg_depend left join pg_rewrite on pg_depend.objid = pg_rewrite.oid + where coalesce(pg_rewrite.ev_class, pg_depend.objid) != pg_depend.refobjid ) select distinct @@ -36,7 +37,6 @@ join relation ref on dependency.ref_relation_id = ref.relation_id join relation dep on dependency.dep_relation_id = dep.relation_id -where ref.relation_name != dep.relation_name {%- endcall -%} From 7f7330969e2cd99d4128a55091f4b6bce6cffeaf Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Tue, 26 Sep 2023 11:49:22 -0500 Subject: [PATCH 39/45] automate repo cleanup (#618) --- .github/workflows/repository-cleanup.yml | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/repository-cleanup.yml diff --git a/.github/workflows/repository-cleanup.yml b/.github/workflows/repository-cleanup.yml new file mode 100644 index 000000000..c1d780281 --- /dev/null +++ b/.github/workflows/repository-cleanup.yml @@ -0,0 +1,30 @@ +# **what?** +# Cleanup branches left over from automation and testing. Also cleanup +# draft releases from release testing. + +# **why?** +# The automations are leaving behind branches and releases that clutter +# the repository. Sometimes we need them to debug processes so we don't +# want them immediately deleted. Running on Saturday to avoid running +# at the same time as an actual release to prevent breaking a release +# mid-release. + +# **when?** +# Mainly on a schedule of 12:00 Saturday. +# Manual trigger can also run on demand + +name: Repository Cleanup + +on: + schedule: + - cron: '0 12 * * SAT' # At 12:00 on Saturday - details in `why` above + + workflow_dispatch: # for manual triggering + +permissions: + contents: write + +jobs: + cleanup-repo: + uses: dbt-labs/actions/.github/workflows/repository-cleanup.yml@main + secrets: inherit From 16d86aa9c570479f4a5a59ee10a6d64a38fd530d Mon Sep 17 00:00:00 2001 From: Quigley Malcolm Date: Tue, 26 Sep 2023 16:44:09 -0700 Subject: [PATCH 40/45] Add tests for `date_spine` macro, and sub macros (#617) Co-authored-by: colin-rogers-dbt <111200756+colin-rogers-dbt@users.noreply.github.com> --- tests/functional/adapter/utils/test_utils.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/functional/adapter/utils/test_utils.py b/tests/functional/adapter/utils/test_utils.py index 266103fbc..61a706f4d 100644 --- a/tests/functional/adapter/utils/test_utils.py +++ b/tests/functional/adapter/utils/test_utils.py @@ -8,9 +8,13 @@ from dbt.tests.adapter.utils.test_current_timestamp import BaseCurrentTimestampNaive from dbt.tests.adapter.utils.test_dateadd import BaseDateAdd from dbt.tests.adapter.utils.test_datediff import BaseDateDiff +from dbt.tests.adapter.utils.test_date_spine import BaseDateSpine from dbt.tests.adapter.utils.test_date_trunc import BaseDateTrunc from dbt.tests.adapter.utils.test_escape_single_quotes import BaseEscapeSingleQuotesQuote from dbt.tests.adapter.utils.test_except import BaseExcept +from dbt.tests.adapter.utils.test_generate_series import BaseGenerateSeries +from dbt.tests.adapter.utils.test_get_intervals_between import BaseGetIntervalsBetween +from dbt.tests.adapter.utils.test_get_powers_of_two import BaseGetPowersOfTwo from dbt.tests.adapter.utils.test_hash import BaseHash from dbt.tests.adapter.utils.test_intersect import BaseIntersect from dbt.tests.adapter.utils.test_last_day import BaseLastDay @@ -65,6 +69,10 @@ class TestDateDiff(BaseDateDiff): pass +class TestDateSpine(BaseDateSpine): + pass + + class TestDateTrunc(BaseDateTrunc): pass @@ -77,6 +85,18 @@ class TestExcept(BaseExcept): pass +class TestGenerateSeries(BaseGenerateSeries): + pass + + +class TestGetIntervalsBeteween(BaseGetIntervalsBetween): + pass + + +class TestGetPowersOfTwo(BaseGetPowersOfTwo): + pass + + class TestHash(BaseHash): pass From ca3c7b4f9e6b2df0ae6d2334edd58b6bb08a578e Mon Sep 17 00:00:00 2001 From: Michelle Ark Date: Thu, 28 Sep 2023 19:39:11 +0100 Subject: [PATCH 41/45] add dbt show tests (#611) * add dbt show tests * changelog entry * repoint to core main * change to a WITH statement in model definition for dbt_show test model * reuse core fixture for dbt show sql header test * undo dev-requirements changes --------- Co-authored-by: colin-rogers-dbt <111200756+colin-rogers-dbt@users.noreply.github.com> Co-authored-by: Matthew McKnight <91097623+McKnight-42@users.noreply.github.com> Co-authored-by: Matthew McKnight --- .changes/unreleased/Under the Hood-20230925-150132.yaml | 6 ++++++ tests/functional/adapter/dbt_show/test_dbt_show.py | 9 +++++++++ 2 files changed, 15 insertions(+) create mode 100644 .changes/unreleased/Under the Hood-20230925-150132.yaml create mode 100644 tests/functional/adapter/dbt_show/test_dbt_show.py diff --git a/.changes/unreleased/Under the Hood-20230925-150132.yaml b/.changes/unreleased/Under the Hood-20230925-150132.yaml new file mode 100644 index 000000000..c61a28d56 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20230925-150132.yaml @@ -0,0 +1,6 @@ +kind: Under the Hood +body: Add tests for inlined limit + sql_header in dbt show query +time: 2023-09-25T15:01:32.025325+01:00 +custom: + Author: michelleark + Issue: "616" diff --git a/tests/functional/adapter/dbt_show/test_dbt_show.py b/tests/functional/adapter/dbt_show/test_dbt_show.py new file mode 100644 index 000000000..808a7733c --- /dev/null +++ b/tests/functional/adapter/dbt_show/test_dbt_show.py @@ -0,0 +1,9 @@ +from dbt.tests.adapter.dbt_show.test_dbt_show import BaseShowSqlHeader, BaseShowLimit + + +class TestRedshiftShowLimit(BaseShowLimit): + pass + + +class TestRedshiftShowSqlHeader(BaseShowSqlHeader): + pass From 85d37209921042e6af0e18bc11dd6017ba331622 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 11:38:39 -0500 Subject: [PATCH 42/45] Update ddtrace requirement from ~=1.18 to ~=1.19 (#610) * Update ddtrace requirement from ~=1.18 to ~=1.19 Updates the requirements on [ddtrace](https://github.com/DataDog/dd-trace-py) to permit the latest version. - [Release notes](https://github.com/DataDog/dd-trace-py/releases) - [Changelog](https://github.com/DataDog/dd-trace-py/blob/2.x/CHANGELOG.md) - [Commits](https://github.com/DataDog/dd-trace-py/compare/v1.18.0...v1.19.0) --- updated-dependencies: - dependency-name: ddtrace dependency-type: direct:development ... Signed-off-by: dependabot[bot] * Add automated changelog yaml from template for bot PR --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Github Build Bot Co-authored-by: Matthew McKnight <91097623+McKnight-42@users.noreply.github.com> --- .changes/unreleased/Dependencies-20230918-190833.yaml | 6 ++++++ dev-requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Dependencies-20230918-190833.yaml diff --git a/.changes/unreleased/Dependencies-20230918-190833.yaml b/.changes/unreleased/Dependencies-20230918-190833.yaml new file mode 100644 index 000000000..f784102ca --- /dev/null +++ b/.changes/unreleased/Dependencies-20230918-190833.yaml @@ -0,0 +1,6 @@ +kind: "Dependencies" +body: "Update ddtrace requirement from ~=1.18 to ~=1.19" +time: 2023-09-18T19:08:33.00000Z +custom: + Author: dependabot[bot] + PR: 610 diff --git a/dev-requirements.txt b/dev-requirements.txt index 96f252ebe..4b3b09cda 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -9,7 +9,7 @@ git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-postgres&subdirectory=plugi black~=23.9 bumpversion~=0.6.0 click~=8.1 -ddtrace~=1.18 +ddtrace~=1.19 flake8~=6.1 flaky~=3.7 freezegun~=1.2 From 1116e4706914653d01e17c64a9e477f6cd0a5299 Mon Sep 17 00:00:00 2001 From: Mike Alfare <13974384+mikealfare@users.noreply.github.com> Date: Tue, 10 Oct 2023 19:05:42 -0400 Subject: [PATCH 43/45] ADAP-891: Support test results as views (#614) * implement store-failures-as tests --- .../unreleased/Features-20230921-153707.yaml | 6 +++++ .../adapter/test_store_test_failures.py | 27 ++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Features-20230921-153707.yaml diff --git a/.changes/unreleased/Features-20230921-153707.yaml b/.changes/unreleased/Features-20230921-153707.yaml new file mode 100644 index 000000000..cf2c60ad5 --- /dev/null +++ b/.changes/unreleased/Features-20230921-153707.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Support storing test failures as views +time: 2023-09-21T15:37:07.970722-04:00 +custom: + Author: mikealfare + Issue: "6914" diff --git a/tests/functional/adapter/test_store_test_failures.py b/tests/functional/adapter/test_store_test_failures.py index 5d6b70fbb..7f591654e 100644 --- a/tests/functional/adapter/test_store_test_failures.py +++ b/tests/functional/adapter/test_store_test_failures.py @@ -1,7 +1,32 @@ +from dbt.tests.adapter.store_test_failures_tests import basic from dbt.tests.adapter.store_test_failures_tests.test_store_test_failures import ( TestStoreTestFailures, ) -class RedshiftTestStoreTestFailures(TestStoreTestFailures): +class TestRedshiftTestStoreTestFailures(TestStoreTestFailures): + pass + + +class TestStoreTestFailuresAsInteractions(basic.StoreTestFailuresAsInteractions): + pass + + +class TestStoreTestFailuresAsProjectLevelOff(basic.StoreTestFailuresAsProjectLevelOff): + pass + + +class TestStoreTestFailuresAsProjectLevelView(basic.StoreTestFailuresAsProjectLevelView): + pass + + +class TestStoreTestFailuresAsGeneric(basic.StoreTestFailuresAsGeneric): + pass + + +class TestStoreTestFailuresAsProjectLevelEphemeral(basic.StoreTestFailuresAsProjectLevelEphemeral): + pass + + +class TestStoreTestFailuresAsExceptions(basic.StoreTestFailuresAsExceptions): pass From 5d4f3f5c94235d2a5cff50e6993f3c6e89d0eb16 Mon Sep 17 00:00:00 2001 From: Doug Beatty <44704949+dbeatty10@users.noreply.github.com> Date: Tue, 10 Oct 2023 19:15:20 -0600 Subject: [PATCH 44/45] Use the PID to terminate the session (#568) * The first element of the result is the PID * Debug-level logging of high-level message + SQL * Using redshift_connector `cursor.fetchone()` returns `(,)` * Use cursor to call `select pg_terminate_backend({pid})` directly rather than using the `SQLConnectionManager` --------- Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com> --- .changes/unreleased/Fixes-20230807-174409.yaml | 6 ++++++ dbt/adapters/redshift/connections.py | 10 ++++++---- tests/unit/test_redshift_adapter.py | 3 +-- 3 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 .changes/unreleased/Fixes-20230807-174409.yaml diff --git a/.changes/unreleased/Fixes-20230807-174409.yaml b/.changes/unreleased/Fixes-20230807-174409.yaml new file mode 100644 index 000000000..ad4f11b42 --- /dev/null +++ b/.changes/unreleased/Fixes-20230807-174409.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Use the PID to terminate the session +time: 2023-08-07T17:44:09.15097-06:00 +custom: + Author: dbeatty10 + Issue: "553" diff --git a/dbt/adapters/redshift/connections.py b/dbt/adapters/redshift/connections.py index 83d05b587..0c9d1b7ed 100644 --- a/dbt/adapters/redshift/connections.py +++ b/dbt/adapters/redshift/connections.py @@ -240,8 +240,9 @@ class RedshiftConnectionManager(SQLConnectionManager): def _get_backend_pid(self): sql = "select pg_backend_pid()" _, cursor = self.add_query(sql) + res = cursor.fetchone() - return res + return res[0] def cancel(self, connection: Connection): try: @@ -253,9 +254,10 @@ def cancel(self, connection: Connection): raise sql = f"select pg_terminate_backend({pid})" - _, cursor = self.add_query(sql) - res = cursor.fetchone() - logger.debug(f"Cancel query '{connection.name}': {res}") + cursor = connection.handle.cursor() + logger.debug(f"Cancel query on: '{connection.name}' with PID: {pid}") + logger.debug(sql) + cursor.execute(sql) @classmethod def get_response(cls, cursor: redshift_connector.Cursor) -> AdapterResponse: diff --git a/tests/unit/test_redshift_adapter.py b/tests/unit/test_redshift_adapter.py index c31366a1e..1edea565e 100644 --- a/tests/unit/test_redshift_adapter.py +++ b/tests/unit/test_redshift_adapter.py @@ -471,14 +471,13 @@ def test_cancel_open_connections_single(self): with mock.patch.object(self.adapter.connections, "add_query") as add_query: query_result = mock.MagicMock() cursor = mock.Mock() - cursor.fetchone.return_value = 42 + cursor.fetchone.return_value = (42,) add_query.side_effect = [(None, cursor), (None, query_result)] self.assertEqual(len(list(self.adapter.cancel_open_connections())), 1) add_query.assert_has_calls( [ call("select pg_backend_pid()"), - call("select pg_terminate_backend(42)"), ] ) From b2b604594577a26fcd583db364ff02162fbecad7 Mon Sep 17 00:00:00 2001 From: FishtownBuildBot <77737458+FishtownBuildBot@users.noreply.github.com> Date: Thu, 12 Oct 2023 13:19:56 -0400 Subject: [PATCH 45/45] Cleanup main after cutting new 1.7.latest branch (#633) * Clean up changelog on main * Bumping version to 1.8.0a1 * Code quality cleanup --- .bumpversion.cfg | 2 +- .changes/1.7.0-b1.md | 32 ---------- .changes/1.7.0-b2.md | 24 -------- .../1.7.0/Dependencies-20230711-192047.yaml | 6 -- .../1.7.0/Dependencies-20230717-195349.yaml | 6 -- .../1.7.0/Dependencies-20230720-191748.yaml | 6 -- .../1.7.0/Dependencies-20230724-190537.yaml | 6 -- .../1.7.0/Dependencies-20230731-194135.yaml | 6 -- .../1.7.0/Dependencies-20230803-131633.yaml | 6 -- .../1.7.0/Dependencies-20230808-194553.yaml | 6 -- .../1.7.0/Dependencies-20230810-193150.yaml | 6 -- .../1.7.0/Dependencies-20230810-193846.yaml | 6 -- .../1.7.0/Dependencies-20230811-195421.yaml | 6 -- .../1.7.0/Dependencies-20230814-190800.yaml | 6 -- .../1.7.0/Dependencies-20230816-195425.yaml | 6 -- .../1.7.0/Dependencies-20230816-195442.yaml | 6 -- .../1.7.0/Dependencies-20230821-192842.yaml | 6 -- .../1.7.0/Dependencies-20230901-230919.yaml | 6 -- .../1.7.0/Dependencies-20230904-193307.yaml | 6 -- .../1.7.0/Dependencies-20230912-002353.yaml | 6 -- .changes/1.7.0/Features-20230803-111146.yaml | 6 -- .changes/1.7.0/Fixes-20230802-103350.yaml | 6 -- .changes/1.7.0/Fixes-20230815-151655.yaml | 6 -- .changes/1.7.0/Fixes-20230830-164611.yaml | 6 -- .changes/1.7.0/Fixes-20230908-113019.yaml | 6 -- .changes/1.7.0/Fixes-20230912-133327.yaml | 6 -- .../1.7.0/Under the Hood-20230724-164439.yaml | 6 -- .../1.7.0/Under the Hood-20230808-141645.yaml | 7 --- .../1.7.0/Under the Hood-20230829-113206.yaml | 7 --- .../1.7.0/Under the Hood-20230914-135547.yaml | 7 --- .../Dependencies-20230918-190833.yaml | 6 -- .../unreleased/Features-20230921-153707.yaml | 6 -- .../unreleased/Fixes-20230807-174409.yaml | 6 -- .../unreleased/Fixes-20230923-091155.yaml | 6 -- .../Under the Hood-20230925-150132.yaml | 6 -- CHANGELOG.md | 60 ------------------- dbt/adapters/redshift/__version__.py | 2 +- 37 files changed, 2 insertions(+), 313 deletions(-) delete mode 100644 .changes/1.7.0-b1.md delete mode 100644 .changes/1.7.0-b2.md delete mode 100644 .changes/1.7.0/Dependencies-20230711-192047.yaml delete mode 100644 .changes/1.7.0/Dependencies-20230717-195349.yaml delete mode 100644 .changes/1.7.0/Dependencies-20230720-191748.yaml delete mode 100644 .changes/1.7.0/Dependencies-20230724-190537.yaml delete mode 100644 .changes/1.7.0/Dependencies-20230731-194135.yaml delete mode 100644 .changes/1.7.0/Dependencies-20230803-131633.yaml delete mode 100644 .changes/1.7.0/Dependencies-20230808-194553.yaml delete mode 100644 .changes/1.7.0/Dependencies-20230810-193150.yaml delete mode 100644 .changes/1.7.0/Dependencies-20230810-193846.yaml delete mode 100644 .changes/1.7.0/Dependencies-20230811-195421.yaml delete mode 100644 .changes/1.7.0/Dependencies-20230814-190800.yaml delete mode 100644 .changes/1.7.0/Dependencies-20230816-195425.yaml delete mode 100644 .changes/1.7.0/Dependencies-20230816-195442.yaml delete mode 100644 .changes/1.7.0/Dependencies-20230821-192842.yaml delete mode 100644 .changes/1.7.0/Dependencies-20230901-230919.yaml delete mode 100644 .changes/1.7.0/Dependencies-20230904-193307.yaml delete mode 100644 .changes/1.7.0/Dependencies-20230912-002353.yaml delete mode 100644 .changes/1.7.0/Features-20230803-111146.yaml delete mode 100644 .changes/1.7.0/Fixes-20230802-103350.yaml delete mode 100644 .changes/1.7.0/Fixes-20230815-151655.yaml delete mode 100644 .changes/1.7.0/Fixes-20230830-164611.yaml delete mode 100644 .changes/1.7.0/Fixes-20230908-113019.yaml delete mode 100644 .changes/1.7.0/Fixes-20230912-133327.yaml delete mode 100644 .changes/1.7.0/Under the Hood-20230724-164439.yaml delete mode 100644 .changes/1.7.0/Under the Hood-20230808-141645.yaml delete mode 100644 .changes/1.7.0/Under the Hood-20230829-113206.yaml delete mode 100644 .changes/1.7.0/Under the Hood-20230914-135547.yaml delete mode 100644 .changes/unreleased/Dependencies-20230918-190833.yaml delete mode 100644 .changes/unreleased/Features-20230921-153707.yaml delete mode 100644 .changes/unreleased/Fixes-20230807-174409.yaml delete mode 100644 .changes/unreleased/Fixes-20230923-091155.yaml delete mode 100644 .changes/unreleased/Under the Hood-20230925-150132.yaml diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 56940f15e..f54032556 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.7.0b2 +current_version = 1.8.0a1 parse = (?P[\d]+) # major version number \.(?P[\d]+) # minor version number \.(?P[\d]+) # patch version number diff --git a/.changes/1.7.0-b1.md b/.changes/1.7.0-b1.md deleted file mode 100644 index be669a9db..000000000 --- a/.changes/1.7.0-b1.md +++ /dev/null @@ -1,32 +0,0 @@ -## dbt-redshift 1.7.0-b1 - August 17, 2023 - -### Features - -- Support DISTSTYLE for seeds ([#255](https://github.com/dbt-labs/dbt-redshift/issues/255)) - -### Fixes - -- Insert values of `merge_exclude_columns` when not matched ([#563](https://github.com/dbt-labs/dbt-redshift/issues/563)) - -### Under the Hood - -- Update stale workflow to use the centralized version ([#552](https://github.com/dbt-labs/dbt-redshift/issues/552)) -- Update flaky MV tests to use retry logic to avoid "cannot open relation with OID" error ([#569](https://github.com/dbt-labs/dbt-redshift/issues/569)) - -### Dependencies - -- Update black requirement from ~=23.3 to ~=23.7 ([#529](https://github.com/dbt-labs/dbt-redshift/pull/529)) -- Update pip-tools requirement from ~=6.14 to ~=7.0 ([#541](https://github.com/dbt-labs/dbt-redshift/pull/541)) -- Update ddtrace requirement from ~=1.16 to ~=1.17 ([#550](https://github.com/dbt-labs/dbt-redshift/pull/550)) -- Update wheel requirement from ~=0.40 to ~=0.41 ([#551](https://github.com/dbt-labs/dbt-redshift/pull/551)) -- Update flake8 requirement from ~=6.0 to ~=6.1 ([#562](https://github.com/dbt-labs/dbt-redshift/pull/562)) -- Update pip-tools requirement from ~=7.0 to ~=7.2 ([#567](https://github.com/dbt-labs/dbt-redshift/pull/567)) -- Update tox requirement from ~=4.6 to ~=4.7 ([#570](https://github.com/dbt-labs/dbt-redshift/pull/570)) -- Bump mypy from 1.4.1 to 1.5.0 ([#573](https://github.com/dbt-labs/dbt-redshift/pull/573)) -- Update pip-tools requirement from ~=7.2 to ~=7.3 ([#572](https://github.com/dbt-labs/dbt-redshift/pull/572)) -- Update ddtrace requirement from ~=1.17 to ~=1.18 ([#575](https://github.com/dbt-labs/dbt-redshift/pull/575)) -- Update tox requirement from ~=4.7 to ~=4.8 ([#581](https://github.com/dbt-labs/dbt-redshift/pull/581)) -- Update tox requirement from ~=4.8 to ~=4.9 ([#586](https://github.com/dbt-labs/dbt-redshift/pull/586)) - -### Contributors -- [@WillAyd](https://github.com/WillAyd) ([#255](https://github.com/dbt-labs/dbt-redshift/issues/255)) diff --git a/.changes/1.7.0-b2.md b/.changes/1.7.0-b2.md deleted file mode 100644 index c7dd145a1..000000000 --- a/.changes/1.7.0-b2.md +++ /dev/null @@ -1,24 +0,0 @@ -## dbt-redshift 1.7.0-b2 - September 15, 2023 - -### Features - -- use get_replace_sql in redshift__get_alter_materialized_view_as_sql, avoid renaming materialized views with custom table.sql and view.sql ([#606](https://github.com/dbt-labs/dbt-redshift/issues/606)) - -### Fixes - -- allow auto_refresh to take in boolean and str values for materialized views ([#560](https://github.com/dbt-labs/dbt-redshift/issues/560)) -- Fix to support removal of hologram, remove unused IAMDuration encoder ([#591](https://github.com/dbt-labs/dbt-redshift/issues/591)) -- changes expected value types to AnyInteger to take into account changes in core ([#597](https://github.com/dbt-labs/dbt-redshift/issues/597)) - -### Under the Hood - -- Restructure macro files to be more granular; organize macros by relation and type (create, drop, etc.) ([#590](https://github.com/dbt-labs/dbt-redshift/issues/590)) -- allow for bool/str input to backup/autorefresh when configuring materialized views ([#606](https://github.com/dbt-labs/dbt-redshift/issues/606)) - -### Dependencies - -- Bump mypy from 1.5.0 to 1.5.1 ([#585](https://github.com/dbt-labs/dbt-redshift/pull/585)) -- Update tox requirement from ~=4.9 to ~=4.10 ([#588](https://github.com/dbt-labs/dbt-redshift/pull/588)) -- Update tox requirement from ~=4.10 to ~=4.11 ([#594](https://github.com/dbt-labs/dbt-redshift/pull/594)) -- Update pre-commit requirement from ~=3.3 to ~=3.4 ([#596](https://github.com/dbt-labs/dbt-redshift/pull/596)) -- Update black requirement from ~=23.7 to ~=23.9 ([#600](https://github.com/dbt-labs/dbt-redshift/pull/600)) diff --git a/.changes/1.7.0/Dependencies-20230711-192047.yaml b/.changes/1.7.0/Dependencies-20230711-192047.yaml deleted file mode 100644 index fa7c1df80..000000000 --- a/.changes/1.7.0/Dependencies-20230711-192047.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update black requirement from ~=23.3 to ~=23.7" -time: 2023-07-11T19:20:47.00000Z -custom: - Author: dependabot[bot] - PR: 529 diff --git a/.changes/1.7.0/Dependencies-20230717-195349.yaml b/.changes/1.7.0/Dependencies-20230717-195349.yaml deleted file mode 100644 index 542970ab8..000000000 --- a/.changes/1.7.0/Dependencies-20230717-195349.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update pip-tools requirement from ~=6.14 to ~=7.0" -time: 2023-07-17T19:53:49.00000Z -custom: - Author: dependabot[bot] - PR: 541 diff --git a/.changes/1.7.0/Dependencies-20230720-191748.yaml b/.changes/1.7.0/Dependencies-20230720-191748.yaml deleted file mode 100644 index eb79676d4..000000000 --- a/.changes/1.7.0/Dependencies-20230720-191748.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update ddtrace requirement from ~=1.16 to ~=1.17" -time: 2023-07-20T19:17:48.00000Z -custom: - Author: dependabot[bot] - PR: 550 diff --git a/.changes/1.7.0/Dependencies-20230724-190537.yaml b/.changes/1.7.0/Dependencies-20230724-190537.yaml deleted file mode 100644 index c61cb9df3..000000000 --- a/.changes/1.7.0/Dependencies-20230724-190537.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update wheel requirement from ~=0.40 to ~=0.41" -time: 2023-07-24T19:05:37.00000Z -custom: - Author: dependabot[bot] - PR: 551 diff --git a/.changes/1.7.0/Dependencies-20230731-194135.yaml b/.changes/1.7.0/Dependencies-20230731-194135.yaml deleted file mode 100644 index c9990b89a..000000000 --- a/.changes/1.7.0/Dependencies-20230731-194135.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update flake8 requirement from ~=6.0 to ~=6.1" -time: 2023-07-31T19:41:35.00000Z -custom: - Author: dependabot[bot] - PR: 562 diff --git a/.changes/1.7.0/Dependencies-20230803-131633.yaml b/.changes/1.7.0/Dependencies-20230803-131633.yaml deleted file mode 100644 index d6755cd13..000000000 --- a/.changes/1.7.0/Dependencies-20230803-131633.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update pip-tools requirement from ~=7.0 to ~=7.2" -time: 2023-08-03T13:16:33.00000Z -custom: - Author: dependabot[bot] - PR: 567 diff --git a/.changes/1.7.0/Dependencies-20230808-194553.yaml b/.changes/1.7.0/Dependencies-20230808-194553.yaml deleted file mode 100644 index 95c0b6dd1..000000000 --- a/.changes/1.7.0/Dependencies-20230808-194553.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update tox requirement from ~=4.6 to ~=4.7" -time: 2023-08-08T19:45:53.00000Z -custom: - Author: dependabot[bot] - PR: 570 diff --git a/.changes/1.7.0/Dependencies-20230810-193150.yaml b/.changes/1.7.0/Dependencies-20230810-193150.yaml deleted file mode 100644 index e2b0c1250..000000000 --- a/.changes/1.7.0/Dependencies-20230810-193150.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Bump mypy from 1.4.1 to 1.5.0" -time: 2023-08-10T19:31:50.00000Z -custom: - Author: dependabot[bot] - PR: 573 diff --git a/.changes/1.7.0/Dependencies-20230810-193846.yaml b/.changes/1.7.0/Dependencies-20230810-193846.yaml deleted file mode 100644 index 4a55d3114..000000000 --- a/.changes/1.7.0/Dependencies-20230810-193846.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update pip-tools requirement from ~=7.2 to ~=7.3" -time: 2023-08-10T19:38:46.00000Z -custom: - Author: dependabot[bot] - PR: 572 diff --git a/.changes/1.7.0/Dependencies-20230811-195421.yaml b/.changes/1.7.0/Dependencies-20230811-195421.yaml deleted file mode 100644 index 5cc2f61bf..000000000 --- a/.changes/1.7.0/Dependencies-20230811-195421.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update ddtrace requirement from ~=1.17 to ~=1.18" -time: 2023-08-11T19:54:21.00000Z -custom: - Author: dependabot[bot] - PR: 575 diff --git a/.changes/1.7.0/Dependencies-20230814-190800.yaml b/.changes/1.7.0/Dependencies-20230814-190800.yaml deleted file mode 100644 index 0e39e5ba7..000000000 --- a/.changes/1.7.0/Dependencies-20230814-190800.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update tox requirement from ~=4.7 to ~=4.8" -time: 2023-08-14T19:08:00.00000Z -custom: - Author: dependabot[bot] - PR: 581 diff --git a/.changes/1.7.0/Dependencies-20230816-195425.yaml b/.changes/1.7.0/Dependencies-20230816-195425.yaml deleted file mode 100644 index 989b20103..000000000 --- a/.changes/1.7.0/Dependencies-20230816-195425.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Bump mypy from 1.5.0 to 1.5.1" -time: 2023-08-16T19:54:25.00000Z -custom: - Author: dependabot[bot] - PR: 585 diff --git a/.changes/1.7.0/Dependencies-20230816-195442.yaml b/.changes/1.7.0/Dependencies-20230816-195442.yaml deleted file mode 100644 index 850982f99..000000000 --- a/.changes/1.7.0/Dependencies-20230816-195442.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update tox requirement from ~=4.8 to ~=4.9" -time: 2023-08-16T19:54:42.00000Z -custom: - Author: dependabot[bot] - PR: 586 diff --git a/.changes/1.7.0/Dependencies-20230821-192842.yaml b/.changes/1.7.0/Dependencies-20230821-192842.yaml deleted file mode 100644 index c6e5a7a6b..000000000 --- a/.changes/1.7.0/Dependencies-20230821-192842.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update tox requirement from ~=4.9 to ~=4.10" -time: 2023-08-21T19:28:42.00000Z -custom: - Author: dependabot[bot] - PR: 588 diff --git a/.changes/1.7.0/Dependencies-20230901-230919.yaml b/.changes/1.7.0/Dependencies-20230901-230919.yaml deleted file mode 100644 index 178fc9ff5..000000000 --- a/.changes/1.7.0/Dependencies-20230901-230919.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update tox requirement from ~=4.10 to ~=4.11" -time: 2023-09-01T23:09:19.00000Z -custom: - Author: dependabot[bot] - PR: 594 diff --git a/.changes/1.7.0/Dependencies-20230904-193307.yaml b/.changes/1.7.0/Dependencies-20230904-193307.yaml deleted file mode 100644 index 11707de31..000000000 --- a/.changes/1.7.0/Dependencies-20230904-193307.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update pre-commit requirement from ~=3.3 to ~=3.4" -time: 2023-09-04T19:33:07.00000Z -custom: - Author: dependabot[bot] - PR: 596 diff --git a/.changes/1.7.0/Dependencies-20230912-002353.yaml b/.changes/1.7.0/Dependencies-20230912-002353.yaml deleted file mode 100644 index be7230348..000000000 --- a/.changes/1.7.0/Dependencies-20230912-002353.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update black requirement from ~=23.7 to ~=23.9" -time: 2023-09-12T00:23:53.00000Z -custom: - Author: dependabot[bot] - PR: 600 diff --git a/.changes/1.7.0/Features-20230803-111146.yaml b/.changes/1.7.0/Features-20230803-111146.yaml deleted file mode 100644 index 098e8888e..000000000 --- a/.changes/1.7.0/Features-20230803-111146.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Features -body: Support DISTSTYLE for seeds -time: 2023-08-03T11:11:46.571996-06:00 -custom: - Author: WillAyd - Issue: "255" diff --git a/.changes/1.7.0/Fixes-20230802-103350.yaml b/.changes/1.7.0/Fixes-20230802-103350.yaml deleted file mode 100644 index 5c5a1fe79..000000000 --- a/.changes/1.7.0/Fixes-20230802-103350.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: Insert values of `merge_exclude_columns` when not matched -time: 2023-08-02T10:33:50.107228-06:00 -custom: - Author: dbeatty10 - Issue: "563" diff --git a/.changes/1.7.0/Fixes-20230815-151655.yaml b/.changes/1.7.0/Fixes-20230815-151655.yaml deleted file mode 100644 index 15829017b..000000000 --- a/.changes/1.7.0/Fixes-20230815-151655.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: allow auto_refresh to take in boolean and str values for materialized views -time: 2023-08-15T15:16:55.771712-05:00 -custom: - Author: McKnight-42 - Issue: "560" diff --git a/.changes/1.7.0/Fixes-20230830-164611.yaml b/.changes/1.7.0/Fixes-20230830-164611.yaml deleted file mode 100644 index ba8d47c01..000000000 --- a/.changes/1.7.0/Fixes-20230830-164611.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: Fix to support removal of hologram, remove unused IAMDuration encoder -time: 2023-08-30T16:46:11.83975-04:00 -custom: - Author: gshank - Issue: "591" diff --git a/.changes/1.7.0/Fixes-20230908-113019.yaml b/.changes/1.7.0/Fixes-20230908-113019.yaml deleted file mode 100644 index ed5957317..000000000 --- a/.changes/1.7.0/Fixes-20230908-113019.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: changes expected value types to AnyInteger to take into account changes in core -time: 2023-09-08T11:30:19.77143-05:00 -custom: - Author: McKnight-42 - Issue: "597" diff --git a/.changes/1.7.0/Fixes-20230912-133327.yaml b/.changes/1.7.0/Fixes-20230912-133327.yaml deleted file mode 100644 index e5aa98d47..000000000 --- a/.changes/1.7.0/Fixes-20230912-133327.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Features -body: use get_replace_sql in redshift__get_alter_materialized_view_as_sql, avoid renaming materialized views with custom table.sql and view.sql -time: 2023-09-12T13:33:27.451042-07:00 -custom: - Author: colin-rogers-dbt - Issue: "606" diff --git a/.changes/1.7.0/Under the Hood-20230724-164439.yaml b/.changes/1.7.0/Under the Hood-20230724-164439.yaml deleted file mode 100644 index 59f929e69..000000000 --- a/.changes/1.7.0/Under the Hood-20230724-164439.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Under the Hood -body: Update stale workflow to use the centralized version -time: 2023-07-24T16:44:39.683995-04:00 -custom: - Author: mikealfare - Issue: "552" diff --git a/.changes/1.7.0/Under the Hood-20230808-141645.yaml b/.changes/1.7.0/Under the Hood-20230808-141645.yaml deleted file mode 100644 index 051bf0e33..000000000 --- a/.changes/1.7.0/Under the Hood-20230808-141645.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: Under the Hood -body: Update flaky MV tests to use retry logic to avoid "cannot open relation with - OID" error -time: 2023-08-08T14:16:45.227308-04:00 -custom: - Author: mikealfare - Issue: "569" diff --git a/.changes/1.7.0/Under the Hood-20230829-113206.yaml b/.changes/1.7.0/Under the Hood-20230829-113206.yaml deleted file mode 100644 index d9dafe59c..000000000 --- a/.changes/1.7.0/Under the Hood-20230829-113206.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: Under the Hood -body: Restructure macro files to be more granular; organize macros by relation and - type (create, drop, etc.) -time: 2023-08-29T11:32:06.653271-04:00 -custom: - Author: mikealfare - Issue: "590" diff --git a/.changes/1.7.0/Under the Hood-20230914-135547.yaml b/.changes/1.7.0/Under the Hood-20230914-135547.yaml deleted file mode 100644 index 3bb8e3c8a..000000000 --- a/.changes/1.7.0/Under the Hood-20230914-135547.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: Under the Hood -body: allow for bool/str input to backup/autorefresh when configuring materialized - views -time: 2023-09-14T13:55:47.951848-07:00 -custom: - Author: colin-rogers-dbt - Issue: "606" diff --git a/.changes/unreleased/Dependencies-20230918-190833.yaml b/.changes/unreleased/Dependencies-20230918-190833.yaml deleted file mode 100644 index f784102ca..000000000 --- a/.changes/unreleased/Dependencies-20230918-190833.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: "Dependencies" -body: "Update ddtrace requirement from ~=1.18 to ~=1.19" -time: 2023-09-18T19:08:33.00000Z -custom: - Author: dependabot[bot] - PR: 610 diff --git a/.changes/unreleased/Features-20230921-153707.yaml b/.changes/unreleased/Features-20230921-153707.yaml deleted file mode 100644 index cf2c60ad5..000000000 --- a/.changes/unreleased/Features-20230921-153707.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Features -body: Support storing test failures as views -time: 2023-09-21T15:37:07.970722-04:00 -custom: - Author: mikealfare - Issue: "6914" diff --git a/.changes/unreleased/Fixes-20230807-174409.yaml b/.changes/unreleased/Fixes-20230807-174409.yaml deleted file mode 100644 index ad4f11b42..000000000 --- a/.changes/unreleased/Fixes-20230807-174409.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: Use the PID to terminate the session -time: 2023-08-07T17:44:09.15097-06:00 -custom: - Author: dbeatty10 - Issue: "553" diff --git a/.changes/unreleased/Fixes-20230923-091155.yaml b/.changes/unreleased/Fixes-20230923-091155.yaml deleted file mode 100644 index 055d4dc7e..000000000 --- a/.changes/unreleased/Fixes-20230923-091155.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: avoid nested loop in query planner execution of redshift__get_relations -time: 2023-09-23T09:11:55.2152725-04:00 -custom: - Author: slin30 - Issue: "609" diff --git a/.changes/unreleased/Under the Hood-20230925-150132.yaml b/.changes/unreleased/Under the Hood-20230925-150132.yaml deleted file mode 100644 index c61a28d56..000000000 --- a/.changes/unreleased/Under the Hood-20230925-150132.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Under the Hood -body: Add tests for inlined limit + sql_header in dbt show query -time: 2023-09-25T15:01:32.025325+01:00 -custom: - Author: michelleark - Issue: "616" diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bb546acc..04a8e7db1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,66 +5,6 @@ - "Breaking changes" listed under a version may require action from end users or external maintainers when upgrading to that version. - Do not edit this file directly. This file is auto-generated using [changie](https://github.com/miniscruff/changie). For details on how to document a change, see [the contributing guide](https://github.com/dbt-labs/dbt-redshift/blob/main/CONTRIBUTING.md#adding-changelog-entry) -## dbt-redshift 1.7.0-b2 - September 15, 2023 - -### Features - -- use get_replace_sql in redshift__get_alter_materialized_view_as_sql, avoid renaming materialized views with custom table.sql and view.sql ([#606](https://github.com/dbt-labs/dbt-redshift/issues/606)) - -### Fixes - -- allow auto_refresh to take in boolean and str values for materialized views ([#560](https://github.com/dbt-labs/dbt-redshift/issues/560)) -- Fix to support removal of hologram, remove unused IAMDuration encoder ([#591](https://github.com/dbt-labs/dbt-redshift/issues/591)) -- changes expected value types to AnyInteger to take into account changes in core ([#597](https://github.com/dbt-labs/dbt-redshift/issues/597)) - -### Under the Hood - -- Restructure macro files to be more granular; organize macros by relation and type (create, drop, etc.) ([#590](https://github.com/dbt-labs/dbt-redshift/issues/590)) -- allow for bool/str input to backup/autorefresh when configuring materialized views ([#606](https://github.com/dbt-labs/dbt-redshift/issues/606)) - -### Dependencies - -- Bump mypy from 1.5.0 to 1.5.1 ([#585](https://github.com/dbt-labs/dbt-redshift/pull/585)) -- Update tox requirement from ~=4.9 to ~=4.10 ([#588](https://github.com/dbt-labs/dbt-redshift/pull/588)) -- Update tox requirement from ~=4.10 to ~=4.11 ([#594](https://github.com/dbt-labs/dbt-redshift/pull/594)) -- Update pre-commit requirement from ~=3.3 to ~=3.4 ([#596](https://github.com/dbt-labs/dbt-redshift/pull/596)) -- Update black requirement from ~=23.7 to ~=23.9 ([#600](https://github.com/dbt-labs/dbt-redshift/pull/600)) - - - -## dbt-redshift 1.7.0-b1 - August 17, 2023 - -### Features - -- Support DISTSTYLE for seeds ([#255](https://github.com/dbt-labs/dbt-redshift/issues/255)) - -### Fixes - -- Insert values of `merge_exclude_columns` when not matched ([#563](https://github.com/dbt-labs/dbt-redshift/issues/563)) - -### Under the Hood - -- Update stale workflow to use the centralized version ([#552](https://github.com/dbt-labs/dbt-redshift/issues/552)) -- Update flaky MV tests to use retry logic to avoid "cannot open relation with OID" error ([#569](https://github.com/dbt-labs/dbt-redshift/issues/569)) - -### Dependencies - -- Update black requirement from ~=23.3 to ~=23.7 ([#529](https://github.com/dbt-labs/dbt-redshift/pull/529)) -- Update pip-tools requirement from ~=6.14 to ~=7.0 ([#541](https://github.com/dbt-labs/dbt-redshift/pull/541)) -- Update ddtrace requirement from ~=1.16 to ~=1.17 ([#550](https://github.com/dbt-labs/dbt-redshift/pull/550)) -- Update wheel requirement from ~=0.40 to ~=0.41 ([#551](https://github.com/dbt-labs/dbt-redshift/pull/551)) -- Update flake8 requirement from ~=6.0 to ~=6.1 ([#562](https://github.com/dbt-labs/dbt-redshift/pull/562)) -- Update pip-tools requirement from ~=7.0 to ~=7.2 ([#567](https://github.com/dbt-labs/dbt-redshift/pull/567)) -- Update tox requirement from ~=4.6 to ~=4.7 ([#570](https://github.com/dbt-labs/dbt-redshift/pull/570)) -- Bump mypy from 1.4.1 to 1.5.0 ([#573](https://github.com/dbt-labs/dbt-redshift/pull/573)) -- Update pip-tools requirement from ~=7.2 to ~=7.3 ([#572](https://github.com/dbt-labs/dbt-redshift/pull/572)) -- Update ddtrace requirement from ~=1.17 to ~=1.18 ([#575](https://github.com/dbt-labs/dbt-redshift/pull/575)) -- Update tox requirement from ~=4.7 to ~=4.8 ([#581](https://github.com/dbt-labs/dbt-redshift/pull/581)) -- Update tox requirement from ~=4.8 to ~=4.9 ([#586](https://github.com/dbt-labs/dbt-redshift/pull/586)) - -### Contributors -- [@WillAyd](https://github.com/WillAyd) ([#255](https://github.com/dbt-labs/dbt-redshift/issues/255)) - ## Previous Releases For information on prior major and minor releases, see their changelogs: - [1.6](https://github.com/dbt-labs/dbt-redshift/blob/1.6.latest/CHANGELOG.md) diff --git a/dbt/adapters/redshift/__version__.py b/dbt/adapters/redshift/__version__.py index 3f5d3c0b7..f15b401d1 100644 --- a/dbt/adapters/redshift/__version__.py +++ b/dbt/adapters/redshift/__version__.py @@ -1 +1 @@ -version = "1.7.0b2" +version = "1.8.0a1"