diff --git a/.changes/0.0.0.md b/.changes/0.0.0.md new file mode 100644 index 000000000..49654714a --- /dev/null +++ b/.changes/0.0.0.md @@ -0,0 +1,5 @@ +## Previous Releases +For information on prior major and minor releases, see their changelogs: +- [1.2](https://github.com/dbt-labs/dbt-snowflake/blob/1.2.latest/CHANGELOG.md) +- [1.1](https://github.com/dbt-labs/dbt-snowflake/blob/1.1.latest/CHANGELOG.md) +- [1.0](https://github.com/dbt-labs/dbt-snowflake/blob/1.0.latest/CHANGELOG.md) diff --git a/.changes/1.3.0-b1.md b/.changes/1.3.0-b1.md new file mode 100644 index 000000000..bc29784d5 --- /dev/null +++ b/.changes/1.3.0-b1.md @@ -0,0 +1,6 @@ +## dbt-snowflake 1.3.0-b1 - August 03, 2022 +### Features +- Support python model through create stored procedure with python in it, currently supported materializations are table and incremental. ([#216](https://github.com/dbt-labs/dbt-snowflake/issues/216), [#182](https://github.com/dbt-labs/dbt-snowflake/pull/182)) +### Under the Hood +- Reformat overridden macro location of grants work to a apply_grants.sql file in snowflake ([#193](https://github.com/dbt-labs/dbt-snowflake/issues/193), [#192](https://github.com/dbt-labs/dbt-snowflake/pull/192)) +- Support dbt Core incrmental materialization refactor ([#195](https://github.com/dbt-labs/dbt-snowflake/issues/195), [#196](https://github.com/dbt-labs/dbt-snowflake/pull/196)) diff --git a/.changes/1.3.0/Features-20220729-132848.yaml b/.changes/1.3.0/Features-20220729-132848.yaml new file mode 100644 index 000000000..4d45b8df0 --- /dev/null +++ b/.changes/1.3.0/Features-20220729-132848.yaml @@ -0,0 +1,8 @@ +kind: Features +body: Support python model through create stored procedure with python in it, currently + supported materializations are table and incremental. +time: 2022-07-29T13:28:48.536301-05:00 +custom: + Author: ChenyuLInx + Issue: "216" + PR: "182" diff --git a/.changes/1.3.0/Under the Hood-20220729-132335.yaml b/.changes/1.3.0/Under the Hood-20220729-132335.yaml new file mode 100644 index 000000000..806f80dd4 --- /dev/null +++ b/.changes/1.3.0/Under the Hood-20220729-132335.yaml @@ -0,0 +1,8 @@ +kind: Under the Hood +body: Reformat overridden macro location of grants work to a apply_grants.sql file + in snowflake +time: 2022-07-29T13:23:35.007032-05:00 +custom: + Author: McKnight-42 + Issue: "193" + PR: "192" diff --git a/.changes/1.3.0/Under the Hood-20220729-132559.yaml b/.changes/1.3.0/Under the Hood-20220729-132559.yaml new file mode 100644 index 000000000..80fb0e21b --- /dev/null +++ b/.changes/1.3.0/Under the Hood-20220729-132559.yaml @@ -0,0 +1,7 @@ +kind: Under the Hood +body: Support dbt Core incrmental materialization refactor +time: 2022-07-29T13:25:59.279755-05:00 +custom: + Author: gshank + Issue: "195" + PR: "196" diff --git a/.changes/README.md b/.changes/README.md new file mode 100644 index 000000000..d82835028 --- /dev/null +++ b/.changes/README.md @@ -0,0 +1,3 @@ +# CHANGELOG + +To view information about the changelog operation we suggest reading this [README](https://github.com/dbt-labs/dbt-core/blob/main/.changes/README.md) found in `dbt-core`. diff --git a/.changes/header.tpl.md b/.changes/header.tpl.md new file mode 100644 index 000000000..1022a1999 --- /dev/null +++ b/.changes/header.tpl.md @@ -0,0 +1,6 @@ +# dbt-snowflake Changelog + +- This file provides a full account of all changes to `dbt-snowflake`. +- Changes are listed under the (pre)release in which they first appear. Subsequent releases include changes from previous releases. +- "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-snowflake/blob/main/CONTRIBUTING.md#adding-changelog-entry) diff --git a/.changes/unreleased/.gitkeep b/.changes/unreleased/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/.changes/unreleased/Under the Hood-20220803-093405.yaml b/.changes/unreleased/Under the Hood-20220803-093405.yaml new file mode 100644 index 000000000..1572f8431 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20220803-093405.yaml @@ -0,0 +1,7 @@ +kind: Under the Hood +body: Add changie to dbt-snowflake +time: 2022-08-03T09:34:05.772647-05:00 +custom: + Author: McKnight-42 + Issue: "209" + PR: "212" diff --git a/.changie.yaml b/.changie.yaml new file mode 100644 index 000000000..f1d030d2a --- /dev/null +++ b/.changie.yaml @@ -0,0 +1,60 @@ +changesDir: .changes +unreleasedDir: unreleased +headerPath: header.tpl.md +versionHeaderPath: "" +changelogPath: CHANGELOG.md +versionExt: md +versionFormat: '## dbt-snowflake {{.Version}} - {{.Time.Format "January 02, 2006"}}' +kindFormat: '### {{.Kind}}' +changeFormat: '- {{.Body}} ([#{{.Custom.Issue}}](https://github.com/dbt-labs/dbt-snowflake/issues/{{.Custom.Issue}}), [#{{.Custom.PR}}](https://github.com/dbt-labs/dbt-snowflake/pull/{{.Custom.PR}}))' +kinds: +- label: Breaking Changes +- label: Features +- label: Fixes +- label: Under the Hood +- label: Dependencies +- label: Security +custom: +- key: Author + label: GitHub Username(s) (separated by a single space if multiple) + type: string + minLength: 3 +- key: Issue + label: GitHub Issue Number + type: int + minLength: 4 +- key: PR + label: GitHub Pull Request Number + type: int + minLength: 4 +footerFormat: | + {{- $contributorDict := dict }} + {{- /* any names added to this list should be all lowercase for later matching purposes */}} + {{- $core_team := list "emmyoop" "nathaniel-may" "gshank" "leahwicz" "chenyulinx" "stu-k" "iknox-fa" "versusfacit" "mcknight-42" "jtcohen6" "dependabot[bot]" "snyk-bot" }} + {{- range $change := .Changes }} + {{- $authorList := splitList " " $change.Custom.Author }} + {{- /* loop through all authors for a PR */}} + {{- range $author := $authorList }} + {{- $authorLower := lower $author }} + {{- /* we only want to include non-core team contributors */}} + {{- if not (has $authorLower $core_team)}} + {{- $pr := $change.Custom.PR }} + {{- /* check if this contributor has other PRs associated with them already */}} + {{- if hasKey $contributorDict $author }} + {{- $prList := get $contributorDict $author }} + {{- $prList = append $prList $pr }} + {{- $contributorDict := set $contributorDict $author $prList }} + {{- else }} + {{- $prList := list $change.Custom.PR }} + {{- $contributorDict := set $contributorDict $author $prList }} + {{- end }} + {{- end}} + {{- end}} + {{- end }} + {{- /* no indentation here for formatting so the final markdown doesn't have unneeded indentations */}} + {{- if $contributorDict}} + ### Contributors + {{- range $k,$v := $contributorDict }} + - [@{{$k}}](https://github.com/{{$k}}) ({{ range $index, $element := $v }}{{if $index}}, {{end}}[#{{$element}}](https://github.com/dbt-labs/dbt-snowflake/pull/{{$element}}){{end}}) + {{- end }} + {{- end }} diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7f41f4c88..e15849215 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -18,4 +18,4 @@ resolves # - [ ] I have signed the [CLA](https://docs.getdbt.com/docs/contributor-license-agreements) - [ ] I have run this code in development and it appears to resolve the stated issue - [ ] This PR includes tests, or tests are not required/relevant for this PR -- [ ] I have updated the `CHANGELOG.md` and added information about my change to the "dbt-snowflake next" section. +- [ ] I have run `changie new` to [create a changelog entry](https://github.com/dbt-labs/dbt-core/blob/main/CONTRIBUTING.md#Adding-CHANGELOG-Entry) diff --git a/.github/workflows/bot-changelog.yml b/.github/workflows/bot-changelog.yml new file mode 100644 index 000000000..2a141f849 --- /dev/null +++ b/.github/workflows/bot-changelog.yml @@ -0,0 +1,61 @@ +# **what?** +# When bots create a PR, this action will add a corresponding changie yaml file to that +# PR when a specific label is added. +# +# The file is created off a template: +# +# kind: +# body: +# time: +# custom: +# Author: +# Issue: 4904 +# PR: +# +# **why?** +# Automate changelog generation for more visability with automated bot PRs. +# +# **when?** +# Once a PR is created, label should be added to PR before or after creation. You can also +# manually trigger this by adding the appropriate label at any time. +# +# **how to add another bot?** +# Add the label and changie kind to the include matrix. That's it! +# + +name: Bot Changelog + +on: + pull_request: + # catch when the PR is opened with the label or when the label is added + types: [opened, labeled] + +permissions: + contents: write + pull-requests: read + +jobs: + generate_changelog: + strategy: + matrix: + include: + - label: "dependencies" + changie_kind: "Dependency" + - label: "snyk" + changie_kind: "Security" + runs-on: ubuntu-latest + + steps: + + - name: Create and commit changelog on bot PR + if: "contains(github.event.pull_request.labels.*.name, ${{ matrix.label }})" + id: bot_changelog + uses: emmyoop/changie_bot@v1.0 + with: + GITHUB_TOKEN: ${{ secrets.FISHTOWN_BOT_PAT }} + commit_author_name: "Github Build Bot" + commit_author_email: "" + 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 Issue: 216\n PR: ${{ github.event.pull_request.number }}\n" diff --git a/.github/workflows/changelog-existence.yml b/.github/workflows/changelog-existence.yml new file mode 100644 index 000000000..0259107f9 --- /dev/null +++ b/.github/workflows/changelog-existence.yml @@ -0,0 +1,41 @@ +# **what?** +# Checks that a file has been committed under the /.changes directory +# as a new CHANGELOG entry. Cannot check for a specific filename as +# it is dynamically generated by change type and timestamp. +# This workflow should not require any secrets since it runs for PRs +# from forked repos. +# By default, secrets are not passed to workflows running from +# a forked repo. + +# **why?** +# Ensure code change gets reflected in the CHANGELOG. + +# **when?** +# This will run for all PRs going into main and *.latest. It will +# run when they are opened, reopened, when any label is added or removed +# and when new code is pushed to the branch. The action will then get +# skipped if the 'Skip Changelog' label is present is any of the labels. + +name: Check Changelog Entry + +on: + pull_request: + types: [opened, reopened, labeled, unlabeled, synchronize] + workflow_dispatch: + +defaults: + run: + shell: bash + +permissions: + contents: read + pull-requests: write + + +jobs: + changelog: + uses: dbt-labs/actions/.github/workflows/changelog-existence.yml@main + with: + changelog_comment: 'Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see [the dbt-core contributing guide](https://github.com/dbt-labs/dbt-core/blob/main/CONTRIBUTING.md#adding-changelog-entry), and the [dbt-snowflake contriubuting guide](https://github.com/dbt-labs/dbt-snowflake/blob/main/CONTRIBUTING.MD).' + skip_label: 'Skip Changelog' + secrets: inherit # this is only acceptable because we own the action we're calling diff --git a/CHANGELOG.md b/CHANGELOG.md index a9b2a6925..d75b0bf5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,113 +1,21 @@ -## dbt-snowflake 1.3.0b2 (Release TBD) +# dbt-snowflake Changelog -## dbt-snowflake 1.3.0b1 (July 29, 2022) +- This file provides a full account of all changes to `dbt-snowflake`. +- Changes are listed under the (pre)release in which they first appear. Subsequent releases include changes from previous releases. +- "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-snowflake/blob/main/CONTRIBUTING.md#adding-changelog-entry) -### Features -- support python model through create stored procedure with python in it, currently supported materializations are table and incremental. ([#182](https://github.com/dbt-labs/dbt-snowflake/pull/182)) +## dbt-snowflake 1.3.0-b1 - August 03, 2022 +### Features +- Support python model through create stored procedure with python in it, currently supported materializations are table and incremental. ([#216](https://github.com/dbt-labs/dbt-snowflake/issues/216), [#182](https://github.com/dbt-labs/dbt-snowflake/pull/182)) ### Under the Hood - Reformat overridden macro location of grants work to a apply_grants.sql file in snowflake ([#193](https://github.com/dbt-labs/dbt-snowflake/issues/193), [#192](https://github.com/dbt-labs/dbt-snowflake/pull/192)) -- Support dbt Core incremental materialization refactor ([#195](https://github.com/dbt-labs/dbt-snowflake/issues/195), [#196](https://github.com/dbt-labs/dbt-snowflake/pull/196)) - -## dbt-snowflake 1.2.0rc1 (July 12, 2022) - -### Fixes -- In multi-query statements, prepend all queries with query comments. Use the last non-`COMMIT` query to store metadata about the model result. **Note:** this restores previous (pre-v0.21) behavior for incremental models and snapshots, which will again correctly reflect the number of rows modified in `adapter_response.rows_affected` ([#140](https://github.com/dbt-labs/dbt-snowflake/issues/140), [#147](https://github.com/dbt-labs/dbt-snowflake/issues147140), [#153](https://github.com/dbt-labs/dbt-snowflake/pull/153)) -- Improve column comment handling when `persist_docs` is enabled ([#161](https://github.com/dbt-labs/dbt-snowflake/pull/161)) - -### Features -- Add grants to materializations ([#168](https://github.com/dbt-labs/dbt-snowflake/issues/168), [#178](https://github.com/dbt-labs/dbt-snowflake/pull/178)) - -### Contributors -- [@LewisDavies](https://github.com/LewisDavies) ([#161](https://github.com/dbt-labs/dbt-snowflake/pull/161)) - -## dbt-snowflake 1.2.0b1 (June 24, 2022) - -### Features -- Add set_query_tag and unset_query_tag to the dbt macro namespace ([#133](https://github.com/dbt-labs/dbt-snowflake/issues/133), [#132](https://github.com/dbt-labs/dbt-snowflake/pull/132)) - -### Under the hood -- Add precommits for this repo ([#107](https://github.com/dbt-labs/dbt-snowflake/pull/107)) -- Cleanup redundant precommit hook command ([#145](https://github.com/dbt-labs/dbt-snowflake/pull/145)) -- File rename to match reference to core ([#152](https://github.com/dbt-labs/dbt-snowflake/pull/152)) -- Bump cryptography restraint upper bound to <37.0.0 ([#171](https://github.com/dbt-labs/dbt-snowflake/pull/171)) -- Migrate oauth refresh script from core ([#175](https://github.com/dbt-labs/dbt-snowflake/pull/175)) -- Lift and shift cross-database macros from dbt-utils ([#162](https://github.com/dbt-labs/dbt-snowflake/pull/162) - -### Contributors -- [@hhobson](https://github.com/hhobson) ([#171](https://github.com/dbt-labs/dbt-snowflake/pull/171)) -- [@robscriva](https://github.com/robscriva) ([#132](https://github.com/dbt-labs/dbt-snowflake/pull/132)) -- [@dbeatty10](https://github.com/dbeatty10) ([#162](https://github.com/dbt-labs/dbt-snowflake/pull/162) - -## dbt-snowflake 1.1.0b1 (March 23, 2022) - -### Features -- Adds tests for incremental model unique key parameter ([#91](https://github.com/dbt-labs/dbt-snowflake/issues/91)) -- enables mfa token caching for linux when using the username_password_mfa authenticator ([#65](https://github.com/dbt-labs/dbt-snowflake/pull/65)) - -### Fixes -- Add unique\_id field to docs generation test catalogs; a follow-on PR to core PR ([#4168](https://github.com/dbt-labs/dbt-core/pull/4618)) - -### Under the hood -- Add `query_id` for a query to `run_result.json` ([#40](https://github.com/dbt-labs/dbt-snowflake/pull/40)) -- Change logic for Post-failure job run ([#67](https://github.com/dbt-labs/dbt-snowflake/pull/67)) -- Update to version bumping script ([#68](https://github.com/dbt-labs/dbt-snowflake/pull/68)) -- Add contributing.md file for snowflake adapter repo ([#79](https://github.com/dbt-labs/dbt-snowflake/pull/79)) -- Use dbt.tests.adapter.basic in test suite (new test framework) ([#105](https://github.com/dbt-labs/dbt-snowflake/issues/105), [#106](https://github.com/dbt-labs/dbt-snowflake/pull/106)) - -### Contributors -- [@joshuataylor](https://github.com/joshuataylor) ([#40](https://github.com/dbt-labs/dbt-snowflake/pull/40)) -- [@devoted](https://github.com/devoted) ([#40](https://github.com/dbt-labs/dbt-snowflake/pull/40)) - -## dbt-snowflake 1.0.0 (December 3rd, 2021) - -## dbt-snowflake 1.0.0rc2 (November 24, 2021) - -### Fixes -- Apply query tags for Seed and Snapshot materialisations ([#20](https://github.com/dbt-labs/dbt-snowflake/issues/20), [#48](https://github.com/dbt-labs/dbt-snowflake/issues/48)) -- Adds column-level comments to Snowflake views ([#17](https://github.com/dbt-labs/dbt-snowflake/issues/17)) - -### Under the hood -- Resolves an issue caused when the Snowflake OCSP server is not accessible, by exposing the `insecure_mode` boolean avalable in the Snowflake python connector ([#31](https://github.com/dbt-labs/dbt-snowflake/issues/31), [#49](https://github.com/dbt-labs/dbt-snowflake/pull/49)) -- Fix test related to preventing coercion of boolean values (True, False) to numeric values (0, 1) in query results ([#76](https://github.com/dbt-labs/dbt-snowflake/issues/76)) -- Add Stale messaging Github Action workflow ([#84](https://github.com/dbt-labs/dbt-snowflake/pull/84)) - - -### Contributors -- [@anthu](https://github.com/anthu) ([#48](https://github.com/dbt-labs/dbt-snowflake/pull/48)) -- [@JoshuaHuntley](https://github.com/JoshuaHuntley) ([#49](https://github.com/dbt-labs/dbt-snowflake/pull/49)) -- [@spencer-taylor-workrise](https://github.com/spencer-taylor-workrise) ([#17](https://github.com/dbt-labs/dbt-snowflake/issues/17)) - -## dbt-snowflake 1.0.0rc1 (November 10, 2021) - -### Features -- Adds option to enable retries on errors encountered by the Snowflake connector ([#14](https://github.com/dbt-labs/dbt-snowflake/issues/14)) - -### Fixes -- When on_schema_change is set, pass common columns as dest_columns in incremental merge macros ([#4144](https://github.com/dbt-labs/dbt-core/issues/4144)) - -### Under the hood -- Add optional profile parameters for atypical local connection setups ([#21](https://github.com/dbt-labs/dbt-snowflake/issues/21), [#36](https://github.com/dbt-labs/dbt-snowflake/pull/36)) -- Adds 4 optional profile parameters for configuring retries on Snowflake errors ([#14](https://github.com/dbt-labs/dbt-snowflake/issues/14), [#6](https://github.com/dbt-labs/dbt-snowflake/pull/6)) -- Bump upper bound on `snowflake-connector-python` to `<2.8.0` ([#44](https://github.com/dbt-labs/dbt-snowflake/pull/44)) -- Remove official support for python 3.6, which is reaching end of life on December 23, 2021 ([dbt-core#4134](https://github.com/dbt-labs/dbt-core/issues/4134), [#38](https://github.com/dbt-labs/dbt-snowflake/pull/45)) -- Add support for structured logging [#42](https://github.com/dbt-labs/dbt-snowflake/pull/42) - -### Contributors -- [@laxjesse](https://github.com/laxjesse) ([#36](https://github.com/dbt-labs/dbt-snowflake/pull/36)) -- [@mhmcdonald](https://github.com/mhmcdonald) ([#6](https://github.com/dbt-labs/dbt-snowflake/pull/6)) - -## dbt-snowflake v1.0.0b2 (October 25, 2021) - -### Under the hood -- Replace `sample_profiles.yml` with `profile_template.yml`, for use with new `dbt init` ([#32](https://github.com/dbt-labs/dbt-snowflake/pull/32)) - -### Contributors -- [@NiallRees](https://github.com/NiallRees) ([#32](https://github.com/dbt-labs/dbt-snowflake/pull/32)) -- [@Kayrnt](https://github.com/Kayrnt) ([#38](https://github.com/dbt-labs/dbt-snowflake/pull/38)) - -## dbt-snowflake v1.0.0b1 (October 11, 2021) +- Support dbt Core incrmental materialization refactor ([#195](https://github.com/dbt-labs/dbt-snowflake/issues/195), [#196](https://github.com/dbt-labs/dbt-snowflake/pull/196)) -### Under the hood -- Initial adapter split out +## Previous Releases +For information on prior major and minor releases, see their changelogs: +- [1.2](https://github.com/dbt-labs/dbt-snowflake/blob/1.2.latest/CHANGELOG.md) +- [1.1](https://github.com/dbt-labs/dbt-snowflake/blob/1.1.latest/CHANGELOG.md) +- [1.0](https://github.com/dbt-labs/dbt-snowflake/blob/1.0.latest/CHANGELOG.md) diff --git a/CONTRIBUTING.MD b/CONTRIBUTING.MD index a96249b55..cda96ef0c 100644 --- a/CONTRIBUTING.MD +++ b/CONTRIBUTING.MD @@ -111,6 +111,16 @@ Many changes will require an update to `dbt-snowflake` documentation. Here are s - The changes made are likely to impact one or both of [Snowflake Profile](https://docs.getdbt.com/reference/warehouse-profiles/snowflake-profile), or [Snowflake Configs](https://docs.getdbt.com/reference/resource-configs/snowflake-configs). - We ask every community member who makes a user-facing change to open an issue or PR regarding doc changes. +## Adding CHANGELOG Entry + +We use [changie](https://changie.dev) to generate `CHANGELOG` entries. **Note:** Do not edit the `CHANGELOG.md` directly. Your modifications will be lost. + +Follow the steps to [install `changie`](https://changie.dev/guide/installation/) for your system. + +Once changie is installed and your PR is created, simply run `changie new` and changie will walk you through the process of creating a changelog entry. Commit the file that's created and your changelog entry is complete! + +You don't need to worry about which `dbt-snowflake` version your change will go into. Just create the changelog entry with `changie`, and open your PR against the `main` branch. All merged changes will be included in the next minor version of `dbt-snowflake`. The Core maintainers _may_ choose to "backport" specific changes in order to patch older minor versions. In that case, a maintainer will take care of that backport after merging your PR, before releasing the new version of `dbt-snowflake`. + ## Submitting a Pull Request A `dbt-snowflake` maintainer will review your PR and will determine if it has passed regression tests. They may suggest code revisions for style and clarity, or they may request that you add unit or integration tests. These are good things! We believe that, with a little bit of help, anyone can contribute high-quality code.