Skip to content

Commit

Permalink
feat: Rework schema datasource (#2954)
Browse files Browse the repository at this point in the history
<!-- Feel free to delete comments as you fill this in -->
Rework schema datasource:
- add acceptance tests
- add entry to the migration guide
<!-- summary of changes -->

## Test Plan
<!-- detail ways in which this PR has been tested or needs to be tested
-->
* [x] acceptance tests

## References
<!-- issues documentation links, etc  -->
https://docs.snowflake.com/en/sql-reference/sql/show-schemas
  • Loading branch information
sfc-gh-jmichalak authored Jul 24, 2024
1 parent 1582a9f commit f70e40e
Show file tree
Hide file tree
Showing 18 changed files with 1,096 additions and 71 deletions.
11 changes: 10 additions & 1 deletion MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ across different versions.

## v0.93.0 ➞ v0.94.0

### *(breaking change)* refactored snowflake_schemas datasource
Changes:
- `database` is removed and can be specified inside `in` field.
- `like`, `in`, `starts_with`, and `limit` fields enable filtering.
- SHOW SCHEMAS output is enclosed in `show_output` field inside `schemas`.
- Added outputs from **DESC SCHEMA** and **SHOW PARAMETERS IN SCHEMA** (they can be turned off by declaring `with_describe = false` and `with_parameters = false`, **they're turned on by default**).
The additional parameters call **DESC SCHEMA** (with `with_describe` turned on) and **SHOW PARAMETERS IN SCHEMA** (with `with_parameters` turned on) **per schema** returned by **SHOW SCHEMAS**.
The outputs of both commands are held in `schemas` entry, where **DESC SCHEMA** is saved in the `describe_output` field, and **SHOW PARAMETERS IN SCHEMA** in the `parameters` field.
It's important to limit the records and calls to Snowflake to the minimum. That's why we recommend assessing which information you need from the data source and then providing strong filters and turning off additional fields for better plan performance.

### *(new feature)* new snowflake_account_role resource

Already existing `snowflake_role` was deprecated in favor of the new `snowflake_account_role`. The old resource got upgraded to
Expand Down Expand Up @@ -45,7 +55,6 @@ Added a new datasource enabling querying and filtering stremlits. Notes:
- `like`, `in`, and `limit` fields enable streamlits filtering.
- SHOW STREAMLITS output is enclosed in `show_output` field inside `streamlits`.
- Output from **DESC STREAMLIT** (which can be turned off by declaring `with_describe = false`, **it's turned on by default**) is enclosed in `describe_output` field inside `streamlits`.
**DESC STREAMLIT** returns different properties based on the integration type. Consult the documentation to check which ones will be filled for which integration.
The additional parameters call **DESC STREAMLIT** (with `with_describe` turned on) **per streamlit** returned by **SHOW STREAMLITS**.
It's important to limit the records and calls to Snowflake to the minimum. That's why we recommend assessing which information you need from the data source and then providing strong filters and turning off additional fields for better plan performance.

Expand Down
Loading

0 comments on commit f70e40e

Please sign in to comment.