From 74272c3353741721dd3d5d08e24e6622d2d07d9d Mon Sep 17 00:00:00 2001 From: Tony Stanfel Date: Fri, 11 Nov 2022 09:15:26 -0700 Subject: [PATCH 1/3] Adding warehouse type for snowpark optimized warehouses --- docs/resources/warehouse.md | 1 + pkg/resources/warehouse.go | 12 ++++++++++++ pkg/snowflake/warehouse.go | 1 + 3 files changed, 14 insertions(+) diff --git a/docs/resources/warehouse.md b/docs/resources/warehouse.md index 96aea0dfb5..b18c245937 100644 --- a/docs/resources/warehouse.md +++ b/docs/resources/warehouse.md @@ -45,6 +45,7 @@ resource "snowflake_warehouse" "warehouse" { - `tag` (Block List, Deprecated) Definitions of a tag to associate with the resource. (see [below for nested schema](#nestedblock--tag)) - `wait_for_provisioning` (Boolean) Specifies whether the warehouse, after being resized, waits for all the servers to provision before executing any queued or new queries. - `warehouse_size` (String) Specifies the size of the virtual warehouse. Larger warehouse sizes 5X-Large and 6X-Large are currently in preview and only available on Amazon Web Services (AWS). +- `warehouse_type` (String) Specifies a STANDARD or SNOWPARK-OPTIMIZED warehouse. SNOWPARK-OPTIMIZED warehouses are not supported on XSMall or SMALL warehouse sizes and do not support query acceleration. ### Read-Only diff --git a/pkg/resources/warehouse.go b/pkg/resources/warehouse.go index 60902340b0..efc2436ee5 100644 --- a/pkg/resources/warehouse.go +++ b/pkg/resources/warehouse.go @@ -19,6 +19,7 @@ var warehouseProperties = []string{ "scaling_policy", "auto_suspend", "auto_resume", "resource_monitor", "max_concurrency_level", "statement_queued_timeout_in_seconds", "statement_timeout_in_seconds", "enable_query_acceleration", "query_acceleration_max_scale_factor", + "warehouse_type" } var warehouseSchema = map[string]*schema.Schema{ @@ -134,6 +135,13 @@ var warehouseSchema = map[string]*schema.Schema{ ValidateFunc: validation.IntBetween(0, 100), Description: "Specifies the maximum scale factor for leasing compute resources for query acceleration. The scale factor is used as a multiplier based on warehouse size.", }, + "warehouse_type": { + Type: schema.TypeString, + Optional: true, + Default: "STANDARD", + ValidateFunc: validation.StringInSlice([]string{"STANDARD", "SNOWPARK-OPTIMIZED"}, true), + Description: "Specifies a STANDARD or SNOWPARK-OPTIMIZED warehouse", + }, "tag": tagReferenceSchema, } @@ -228,6 +236,10 @@ func ReadWarehouse(d *schema.ResourceData, meta interface{}) error { if err != nil { return err } + err = d.Set("warehouse_type", w.WarehouseType) + if err != nil { + return err + } stmt = warehouseBuilder.ShowParameters() paramRows, err := snowflake.Query(db, stmt) diff --git a/pkg/snowflake/warehouse.go b/pkg/snowflake/warehouse.go index 0134033ea8..e9b8eefad6 100644 --- a/pkg/snowflake/warehouse.go +++ b/pkg/snowflake/warehouse.go @@ -86,6 +86,7 @@ type warehouse struct { Suspended int64 `db:"suspended"` UUID string `db:"uuid"` ScalingPolicy string `db:"scaling_policy"` + WarehouseType string `db:"warehouse_type"` } // warehouseParams struct to represent a row of parameters. From 0564c065e34520797d64e6aac05a8737e03b1e4f Mon Sep 17 00:00:00 2001 From: Anthony Stanfel <16292951+astanfel@users.noreply.github.com> Date: Wed, 7 Dec 2022 10:01:13 -0700 Subject: [PATCH 2/3] Update warehouse.go --- pkg/resources/warehouse.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/resources/warehouse.go b/pkg/resources/warehouse.go index efc2436ee5..44bc2feabd 100644 --- a/pkg/resources/warehouse.go +++ b/pkg/resources/warehouse.go @@ -19,7 +19,7 @@ var warehouseProperties = []string{ "scaling_policy", "auto_suspend", "auto_resume", "resource_monitor", "max_concurrency_level", "statement_queued_timeout_in_seconds", "statement_timeout_in_seconds", "enable_query_acceleration", "query_acceleration_max_scale_factor", - "warehouse_type" + "warehouse_type", } var warehouseSchema = map[string]*schema.Schema{ From 8e16fb2a9c6ad4323f25e71df5f29f01fb86c130 Mon Sep 17 00:00:00 2001 From: Tony Stanfel Date: Wed, 7 Dec 2022 11:37:14 -0700 Subject: [PATCH 3/3] Running make docs --- docs/resources/warehouse.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/resources/warehouse.md b/docs/resources/warehouse.md index b18c245937..4137481f9c 100644 --- a/docs/resources/warehouse.md +++ b/docs/resources/warehouse.md @@ -45,7 +45,7 @@ resource "snowflake_warehouse" "warehouse" { - `tag` (Block List, Deprecated) Definitions of a tag to associate with the resource. (see [below for nested schema](#nestedblock--tag)) - `wait_for_provisioning` (Boolean) Specifies whether the warehouse, after being resized, waits for all the servers to provision before executing any queued or new queries. - `warehouse_size` (String) Specifies the size of the virtual warehouse. Larger warehouse sizes 5X-Large and 6X-Large are currently in preview and only available on Amazon Web Services (AWS). -- `warehouse_type` (String) Specifies a STANDARD or SNOWPARK-OPTIMIZED warehouse. SNOWPARK-OPTIMIZED warehouses are not supported on XSMall or SMALL warehouse sizes and do not support query acceleration. +- `warehouse_type` (String) Specifies a STANDARD or SNOWPARK-OPTIMIZED warehouse ### Read-Only