From 6673c52b0b7ea636fc58d6066ffdc055de9692ff Mon Sep 17 00:00:00 2001 From: rekodus <64546401+rekodus@users.noreply.github.com> Date: Thu, 5 May 2022 02:52:46 +0200 Subject: [PATCH] Update apiDefinition.swagger.json (#1575) Adapted to Snowflake API V2 --- .../Snowflake/apiDefinition.swagger.json | 678 +++++++++--------- 1 file changed, 350 insertions(+), 328 deletions(-) diff --git a/custom-connectors/Snowflake/apiDefinition.swagger.json b/custom-connectors/Snowflake/apiDefinition.swagger.json index d711cc4ac..0b8804b93 100644 --- a/custom-connectors/Snowflake/apiDefinition.swagger.json +++ b/custom-connectors/Snowflake/apiDefinition.swagger.json @@ -2,11 +2,11 @@ "swagger": "2.0", "info": { "title": "Snowflake REST", - "description": "Snowflake connector based on Snowflake REST API (private preview)", + "description": "Snowflake connector based on Snowflake REST API (private preview) for Snowflake API V2", "version": "1.0" }, - "host": "YourInstance.snowflakecomputing.com", - "basePath": "/api/statements", + "host": "uniper.west-europe.azure.snowflakecomputing.com", + "basePath": "/api/v2/statements", "schemes": [ "https" ], @@ -27,199 +27,146 @@ ], "responses": { "200": { - "description": "Success operation", + "description": "The statement was executed successfully, and the response includes any data requested.", "x-ms-summary": "Message", "schema": { "type": "object", "properties": { - "resultSetMetaData": { - "type": "object", - "properties": { - "page": { - "type": "integer", - "format": "int32", - "description": "page" - }, - "pageSize": { - "type": "integer", - "format": "int32", - "description": "pageSize" - }, - "numPages": { - "type": "integer", - "format": "int32", - "description": "numPages" - }, - "numRows": { - "type": "integer", - "format": "int32", - "description": "numRows" - }, - "format": { - "type": "string", - "description": "format" - }, - "rowType": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": true - }, - "description": "rowType" - } - }, - "description": "resultSetMetaData" - }, - "data": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": true - }, - "description": "data" - }, "code": { "type": "string", - "description": "code" - }, - "statementStatusUrl": { - "type": "string", - "description": "statementStatusUrl" + "example": "000123" }, "sqlState": { "type": "string", - "description": "sqlState" - }, - "statementHandle": { - "type": "string", - "description": "statementHandle" + "example": "42601" }, "message": { "type": "string", - "description": "message" + "example": "successfully executed" + }, + "statementHandle": { + "type": "string", + "example": "536fad38-b564-4dc5-9892-a4543504df6c" }, "createdOn": { "type": "integer", "format": "int32", - "description": "createdOn" - } - } - } - }, - "202": { - "description": "Asynchronous execution in progress. Use provided query id to perform query monitoring and management.", - "x-ms-summary": "Message", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "code" - }, - "message": { - "type": "string", - "description": "message" - }, - "statementHandle": { - "type": "string", - "description": "statementHandle" + "description": "Timestamp that specifies when the statement execution started. The timestamp is expressed in milliseconds since the epoch", + "example": 1597090533987 }, "statementStatusUrl": { "type": "string", - "description": "statementStatusUrl" - } - } - } - }, - "400": { - "description": "Incoming request does not contain a valid payload.", - "x-ms-summary": "Message", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "code" + "example": "/api/v2/statements/536fad38-b564-4dc5-9892-a4543504df6c" }, - "message": { - "type": "string", - "description": "message" - } - } - } - }, - "401": { - "description": "Invalid OAuth access token", - "x-ms-summary": "Message", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "code" + "resultSetMetaData": { + "type": "object", + "properties": { + "format": { + "type": "string", + "enum": [ + "jsonv2" + ], + "description": "For v2 endpoints the only possible value for this field is jsonv2.", + "example": "jsonv2" + }, + "rowType": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "nullable": { + "type": "boolean" + } + }, + "additionalProperties": true + } + } + } }, - "message": { - "type": "string", - "description": "message" - } - } - } - }, - "405": { - "description": "Unsupported HTTP method.", - "x-ms-summary": "Message", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "code" + "partitionInfo": { + "description": "Partition information", + "type": "array", + "minItems": 0, + "items": { + "type": "object", + "properties": { + "rowCount": { + "type": "integer", + "format": "int64", + "description": "Number of rows in the partition.", + "minimum": 0, + "example": 1324 + }, + "compressedSize": { + "type": "integer", + "format": "int64", + "description": "the partition size before the decompression. This may or may not be present in the partitionInfo. Uncompressed size would always be there.", + "minimum": 0, + "example": 37436824 + }, + "uncompressedSize": { + "type": "integer", + "format": "int64", + "description": "the partition size after the decompression", + "minimum": 0, + "example": 1343787384 + } + } + } }, - "message": { - "type": "string", - "description": "message" - } - } - } - }, - "422": { - "description": "SQL compilation error.", - "x-ms-summary": "Message", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "code" + "nullable": { + "description": "false if null is replaced with a string 'null' otherwise false", + "type": "boolean" }, - "message": { - "type": "string", - "description": "message" + "data": { + "description": "Result set data.", + "type": "array", + "minItems": 0, + "items": { + "type": "object", + "additionalProperties": true + } }, - "sqlState": { - "type": "string", - "description": "sqlState" - }, - "statementHandle": { - "type": "string", - "description": "statementHandle" - } - } - } - }, - "429": { - "description": "Too many concurrent requests.", - "x-ms-summary": "Message", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "code" - }, - "message": { - "type": "string", - "description": "message" + "stats": { + "type": "object", + "description": "these stats might not be available for each request.", + "properties": { + "numRowsInserted": { + "type": "integer", + "format": "int64", + "description": "Number of rows that were inserted.", + "minimum": 0, + "example": 12 + }, + "numRowsUpdated": { + "type": "integer", + "format": "int64", + "description": "Number of rows that were updated.", + "minimum": 0, + "example": 9 + }, + "numRowsDeleted": { + "type": "integer", + "format": "int64", + "description": "Number of rows that were deleted.", + "minimum": 0, + "example": 8 + }, + "numDuplicateRowsUpdated": { + "type": "integer", + "format": "int64", + "description": "Number of duplicate rows that were updated.", + "minimum": 0, + "example": 20 + } + } } } } @@ -279,20 +226,41 @@ "required": true, "x-ms-visibility": "internal" }, + { + "name": "requestId", + "in": "query", + "type": "string", + "required": false, + "x-ms-visibility": "advanced" + }, + { + "name": "async", + "in": "query", + "type": "boolean", + "default": false, + "x-ms-visibility": "advanced" + }, + { + "name": "nullable", + "in": "query", + "type": "boolean", + "default": false, + "x-ms-visibility": "advanced" + }, { "name": "body", "in": "body", - "required": false, + "required": true, "schema": { "type": "object", "properties": { "statement": { "type": "string", - "description": "statement" + "description": "The SQL statement to be executed - batches of statements not yet supported" }, "timeout": { "type": "integer", - "format": "int32", + "default": 60, "description": "timeout", "x-ms-visibility": "advanced" }, @@ -311,33 +279,75 @@ "role": { "type": "string", "description": "role" + }, + "bindings": { + "description": "Values of bind variables in the SQL statement. When executing the statement, Snowflake replaces placeholders ('?' and ':name') in the statement with these specified values.", + "type": "object", + "properties": {}, + "x-ms-visibility": "advanced" + }, + "parameters": { + "description": "Session parameters that should be set before executing the statement.", + "type": "object", + "properties": { + "timezone": { + "description": "Time zone to use when executing the statement.", + "type": "string", + "example": "america/los_angeles" + }, + "query_tag": { + "description": "Query tag that you want to associate with the SQL statement.", + "type": "string", + "example": "tag-1234" + }, + "binary_output_format": { + "description": "Output format for binary values.", + "type": "string", + "example": "HEX" + }, + "date_output_format": { + "description": "Output format for DATE values.", + "type": "string", + "example": "YYYY-MM-DD" + }, + "time_output_format": { + "description": "Output format for TIME values.", + "type": "string", + "example": "HH24:MI:SS.FF6" + }, + "timestamp_output_format": { + "description": "Output format for TIMESTAMP values.", + "type": "string", + "example": "YYYY-MM-DDTHH24:MI:SS.FF6" + }, + "timestamp_ltz_output_format": { + "description": "Output format for TIMESTAMP_LTZ values.", + "type": "string", + "example": "YYYY-MM-DDTHH24:MI:SS.FF6" + }, + "timestamp_ntz_output_format": { + "description": "Output format for TIMESTAMP_NTZ values.", + "type": "string", + "example": "YYYY-MM-DDTHH24:MI:SS.FF6" + }, + "timestamp_tz_output_format": { + "description": "Output format for TIMESTAMP_TZ values.", + "type": "string", + "example": "YYYY-MM-DDTHH24:MI:SS.FF6 TZHTZM" + }, + "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, + "default": 1 + } + }, + "x-ms-visibility": "advanced" } } } - }, - { - "name": "async", - "in": "query", - "type": "boolean", - "default": false, - "x-ms-visibility": "advanced" - }, - { - "name": "requestId", - "in": "query", - "type": "string", - "required": false, - "x-ms-visibility": "advanced" - }, - { - "name": "pageSize", - "in": "query", - "type": "string", - "required": false, - "x-ms-visibility": "advanced" } - ], - "x-ms-visibility": "important" + ] } }, "/{statementHandle}": { @@ -349,114 +359,151 @@ "schema": { "type": "object", "properties": { - "resultSetMetaData": { - "type": "object", - "properties": { - "page": { - "type": "integer", - "format": "int32", - "description": "page" - }, - "numPages": { - "type": "integer", - "format": "int32", - "description": "numPages" - }, - "numRows": { - "type": "integer", - "format": "int32", - "description": "numRows" - }, - "format": { - "type": "string", - "description": "format" - }, - "rowType": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": true - }, - "description": "rowType" - } - }, - "description": "resultSetMetaData" - }, - "data": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": true - }, - "description": "data" + "code": { + "type": "string", + "example": "000123" }, "sqlState": { "type": "string", - "description": "sqlState" - }, - "statementHandle": { - "type": "string", - "description": "statementHandle" - }, - "statementStatusUrl": { - "type": "string" + "example": "42601" }, "message": { "type": "string", - "description": "message" + "example": "successfully executed" }, - "code": { + "statementHandle": { "type": "string", - "description": "code" + "example": "536fad38-b564-4dc5-9892-a4543504df6c" }, "createdOn": { "type": "integer", "format": "int32", - "description": "createdOn" + "description": "Timestamp that specifies when the statement execution started. The timestamp is expressed in milliseconds since the epoch", + "example": 1597090533987 + }, + "statementStatusUrl": { + "type": "string", + "example": "/api/v2/statements/536fad38-b564-4dc5-9892-a4543504df6c" + }, + "resultSetMetaData": { + "type": "object", + "properties": { + "format": { + "type": "string", + "enum": [ + "jsonv2" + ], + "description": "For v2 endpoints the only possible value for this field is jsonv2.", + "example": "jsonv2" + }, + "rowType": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "nullable": { + "type": "boolean" + } + }, + "additionalProperties": true + } + } + } + }, + "partitionInfo": { + "description": "Partition information", + "type": "array", + "minItems": 0, + "items": { + "type": "object", + "properties": { + "rowCount": { + "type": "integer", + "format": "int64", + "description": "Number of rows in the partition.", + "minimum": 0, + "example": 1324 + }, + "compressedSize": { + "type": "integer", + "format": "int64", + "description": "the partition size before the decompression. This may or may not be present in the partitionInfo. Uncompressed size would always be there.", + "minimum": 0, + "example": 37436824 + }, + "uncompressedSize": { + "type": "integer", + "format": "int64", + "description": "the partition size after the decompression", + "minimum": 0, + "example": 1343787384 + } + } + } + }, + "nullable": { + "description": "false if null is replaced with a string 'null' otherwise false", + "type": "boolean" + }, + "data": { + "description": "Result set data.", + "type": "array", + "minItems": 0, + "items": { + "type": "object", + "additionalProperties": true + } + }, + "stats": { + "type": "object", + "description": "these stats might not be available for each request.", + "properties": { + "numRowsInserted": { + "type": "integer", + "format": "int64", + "description": "Number of rows that were inserted.", + "minimum": 0, + "example": 12 + }, + "numRowsUpdated": { + "type": "integer", + "format": "int64", + "description": "Number of rows that were updated.", + "minimum": 0, + "example": 9 + }, + "numRowsDeleted": { + "type": "integer", + "format": "int64", + "description": "Number of rows that were deleted.", + "minimum": 0, + "example": 8 + }, + "numDuplicateRowsUpdated": { + "type": "integer", + "format": "int64", + "description": "Number of duplicate rows that were updated.", + "minimum": 0, + "example": 20 + } + } } } } }, - "202": { + "default": { "description": "Asynchronous execution in progress. Use provided query id to perform query monitoring and management.", "x-ms-summary": "Message", "schema": { "type": "object", - "properties": { - "code": { - "type": "string", - "description": "code" - }, - "message": { - "type": "string", - "description": "message" - }, - "statementHandle": { - "type": "string", - "description": "statementHandle" - }, - "statementStatusUrl": { - "type": "string", - "description": "statementStatusUrl" - } - } - } - }, - "429": { - "description": "Too many concurrent requests.", - "x-ms-summary": "Message", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "code" - }, - "message": { - "type": "string", - "description": "message" - } - } + "additionalProperties": true } } }, @@ -488,11 +535,20 @@ "type": "string" }, { - "name": "page", + "name": "requestId", "in": "query", - "required": true, - "type": "integer", - "default": 0 + "type": "string", + "x-ms-visibility": "advanced" + }, + { + "name": "partition", + "in": "query", + "type": "integer" + }, + { + "name": "resultSetMetaData", + "in": "header", + "type": "string" } ] } @@ -529,46 +585,12 @@ } } }, - "422": { - "description": "Statement not found.", + "default": { + "description": "Asynchronous execution in progress. Use provided query id to perform query monitoring and management.", "x-ms-summary": "Message", "schema": { "type": "object", - "properties": { - "code": { - "type": "string", - "description": "code" - }, - "message": { - "type": "string", - "description": "message" - }, - "sqlState": { - "type": "string", - "description": "sqlState" - }, - "statementHandle": { - "type": "string", - "description": "statementHandle" - } - } - } - }, - "429": { - "description": "Too many concurrent requests.", - "x-ms-summary": "Message", - "schema": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "code" - }, - "message": { - "type": "string", - "description": "message" - } - } + "additionalProperties": true } } }, @@ -615,7 +637,7 @@ "type": "oauth2", "flow": "accessCode", "authorizationUrl": "https://login.windows.net/common/oauth2/authorize", - "tokenUrl": "https://yourinstance.snowflakecomputing.com/oauth/token-request", + "tokenUrl": "https://uniper.west-europe.azure.snowflakecomputing.com/oauth/token-request", "scopes": {} } },