All Products
Search
Document Center

Quick BI:CreateCubeBySql

Last Updated:Jul 03, 2026

Creates a dataset based on a custom SQL statement.

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

quickbi-public:CreateCubeBySql

create

*All Resource

*

None None

Request syntax

POST  HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

CustomSql

string

Yes

The custom SQL statement.

select * from qqq

Caption

string

Yes

The name of the custom dataset.

test

DsId

string

Yes

The ID of the data source.

7AAB95D-*****-****-*4FC0C976

WorkspaceId

string

Yes

The workspace ID.

95296e95-ca89-4c7d-8af9-dedf0ad0****

UserId

string

Yes

The UserId of a Quick BI user who has permissions to create datasets. This is not your Alibaba Cloud account ID. You can call the QueryUserInfoByAccount operation to obtain the UserId.

asdaf-asda*****asd

Placeholders

string

No

The placeholder parameters. For more information, see the supplementary description below.

[ { "name": "test", "style": "placeholder", "type": "string" } ]

Placeholder PlaceholderModel structure

  • uniqueId -- string, optional. The unique ID of the placeholder. You do not need to specify this parameter when creating a dataset. Even if specified, it is not used. (This field is used during updates.)

  • name -- string, required. The placeholder name. Must be unique.

  • style -- string, required. The placeholder type.

    • Expression placeholder: param

    • Value placeholder: placeholder

    • Condition placeholder: condition

  • type -- String. The placeholder variable type.

    • Text: string

    • Numeric: number

    • Date: see the format description below

  • useInGlobal -- Boolean, optional. Specifies whether the placeholder takes effect globally. Default value: false.

    • Yes: true

    • No: false

  • defaultValue -- List, optional. The default value of the placeholder. The shipping_date_ph.get(0) placeholder type supports only 0 or 2 default values. Other placeholder types support only 0 or 1 default values.

  • format -- String, optional. The date type format. (See the format description below.)

  • originalType -- String, optional. If the value placeholder is a date type of shipping_date_ph.get(0), set originalType to dateRange. This parameter does not need to be set in other cases.

  • conditionPlaceHolderFields -- List, optional. The condition placeholder fields. Configure this parameter only for condition placeholders.

ConditionPlaceHolderFields structure

  • uniqueId -- String, optional. The unique ID of the condition placeholder field. You do not need to specify this parameter when creating a dataset. The system generates a value automatically.

  • column -- String, required. The physical field name.

Mapping between style and type for expression placeholders

Variable type ### Corresponding type value.

  • Text string

  • Numeric number

  • Date-Year yearRegion

  • Date-Year-Quarter quarterRegion

  • Date-Year-Month monthRegion

  • Date-Year-Week weekRegion

  • Date-Year-Month-Day dateRegion

  • Date-Year-Month-Day-Hour-Minute-Second ymdHmsRegion

Mapping between style, type, and format for value placeholders (blank means not required)

Variable type ### Corresponding type value ### format.

  • Text string (not supported for the shipping_date_ph.get(0) date type)

  • Numeric number (not supported for the shipping_date_ph.get(0) date type)

  • Date-Year yearRegion

  • Date-Year-Quarter quarterRegion

  • Date-Year-Month monthRegion Choose one of the following three formats: YYYY-MM, YYYYMM, or YYYY/MM

  • Date-Year-Week weekRegion

  • Date-Year-Month-Day dateRegion Choose one of the following three formats: YYYY-MM-DD, YYYYMMDD, or YYYY/MM/DD

  • Date-Year-Month-Day-Hour-Minute-Second ymdHmsRegion Choose one of the following four formats: YYYY-MM-DD HH:MI:SS, YYYYMMDD HH:MI:SS, YYYY/MM/DD HH:MI:SS, or YYYYMMDDHHMISS

Mapping between style and type for condition placeholders

Variable type ### Corresponding type value.

  • Text string.

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The request ID.

05739b************02522b9

Result

string

The execution result of the operation. Valid values:

  • true: The request was successful.

  • false: The request failed.

true

Success

boolean

Indicates whether the request was successful. Valid values:

  • true: The request was successful.

  • false: The request failed.

true

Examples

Success response

JSON format

{
  "RequestId": "05739b************02522b9",
  "Result": "true",
  "Success": true
}

Error codes

HTTP status code

Error code

Error message

Description

400 Internal.System.Error An internal system error occurred. An internal system error occurred.
400 Invalid.User.Organization The user is not in your organization. The user is not in your organization.
400 User.NotIn.Workspace The user is not in this workspace. The user is not in this workspace.
400 Invalid.Workspace The workspace is not owned by the organization.
400 Datasource.NotFound.Error The specified data source does not exist: %s. The specified data source does not exist: %s.
400 DatasourceId.IsNull.Error You must select a data source before selecting the table. You must select a data source before selecting the table.
400 Name.RegularExpression.Error Name format validation failed.
400 NameExceeded.MaxLength.Error The name cannot exceed %s characters in length. The name cannot be longer than% s characters.
400 Cube.DuplicatedName.Error The dataset name already exists. Modify the name before saving. The dataset name already exists. Modify the name before saving.
400 Directory.NotExist.Error The directory does not exist. The directory does not exist.
400 Xengnie.TaskExecute.Error Fail to execute task %s. Fail to execute task %s.
400 Datasource.Sql.ExecuteFailed Failed to execute the SQL statement in the data source.
400 Placeholder.Date.Illegal The placeholder date format is illegal. The placeholder date format is illegal.
400 Placeholder.DefaultValue.Invalid Invalid placeholder default value. Invalid placeholder default value.
400 Placeholder.FieldNot.Empty Condition placeHolder field not empty. Condition placeHolder field not empty.
400 Placeholder.Style.Illegal Illegal placeholder style. Illegal placeholder style.
400 Placeholder.Type.Illegal Illegal placeholder type. Illegal placeholder type.
400 Placeholder.UniqueId.Duplicate Sql placeholder uniqueId duplicate. Sql placeholder uniqueId duplicate.
400 PlaceholderName.Duplicate.Error Sql placeholder name duplicate. Sql placeholder name duplicate.
400 PlaceholderName.NotMatch.Error The parsing and input placeholder names do not match. The parsing and input placeholder names do not match

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.