Skip to content

Commit

Permalink
fix: warehouse import when auto_suspend is set to null (#1092)
Browse files Browse the repository at this point in the history
* Warehouse.AutoSuspend int64 => sql.nullInt64

* fix warehouse read

Co-authored-by: Scott Winkler <[email protected]>
  • Loading branch information
Ezequiel Moreno and sfc-gh-swinkler authored Jul 1, 2022
1 parent 7b5bf00 commit 9dc748f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion pkg/resources/warehouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func ReadWarehouse(d *schema.ResourceData, meta interface{}) error {
if err != nil {
return err
}
err = d.Set("auto_suspend", w.AutoSuspend)
err = d.Set("auto_suspend", w.AutoSuspend.Int64)
if err != nil {
return err
}
Expand Down
58 changes: 29 additions & 29 deletions pkg/snowflake/warehouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,35 +55,35 @@ func Warehouse(name string) *WarehouseBuilder {
// warehouse is a go representation of a grant that can be used in conjunction
// with github.com/jmoiron/sqlx
type warehouse struct {
Name string `db:"name"`
State string `db:"state"`
Type string `db:"type"`
Size string `db:"size"`
MinClusterCount int64 `db:"min_cluster_count"`
MaxClusterCount int64 `db:"max_cluster_count"`
StartedClusters int64 `db:"started_clusters"`
Running int64 `db:"running"`
Queued int64 `db:"queued"`
IsDefault string `db:"is_default"`
IsCurrent string `db:"is_current"`
AutoSuspend int64 `db:"auto_suspend"`
AutoResume bool `db:"auto_resume"`
Available string `db:"available"`
Provisioning string `db:"provisioning"`
Quiescing string `db:"quiescing"`
Other string `db:"other"`
CreatedOn time.Time `db:"created_on"`
ResumedOn time.Time `db:"resumed_on"`
UpdatedOn time.Time `db:"updated_on"`
Owner string `db:"owner"`
Comment string `db:"comment"`
ResourceMonitor string `db:"resource_monitor"`
Actives int64 `db:"actives"`
Pendings int64 `db:"pendings"`
Failed int64 `db:"failed"`
Suspended int64 `db:"suspended"`
UUID string `db:"uuid"`
ScalingPolicy string `db:"scaling_policy"`
Name string `db:"name"`
State string `db:"state"`
Type string `db:"type"`
Size string `db:"size"`
MinClusterCount int64 `db:"min_cluster_count"`
MaxClusterCount int64 `db:"max_cluster_count"`
StartedClusters int64 `db:"started_clusters"`
Running int64 `db:"running"`
Queued int64 `db:"queued"`
IsDefault string `db:"is_default"`
IsCurrent string `db:"is_current"`
AutoSuspend sql.NullInt64 `db:"auto_suspend"`
AutoResume bool `db:"auto_resume"`
Available string `db:"available"`
Provisioning string `db:"provisioning"`
Quiescing string `db:"quiescing"`
Other string `db:"other"`
CreatedOn time.Time `db:"created_on"`
ResumedOn time.Time `db:"resumed_on"`
UpdatedOn time.Time `db:"updated_on"`
Owner string `db:"owner"`
Comment string `db:"comment"`
ResourceMonitor string `db:"resource_monitor"`
Actives int64 `db:"actives"`
Pendings int64 `db:"pendings"`
Failed int64 `db:"failed"`
Suspended int64 `db:"suspended"`
UUID string `db:"uuid"`
ScalingPolicy string `db:"scaling_policy"`
}

// warehouseParams struct to represent a row of parameters
Expand Down

0 comments on commit 9dc748f

Please sign in to comment.