All Products
Search
Document Center

AnalyticDB:ExecuteSparkWarehouseBatchSQL

Last Updated:Nov 10, 2025

Executes Spark SQL statements in batches.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
adb:ExecuteSparkWarehouseBatchSQLnone
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
AgencystringNo

The name of the client.

DataWorks
DBClusterIdstringYes

The cluster ID.

amv-bp11q28kvl688****
ResourceGroupNamestringYes

The name of the resource group.

test
QuerystringYes

The SQL statements that you want to execute in batches. Separate multiple SQL statements with semicolons (;). The execution engine executes the SQL statements in sequence in the same session.

CREATE TABLE user(id INT, name STRING); INSERT INTO t VALUE(1, 'Bob'); SELECT * FROM t;
SchemastringNo

The name of the database.

adb_demo
ExecuteResultLimitlongNo

The maximum amount of execution result data that can be written to Object Storage Service (OSS). Unit: MB. Default value: 4096. The size of compressed objects is difficult to estimate. The data that is actually written to OSS is smaller than the specified value.

4096
ExecuteTimeLimitInSecondslongNo

The maximum execution duration. Unit: seconds. If a set of SQL statements fail to be executed for the specified period of time after submission, they are marked as a timeout error. The default value is 360000 seconds, which is equivalent to 100 hours.

3600000
RuntimeConfigstringNo

The additional runtime parameter. Specify the parameter in the JSON format.

{ "OSSURL": "oss://testBucketname/" }

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The request ID.

CBE843D8-964D-5EA3-9D31-822125611B6E
DataSparkBatchSQL

The returned data.

true

Examples

Sample success responses

JSONformat

{
  "RequestId": "CBE843D8-964D-5EA3-9D31-822125611B6E",
  "Data": {
    "QueryId": "sq172352176****",
    "QueryState": "RUNNING",
    "QuerySubmissionTime": 1723521767000,
    "QueryStartTime": 1723521767000,
    "QueryEndTime": 1723521767000,
    "Schema": "default",
    "Uid": 0,
    "DBClusterId": "amv-bp17s73f016****",
    "ResourceGroupName": "spark_rg",
    "Query": "SELECT * FROM db.tb",
    "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"
  }
}

Error codes

HTTP status codeError codeError messageDescription
400Spark.InvalidParameterInvalid parameter value: %sIncorrect input parameter:%s.
400Spark.InvalidStateThe object of the operation is in an invalid state: %sThe operation object is invalid.
404Spark.ObjectNotFoundThe object is not found. More information: %s-
500Spark.ServerErrorThe Spark control component system encountered an error, please create a ticket to solve the problem or concat the supported engineer on duty. Error message: %sAn error occurred on the Spark control component system. Submit a ticket or contact technical support.

For a list of error codes, visit the Service error codes.