All Products
Search
Document Center

AnalyticDB:GetSparkWarehouseBatchSQL

Last Updated:Jul 01, 2026

Retrieves the execution results of a Spark SQL statement.

Operation description

  • Public endpoint of a region: adb.<region-id>.aliyuncs.com. Example: adb.ap-southeast-1.aliyuncs.com.

  • VPC endpoint of a region: adb-vpc.<region-id>.aliyuncs.com. Example: adb-vpc.ap-southeast-1.aliyuncs.com.

Note

If you encounter a 409 error when sending requests from China North 1 (Qingdao), China South 1 (Shenzhen), China South 3 (Guangzhou), or Hong Kong (China), contact technical support.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

adb:GetSparkWarehouseBatchSQL

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

QueryId

string

Yes

The execution ID of the Spark SQL statement.

sq2024123*****

DBClusterId

string

No

The cluster ID.

amv-uf6485635f***

Agency

string

No

The client name for auxiliary logging. The value is a meaningful string of up to 16 characters.

DMS

Response elements

Element

Type

Description

Example

object

The response struct.

RequestId

string

The request ID.

3D44EDA0-A9DC-580D-9B5A-019370C075F4

Data SparkBatchSQL

The returned data.

{'DBClusterId': 'amv-uf6485635fz852mn', 'Statements': [{'Code': 'show databases', 'State': 'FINISHED', 'StatementId': 'sq202501141001sh8e12e080006846-0000', 'Result': '+--------------------+n

Examples

Success response

JSON format

{
  "RequestId": "3D44EDA0-A9DC-580D-9B5A-019370C075F4",
  "Data": {
    "Uid": 0,
    "QuerySubmissionTime": 1723521767000,
    "Query": "SELECT * FROM db.tb",
    "QueryId": "sq172352176****",
    "Schema": "default",
    "QueryEndTime": 1723521767000,
    "DBClusterId": "amv-bp17s73f016****",
    "QueryState": "RUNNING",
    "Statements": [
      {
        "ResultUri": "oss://yourbucket/result.json",
        "EndTime": 1723521767000,
        "AppId": "s20240122jsdx****",
        "StatementId": "sq1723521767****-0001",
        "State": "RUNNING",
        "StartTime": 1723521767000,
        "Error": "table is not found",
        "Code": "SELECT 100",
        "Result": "+---+-----+\n|age| name|\n+---+-----+\n| 14|  Tom|\n| 23|Alice|\n+---+-----+"
      }
    ],
    "ErrMessage": "schema is not found",
    "QueryStartTime": 1723521767000,
    "ResourceGroupName": "spark_rg"
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 Spark.InvalidState The object of the operation is in an invalid state: %s The operation object is invalid.
400 Spark.InvalidParameter Invalid parameter value: %s Incorrect input parameter:%s.
403 Spark.Forbidden No permissions to access the resources: %s Insufficient permissions to access the related resources. Information that you want to access: %s.
404 Spark.ObjectNotFound The object is not found. More information: %s The target object does not exist. Associated information: %s.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.