Skip to content

Commit

Permalink
SPC-39: MULTI_STATEMENT_COUNT parameter was being ignored (#6)
Browse files Browse the repository at this point in the history
* Update apiDefinition.swagger.json

- change parameter name case to match snowflake docs exactly

* add StatementHandles

Map new response property for multi-statement handling.

* Apply mappings to GetResults

Same statementHandles mapping that was previously added to ExecSql was applied to GetResults to support Async

* Remove async fixes

These changes are already in dev branch, it was just a temporary change for debugging.
  • Loading branch information
TobinWritesCode authored Sep 11, 2024
1 parent 3f2502e commit 7a33e8f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 9 additions & 1 deletion certified-connectors/Snowflake v2/apiDefinition.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@
"type": "string",
"description": "StatementHandle"
},
"StatementHandles": {
"type": "array",
"description": "StatementHandles from executing multiple statements"
},
"CreatedOn": {
"type": "string",
"description": "CreatedOn"
Expand Down Expand Up @@ -541,7 +545,7 @@
"example": "YYYY-MM-DDTHH24:MI:SS.FF6 TZHTZM",
"x-ms-summary": "timestamp tz output format"
},
"multi_statement_count": {
"MULTI_STATEMENT_COUNT": {
"description": "Number of statements to execute when using multi-statement capability. 0 implies variable number of statements. Negative numbers are not allowed.",
"type": "integer",
"example": 4,
Expand Down Expand Up @@ -723,6 +727,10 @@
"CreatedOn": {
"type": "string",
"description": "CreatedOn"
},
"StatementHandles": {
"type": "array",
"description": "StatementHandles from executing multiple statements"
}
},
"description": "Metadata"
Expand Down
5 changes: 5 additions & 0 deletions certified-connectors/Snowflake v2/script.csx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ public class Script : ScriptBase
Message = contentAsJson["message"]?.ToString(),
StatementStatusUrl = contentAsJson["statementStatusUrl"]?.ToString(),
StatementHandle = contentAsJson["statementHandle"]?.ToString(),
StatementHandles = contentAsJson["statementHandles"]?.Select(x => x.ToString()).ToArray(),
};

return new ConvertObjectResult()
Expand Down Expand Up @@ -339,6 +340,7 @@ public class Script : ScriptBase
RequestId = contentAsJson["requestId"].ToString(),
SqlState = contentAsJson["sqlState"].ToString(),
StatementHandle = contentAsJson["statementHandle"].ToString(),
StatementHandles = contentAsJson["statementHandles"]?.Select(x => x.ToString()).ToArray(),
CreatedOn = ConvertToUTC(contentAsJson["createdOn"].ToString(), TimeInterval.Milliseconds)
};

Expand Down Expand Up @@ -476,7 +478,10 @@ public class Script : ScriptBase

public string? StatementHandle { get; set; }

public string[]? StatementHandles { get; set; }

public string? CreatedOn { get; set; }

public string? Message { get; set; }
}

Expand Down

0 comments on commit 7a33e8f

Please sign in to comment.