Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: allow DT warehouse to be updated in-place #2439

Merged

Conversation

sonya
Copy link
Contributor

@sonya sonya commented Jan 27, 2024

Dynamic table warehouses can be updated in-place with an ALTER DYNAMIC TABLE statement. The terraform resource was requiring the DT to be dropped and recreated in order to change the warehouse, but this is not necessary.

This commit removes the ForceNew modifier on the "warehouse" parameter so that users can easily change the warehouse. This is a setting that users may want to easily change for cost allocation purposes.

Test Plan

  • tested by running terraform apply and terraform plan on an existing stack with warehouse changes, observed that dynamic tables were updated in place, and ALTER DYNAMIC TABLE was run in Snowflake

References

Documentation for ALTER DYNAMIC TABLE command: https://docs.snowflake.com/en/sql-reference/sql/alter-dynamic-table

@sfc-gh-asawicki
Copy link
Collaborator

Hey @sonya. Thanks for the PR. This week is pretty tough for us, I will check the PR next week.

sfc-gh-jcieslak
sfc-gh-jcieslak previously approved these changes Feb 7, 2024
Copy link
Collaborator

@sfc-gh-asawicki sfc-gh-asawicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @sonya. Thanks for the contribution.

I have just a small comment with the missing test, and we can merge it after!

pkg/resources/dynamic_table.go Show resolved Hide resolved
Dynamic table warehouses can be updated in-place with an ALTER DYNAMIC
TABLE statement. The terraform resource was requiring the DT to be
dropped and recreated in order to change the warehouse, but this is not
necessary.

This commit removes the ForceNew modifier on the "warehouse" parameter
so that users can easily change the warehouse. This is a setting that
users may want to easily change for cost allocation purposes.
This commit adds a case to the basic acceptance test where the warehouse
is changed. The warehouse must exist in advance, so this also adds a new
warehouse to the acceptance test setup process.
@sonya
Copy link
Contributor Author

sonya commented Feb 12, 2024

Added the field to the basic acceptance test. I'm not sure if that's sufficient to demonstrate that the DT doesn't get destroyed and recreated. I did some more work in #2437 on being able to tell if a change caused a replace (but I might be missing a much more obvious way)

@sfc-gh-asawicki
Copy link
Collaborator

Thanks, I will check it today.

Copy link
Collaborator

@sfc-gh-jcieslak sfc-gh-jcieslak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the second warehouse could be named TestSecondaryWarehouseName, but It's just a cosmetic change and we can do it later. Thanks for the contribution!

@sfc-gh-asawicki
Copy link
Collaborator

/ok-to-test sha=6cea1521bf8037b7252217a47fdd6a3c3ac69cc2

Copy link

Integration tests failure for 6cea1521bf8037b7252217a47fdd6a3c3ac69cc2

@sfc-gh-asawicki
Copy link
Collaborator

/ok-to-test sha=e8ee7b4d9b16c645df6765750c81008cc20febd0

Copy link

Integration tests failure for e8ee7b4d9b16c645df6765750c81008cc20febd0

@sfc-gh-asawicki sfc-gh-asawicki merged commit d565af1 into Snowflake-Labs:main Feb 12, 2024
7 of 8 checks passed
@sfc-gh-asawicki
Copy link
Collaborator

I have merged the change. Thank you for your contribution @sonya!

sfc-gh-jcieslak pushed a commit that referenced this pull request Feb 15, 2024
🤖 I have created a release *beep* *boop*
---


# Release notes
[0.86.0](v0.85.0...v0.86.0)
(2024-02-15)


## 🎉 **What's new**

* add refresh_mode and initialize to dynamic tables
([#2437](#2437))
([d301b20](d301b20))
* add resource snowflake_user_password_policy_attachment
([#2162](#2162))
([#2307](#2307))
([93af462](93af462))
* create a workaround for granting privileges on all pipes
([#2477](#2477))
([64f2346](64f2346))
* Handle IMPORTED PRIVILEGES privileges in privilege-to-role granting
resources
([#2471](#2471))
([eb20051](eb20051))
* use external functions
([#2454](#2454))
([417d473](417d473))
* use funcs from sdk
([#2462](#2462))
([a5f969c](a5f969c))
* use sdk for procedures
([#2450](#2450))
([94ac78a](94ac78a))
* Use sdk in table constraint resource
([#2466](#2466))
([d685603](d685603))
* Use tables from SDK
([#2453](#2453))
([fdb4f88](fdb4f88))


## 🔧 **Misc**

* Add migration notes to the docs and change jira integration
([#2497](#2497))
([b17f1af](b17f1af))
* Change email and issue reporter
([#2470](#2470))
([5865655](5865655))
* Grants migration guide
([#2455](#2455))
([62c70fd](62c70fd))
* Remove unused old implementation from snowflake pkg
([#2458](#2458))
([2d0e508](2d0e508))
* update password policy attachment
([#2485](#2485))
([6ec9ff7](6ec9ff7))


## 🐛 **Bug fixes**

* allow DT warehouse to be updated in-place
([#2439](#2439))
([d565af1](d565af1))
* correct test dependencies
([#2493](#2493))
([dfb247f](dfb247f))
* FileFormat not detecting changes correctly
([#2436](#2436))
([018bb74](018bb74))
* Fix few smaller issues
([#2507](#2507))
([a836871](a836871))
* Fix functions and small other fixes
([#2503](#2503))
([0d4aba4](0d4aba4)),
closes
[#2490](#2490)
* Fix tag tests in view and in materialized view
([#2457](#2457))
([2de942a](2de942a))
* Fix task related issues
([#2479](#2479))
([0385650](0385650))
* Fix tests that base on default data retention
([#2465](#2465))
([682e28c](682e28c))
* grant privileges to share test terraform dependencies
([#2473](#2473))
([ede8d95](ede8d95))
* parameter issues
([#2463](#2463))
([7ee4986](7ee4986))
* parse dynamic table query from DDL
([#2438](#2438))
([d76815c](d76815c))
* Remove title and body temporarily from jira integration
([#2499](#2499))
([672c97d](672c97d))
* SHOW GRANTS mapping for share data type
([#2508](#2508))
([feb4d44](feb4d44))
* user error handling
([#2486](#2486))
([dfa52b2](dfa52b2))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: snowflake-release-please[bot] <105954990+snowflake-release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants