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

chore: apply minor database changes #2872

Merged
merged 6 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ All the field changes in comparison to the previous database resource are:
- `from_share` - the parameter was moved to the dedicated resource for databases created from shares `snowflake_shared_database`. Right now, it's a text field instead of a map. Additionally, instead of legacy account identifier format we're expecting the new one that with share looks like this: `<organization_name>.<account_name>.<share_name>`. For more information on account identifiers, visit the [official documentation](https://docs.snowflake.com/en/user-guide/admin-account-identifier).
- p,
- `from_replication` - the parameter was moved to the dedicated resource for databases created from primary databases `snowflake_secondary_database`
- `replication_configuration` - renamed: was renamed to `configuration` and is only available in the `snowflake_database`. Its internal schema changed that instead of list of accounts, we expect a list of nested objects with accounts for which replication (and optionally failover) should be enabled. More information about converting between both versions [here](#resource-renamed-snowflake_database---snowflake_database_old). Additionally, instead of legacy account identifier format we're expecting the new one that looks like this: `<organization_name>.<account_name>`. For more information on account identifiers, visit the [official documentation](https://docs.snowflake.com/en/user-guide/admin-account-identifier).
- `replication_configuration` - renamed: was renamed to `configuration` and is only available in the `snowflake_database`. Its internal schema changed that instead of list of accounts, we expect a list of nested objects with accounts for which replication (and optionally failover) should be enabled. More information about converting between both versions [here](#resource-renamed-snowflake_database---snowflake_database_old). Additionally, instead of legacy account identifier format we're expecting the new one that looks like this: `<organization_name>.<account_name>` (it will be automatically migrated to the recommended format by the state upgrader). For more information on account identifiers, visit the [official documentation](https://docs.snowflake.com/en/user-guide/admin-account-identifier).
sfc-gh-asawicki marked this conversation as resolved.
Show resolved Hide resolved
- `data_retention_time_in_days`
- in `snowflake_shared_database`
- removed: the field is removed from `snowflake_shared_database` as it doesn't have any effect on shared databases.
Expand Down Expand Up @@ -160,7 +160,8 @@ The only difference would be that instead of writing/generating new configuratio
- Additional filtering options added (`limit`).
- Added missing fields returned by SHOW DATABASES.
- Added outputs from **DESC DATABASE** and **SHOW PARAMETERS IN DATABASE** (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 DATABASE** (with `with_describe` turned on) and **SHOW PARAMETERS IN DATABASE** (with `with_parameters` turned on) **per database** returned by **SHOW DATABASES**.
The additional parameters call **DESC DATABASE** (with `with_describe` turned on) and **SHOW PARAMETERS IN DATABASE** (with `with_parameters` turned on) **per database** returned by **SHOW DATABASES**.
The outputs of both commands are held in `databases` entry, where **DESC DATABASE** is saved in the `describe_output` field, and **SHOW PARAMETERS IN DATABASE** 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.

## v0.89.0 ➞ v0.90.0
Expand Down
210 changes: 206 additions & 4 deletions docs/data-sources/databases.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ output "limit_output" {

# Without additional data (to limit the number of calls make for every found database)
data "snowflake_databases" "only_show" {
# with_describe is turned on by default and it calls DESCRIBE DATABASE for every database found and attaches its output to databases.*.description field
# with_describe is turned on by default and it calls DESCRIBE DATABASE for every database found and attaches its output to databases.*.describe_output field
with_describe = false

# with_parameters is turned on by default and it calls SHOW PARAMETERS FOR DATABASE for every database found and attaches its output to databases.*.parameters field
Expand Down Expand Up @@ -122,7 +122,7 @@ Read-Only:

- `comment` (String)
- `created_on` (String)
- `description` (List of Object) (see [below for nested schema](#nestedobjatt--databases--description))
- `describe_output` (List of Object) (see [below for nested schema](#nestedobjatt--databases--describe_output))
- `is_current` (Boolean)
- `is_default` (Boolean)
- `is_transient` (Boolean)
Expand All @@ -136,8 +136,8 @@ Read-Only:
- `resource_group` (String)
- `retention_time` (Number)

<a id="nestedobjatt--databases--description"></a>
### Nested Schema for `databases.description`
<a id="nestedobjatt--databases--describe_output"></a>
### Nested Schema for `databases.describe_output`

Read-Only:

Expand All @@ -151,6 +151,208 @@ Read-Only:

Read-Only:

- `catalog` (List of Object) (see [below for nested schema](#nestedobjatt--databases--parameters--catalog))
- `data_retention_time_in_days` (List of Object) (see [below for nested schema](#nestedobjatt--databases--parameters--data_retention_time_in_days))
- `default_ddl_collation` (List of Object) (see [below for nested schema](#nestedobjatt--databases--parameters--default_ddl_collation))
- `enable_console_output` (List of Object) (see [below for nested schema](#nestedobjatt--databases--parameters--enable_console_output))
- `external_volume` (List of Object) (see [below for nested schema](#nestedobjatt--databases--parameters--external_volume))
- `log_level` (List of Object) (see [below for nested schema](#nestedobjatt--databases--parameters--log_level))
- `max_data_extension_time_in_days` (List of Object) (see [below for nested schema](#nestedobjatt--databases--parameters--max_data_extension_time_in_days))
- `quoted_identifiers_ignore_case` (List of Object) (see [below for nested schema](#nestedobjatt--databases--parameters--quoted_identifiers_ignore_case))
- `replace_invalid_characters` (List of Object) (see [below for nested schema](#nestedobjatt--databases--parameters--replace_invalid_characters))
- `storage_serialization_policy` (List of Object) (see [below for nested schema](#nestedobjatt--databases--parameters--storage_serialization_policy))
- `suspend_task_after_num_failures` (List of Object) (see [below for nested schema](#nestedobjatt--databases--parameters--suspend_task_after_num_failures))
- `task_auto_retry_attempts` (List of Object) (see [below for nested schema](#nestedobjatt--databases--parameters--task_auto_retry_attempts))
- `trace_level` (List of Object) (see [below for nested schema](#nestedobjatt--databases--parameters--trace_level))
- `user_task_managed_initial_warehouse_size` (List of Object) (see [below for nested schema](#nestedobjatt--databases--parameters--user_task_managed_initial_warehouse_size))
- `user_task_minimum_trigger_interval_in_seconds` (List of Object) (see [below for nested schema](#nestedobjatt--databases--parameters--user_task_minimum_trigger_interval_in_seconds))
- `user_task_timeout_ms` (List of Object) (see [below for nested schema](#nestedobjatt--databases--parameters--user_task_timeout_ms))

<a id="nestedobjatt--databases--parameters--catalog"></a>
### Nested Schema for `databases.parameters.catalog`

Read-Only:

- `default` (String)
- `description` (String)
- `key` (String)
- `level` (String)
- `value` (String)


<a id="nestedobjatt--databases--parameters--data_retention_time_in_days"></a>
### Nested Schema for `databases.parameters.data_retention_time_in_days`

Read-Only:

- `default` (String)
- `description` (String)
- `key` (String)
- `level` (String)
- `value` (String)


<a id="nestedobjatt--databases--parameters--default_ddl_collation"></a>
### Nested Schema for `databases.parameters.default_ddl_collation`

Read-Only:

- `default` (String)
- `description` (String)
- `key` (String)
- `level` (String)
- `value` (String)


<a id="nestedobjatt--databases--parameters--enable_console_output"></a>
### Nested Schema for `databases.parameters.enable_console_output`

Read-Only:

- `default` (String)
- `description` (String)
- `key` (String)
- `level` (String)
- `value` (String)


<a id="nestedobjatt--databases--parameters--external_volume"></a>
### Nested Schema for `databases.parameters.external_volume`

Read-Only:

- `default` (String)
- `description` (String)
- `key` (String)
- `level` (String)
- `value` (String)


<a id="nestedobjatt--databases--parameters--log_level"></a>
### Nested Schema for `databases.parameters.log_level`

Read-Only:

- `default` (String)
- `description` (String)
- `key` (String)
- `level` (String)
- `value` (String)


<a id="nestedobjatt--databases--parameters--max_data_extension_time_in_days"></a>
### Nested Schema for `databases.parameters.max_data_extension_time_in_days`

Read-Only:

- `default` (String)
- `description` (String)
- `key` (String)
- `level` (String)
- `value` (String)


<a id="nestedobjatt--databases--parameters--quoted_identifiers_ignore_case"></a>
### Nested Schema for `databases.parameters.quoted_identifiers_ignore_case`

Read-Only:

- `default` (String)
- `description` (String)
- `key` (String)
- `level` (String)
- `value` (String)


<a id="nestedobjatt--databases--parameters--replace_invalid_characters"></a>
### Nested Schema for `databases.parameters.replace_invalid_characters`

Read-Only:

- `default` (String)
- `description` (String)
- `key` (String)
- `level` (String)
- `value` (String)


<a id="nestedobjatt--databases--parameters--storage_serialization_policy"></a>
### Nested Schema for `databases.parameters.storage_serialization_policy`

Read-Only:

- `default` (String)
- `description` (String)
- `key` (String)
- `level` (String)
- `value` (String)


<a id="nestedobjatt--databases--parameters--suspend_task_after_num_failures"></a>
### Nested Schema for `databases.parameters.suspend_task_after_num_failures`

Read-Only:

- `default` (String)
- `description` (String)
- `key` (String)
- `level` (String)
- `value` (String)


<a id="nestedobjatt--databases--parameters--task_auto_retry_attempts"></a>
### Nested Schema for `databases.parameters.task_auto_retry_attempts`

Read-Only:

- `default` (String)
- `description` (String)
- `key` (String)
- `level` (String)
- `value` (String)


<a id="nestedobjatt--databases--parameters--trace_level"></a>
### Nested Schema for `databases.parameters.trace_level`

Read-Only:

- `default` (String)
- `description` (String)
- `key` (String)
- `level` (String)
- `value` (String)


<a id="nestedobjatt--databases--parameters--user_task_managed_initial_warehouse_size"></a>
### Nested Schema for `databases.parameters.user_task_managed_initial_warehouse_size`

Read-Only:

- `default` (String)
- `description` (String)
- `key` (String)
- `level` (String)
- `value` (String)


<a id="nestedobjatt--databases--parameters--user_task_minimum_trigger_interval_in_seconds"></a>
### Nested Schema for `databases.parameters.user_task_minimum_trigger_interval_in_seconds`

Read-Only:

- `default` (String)
- `description` (String)
- `key` (String)
- `level` (String)
- `value` (String)


<a id="nestedobjatt--databases--parameters--user_task_timeout_ms"></a>
### Nested Schema for `databases.parameters.user_task_timeout_ms`

Read-Only:

- `default` (String)
- `description` (String)
- `key` (String)
Expand Down
2 changes: 1 addition & 1 deletion examples/data-sources/snowflake_databases/data-source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ output "limit_output" {

# Without additional data (to limit the number of calls make for every found database)
data "snowflake_databases" "only_show" {
# with_describe is turned on by default and it calls DESCRIBE DATABASE for every database found and attaches its output to databases.*.description field
# with_describe is turned on by default and it calls DESCRIBE DATABASE for every database found and attaches its output to databases.*.describe_output field
with_describe = false

# with_parameters is turned on by default and it calls SHOW PARAMETERS FOR DATABASE for every database found and attaches its output to databases.*.parameters field
Expand Down
Loading
Loading