Creating a Session
Function
Create a SQL session on an endpoint.
This API is synchronous. There are no accompanying APIs or specific scenarios.
Calling Method
For details, see Calling APIs.
URI
POST /v2/workspaces/{workspace_id}/aura-sessions
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| workspace_id | Yes | String | Definition: Workspace ID. For details about how to obtain the workspace ID, see Obtaining a Workspace ID. Constraints: N/A Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed. Default Value: N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition: User token. It is obtained by calling the Obtaining an IAM User Token API. Constraints: N/A Range: N/A Default Value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| endpoint_name | Yes | String | Definition: Endpoint name. Constraints: N/A Range: 1 to 128 characters. Only letters, digits, periods (.), underscores (_), hyphens (-), and spaces are allowed. Default Value: N/A |
| agency_name | No | String | Definition: Agency name. Constraints: For details, see Configuring an Aura Agency. Range: N/A Default Value: N/A |
| catalog_context | Yes | CatalogContext object | Definition: LakeFormation information. Constraints: N/A Range: N/A Default Value: N/A |
| wait_timeout | No | Integer | Definition: Waiting time for creating a session, in seconds. Constraints: N/A Range: 300 to 86,400. Default Value: N/A |
| max_retry_times | No | Integer | Definition: Number of retry attempts when resources are insufficient. Constraints: N/A Range: 1 to 2,147,483,647. Default Value: N/A |
| priority | No | Integer | Definition: Priority. The value range is 1 to 9, where 9 indicates the highest priority. Constraints: N/A Range: 1 to 9. Default Value: 5 |
| cpu | No | Long | Definition: CPU resources of the compute node (CN) specified for the session, in millicores. Constraints: Optional. If not passed, the global configuration getCnCpuLimit is used as the fallback. This field is not consumed in INNER_SESSION/maintenance statement scenarios, where the resource specification is inherited from the parent session CN. The upper limit is 48,000 millicores (48 cores). Values exceeding this limit will result in a 400 INVALID_PARAMETER error. Range: (0, 48,000] millicores. Default Value: If not passed, the global configuration fallback value (for example, 4,000 millicores) is used. |
| memory | No | Long | Definition: Memory resources of the compute node (CN) specified for the session, in MB. Constraints: Optional. If not passed, the global configuration getCnMemoryLimit is used as the fallback. This field is not consumed in INNER_SESSION/maintenance statement scenarios, where the resource specification is inherited from the parent session CN. The upper limit is 393,216 MB (384 GB). Values exceeding this limit will result in a 400 INVALID_PARAMETER error. Range: (0, 393,216] MB. Default Value: If not passed, the global configuration fallback value (for example, 16,384 MB) is used. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| session_id | String | Definition: Session ID. Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed. |
| status | String | Definition: Session status. Range |
| cpu | Integer | Definition: CPU resource size (millicores). |
| memory | Integer | Definition: Memory resource size (MB). |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 4,096 characters. |
| solution_msg | String | Definition: Solution description. Range: 2 to 4,096 characters. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 4,096 characters. |
| solution_msg | String | Definition: Solution description. Range: 2 to 4,096 characters. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 4,096 characters. |
| solution_msg | String | Definition: Solution description. Range: 2 to 4,096 characters. |
Status code: 404
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 4,096 characters. |
| solution_msg | String | Definition: Solution description. Range: 2 to 4,096 characters. |
Status code: 408
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 4,096 characters. |
| solution_msg | String | Definition: Solution description. Range: 2 to 4,096 characters. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 4,096 characters. |
| solution_msg | String | Definition: Solution description. Range: 2 to 4,096 characters. |
Example Requests
Request example for creating a SQL session in a specified workspace and endpoint.
POST /v2/workspaces/{workspace_id}/aura-sessions
{
"endpoint_name" : "aura_endpoint",
"catalog_context" : {
"catalog_name" : "catalog_default"
}
} Example Responses
Status code: 200
{
"session_id" : "ac8111bf-3601-4905-8ddd-b41d3e636a4e",
"status" : "RUNNING"
} Status code: 400
{
"error_code" : "AIDataLake.00092031",
"error_msg" : "Invalid parameter name",
"solution_msg" : "Please enter parameters in the correct format."
} Status code: 401
{
"error_code" : "APIG.1002",
"error_msg" : "Incorrect token or token resolution failed.",
"solution_msg" : "Please obtain a valid token and retry."
} Status code: 403
{
"error_code" : "AIDataLake.00090030",
"error_msg" : "Unauthorized requests.",
"solution_msg" : "Check permissions and retry after authorization."
} Status code: 404
{
"error_code" : "AIDataLake.00090009",
"error_msg" : "The resource does not exists.",
"solution_msg" : "Please try to use correct info."
} Status code: 408
{
"error_code" : "common.00000408",
"error_msg" : "A timeout exception occurred.",
"solution_msg" : "The request timed out while waiting for a response — check the backend service status and network, then retry; if the operation is long-running, increase the client timeout or split the request."
} Status code: 500
{
"error_code" : "common.00000500",
"error_msg" : "internal error",
"solution_msg" : "An internal service error occurred. Please retry later; if the problem persists, contact technical support."
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Request succeeded. |
| 400 | Invalid request. |
| 401 | Unauthorized. |
| 403 | Request denied. |
| 404 | The requested resource could not be found. |
| 408 | Request timeout. |
| 500 | Internal server error. |
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot