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

feat: Adding warehouse type for snowpark optimized warehouses #1369

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
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