Skip to content

Commit

Permalink
feat: Adding warehouse type for snowpark optimized warehouses (#1369)
Browse files Browse the repository at this point in the history
* Adding warehouse type for snowpark optimized warehouses

* Update warehouse.go

* Running make docs

Co-authored-by: Tony Stanfel <[email protected]>
  • Loading branch information
astanfel and astanfel authored Dec 7, 2022
1 parent 500d6cf commit b5bedf9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/resources/warehouse.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

### Read-Only

Expand Down
12 changes: 12 additions & 0 deletions pkg/resources/warehouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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,
}

Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions pkg/snowflake/warehouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b5bedf9

Please sign in to comment.