diff --git a/connection.go b/connection.go index aa26e8532..5503363f3 100644 --- a/connection.go +++ b/connection.go @@ -64,7 +64,6 @@ type snowflakeConn struct { cfg *Config rest *snowflakeRestful SequenceCounter uint64 - QueryID string SQLState string telemetry *snowflakeTelemetry internal InternalClient @@ -158,7 +157,6 @@ func (sc *snowflakeConn) exec( sc.cfg.Schema = data.Data.FinalSchemaName sc.cfg.Role = data.Data.FinalRoleName sc.cfg.Warehouse = data.Data.FinalWarehouseName - sc.QueryID = data.Data.QueryID sc.SQLState = data.Data.SQLState sc.populateSessionParameters(data.Data.Parameters) return data, err @@ -282,7 +280,7 @@ func (sc *snowflakeConn) ExecContext( return &snowflakeResult{ affectedRows: updatedRows, insertID: -1, - queryID: sc.QueryID, + queryID: data.Data.QueryID, }, nil // last insert id is not supported by Snowflake } else if isMultiStmt(&data.Data) { return sc.handleMultiExec(ctx, data.Data) @@ -353,7 +351,7 @@ func (sc *snowflakeConn) queryContextInternal( rows := new(snowflakeRows) rows.sc = sc - rows.queryID = sc.QueryID + rows.queryID = data.Data.QueryID if isMultiStmt(&data.Data) { // handleMultiQuery is responsible to fill rows with childResults diff --git a/multistatement.go b/multistatement.go index c8b13e21d..ce9d9910b 100644 --- a/multistatement.go +++ b/multistatement.go @@ -78,7 +78,7 @@ func (sc *snowflakeConn) handleMultiExec( return &snowflakeResult{ affectedRows: updatedRows, insertID: -1, - queryID: sc.QueryID, + queryID: data.QueryID, }, nil } diff --git a/rows_test.go b/rows_test.go index bf414f825..0d8fbc11c 100644 --- a/rows_test.go +++ b/rows_test.go @@ -460,6 +460,7 @@ func TestWithArrowBatchesNotImplementedForResult(t *testing.T) { if err != nil { t.Error(err) } + defer sc.Close() if err = authenticateWithConfig(sc); err != nil { t.Error(err) } @@ -474,12 +475,6 @@ func TestWithArrowBatchesNotImplementedForResult(t *testing.T) { t.Error(err) } - result.(*snowflakeResult).GetStatus() - queryID := result.(*snowflakeResult).GetQueryID() - if queryID != sc.QueryID { - t.Fatalf("failed to get query ID") - } - _, err = result.(*snowflakeResult).GetArrowBatches() if err == nil { t.Fatal("should have raised an error")