CreateFormationCrawler

Updated at:
Copy as MD

Creates a Formation Crawler metadata discovery task in an ADB instance.

Operation description

Request description

  • This operation creates a Formation Crawler metadata discovery task in an AnalyticDB for MySQL instance.

  • The created task configuration is not executed immediately. You must call StartFormationCrawler to start the task.

  • The CrawlerInfo field is a JSON string that contains the core configuration information of the task, such as the target database name and data source type.

  • Note that some parameters, such as classifiers and frequency, require double JSON encoding.

  • The database name dbName is automatically converted to lowercase by the server.

  • schemaChangePolicy is required. You must provide both updateRule and deleteRule.

  • Use the RUN_ON_DEMAND scheduling mode to avoid unnecessary repeated scans.

  • Make sure that the product name is adb and the domain name format is adb.{regionId}.aliyuncs.com.

  • After the task is created, you must manually call StartFormationCrawler to trigger the first metadata discovery.

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:CreateFormationCrawler

none

*DBClusterLakeVersion

acs:adb:{#regionId}:{#accountId}:dbcluster/{#DBClusterId}

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID of the instance.

cn-beijing

CrawlerInfo

string

Yes

The JSON string that contains the complete configuration information of the crawler. This field is the core parameter. For more information about its internal JSON structure, see the CrawlerInfo structure definition section.

{ "sourceType": "OSSWAREHOUSE", "dbName": "your_target_db", "sourceInfo": { "ossSourceInfo": { "sourceMode": "WAREHOUSE", "ossLocations": ["oss://your-bucket/your-path/"], "exclusions": [], "inclusions": [] } }, "classifiers": ["csv"], "schemaChangePolicy": { "updateRule": "ONLY_ADD_COLUMN", "deleteRule": "IGNORE" }, "frequency": { "type": "monthly", "cron": "0+00+00+1+*+?+*" }, "configuration": "adb.crawler.csv.columns.specify.delimiter.char=auto\nadb.crawler.csv.columns.specify.quote.char=auto\n" }

DBClusterId

string

Yes

The ID of the ADB instance. This parameter specifies the resource-level scope of the operation.

am-bp*****

CrawlerInfo field details:

sourceType (String, required) The source type identifier. Set this parameter to OSSWAREHOUSE.

dbName (String, required) The name of the target database. The crawled table metadata is written to this database.

sourceInfo (Object, required) The source information container object. For the OSSWAREHOUSE type, this object must contain the ossSourceInfo child object. Otherwise, the validation fails.

  • sourceInfo.ossSourceInfo (Object, required) The specific configuration of the OSS source. This object contains the following fields:

    • sourceMode (String, required): The source mode. For OSSWAREHOUSE, set this parameter to WAREHOUSE.

    • ossLocations (List, required): The list of OSS paths. Each path must start with oss:// and end with /, such as oss://my-bucket/my-db/.

    • exclusions (List, optional): The list of path prefixes to exclude. Paths that match the prefixes are not crawled. If no path needs to be excluded, set this parameter to [].

    • inclusions (List, optional): The list of path prefixes to include. This parameter is used to limit the crawl scope. If no path needs to be included, set this parameter to [].

classifiers (List, required) The data format classifiers, which declare the file formats in the OSS location. Valid values: JSON, PARQUET, CSV, ORC, AVRO, and ICEBERG. The values are case-insensitive. If the value contains iceberg, the task is identified as the Iceberg subtype. If this parameter is left empty, set it to [] to automatically identify the format.

schemaChangePolicy (Object, required) The schema change policy object, which controls how table schema changes are handled during crawling.

  • updateRule (String, required): The schema update rule. Valid values:
    • UPDATE_SCHEMA_DEFINE: Fully updates the schema. This value supports adding columns and modifying column names or types. If necessary, the table is deleted and recreated.

    • ONLY_ADD_COLUMN: The default value. Only appends new columns without modifying or deleting existing columns.

    • IGNORE: Completely ignores schema changes and does not generate any DDL statements. For the OSSDataWarehouse type, partition changes are still processed.

  • deleteRule (String, optional): The schema deletion rule. In most cases, set this parameter to IGNORE.

frequency (Object, required) The scheduling frequency configuration. If the task is not executed on demand, the system verifies the validity of the cron expression and the frequency limits. This object contains the following fields:

  • type (String): The scheduling type, such as monthly, daily, or run_on_demand. For on-demand execution, set the cron parameter to an empty string ("").

  • cron (String): The cron expression.

configuration (Map, optional) The extended configuration parameters for crawling behavior.

  • adb.crawler.csv.columns.specify.delimiter.char Specifies the field delimiter for CSV files. Default value: auto, which indicates that the delimiter is automatically detected. Valid values: comma (,), tab (\t), vertical bar (|), semicolon (;), space, and auto. If the value is auto or not set, automatic detection is used. Otherwise, the first character of the configured string is used as the delimiter.

  • adb.crawler.csv.columns.specify.quote.char Specifies the quote character for field values, which is used to wrap values that contain special characters. Default value: auto, which indicates that the quote character is automatically detected. Valid values: double quotation mark ("), single quotation mark ('), and auto. The behavior is the same as that of the delimiter. If the value is auto or not set, automatic detection is used. Otherwise, the first character is used.

  • adb.crawler.csv.columns.specify.header.mode Specifies the header identification method. Default value: HASHEAD. Valid values: DETECTHEAD (detection mode, which automatically determines whether the first row is a header), HASHEAD (the first row is the column names), and NOHEAD (no header, and column names are automatically generated by the system).

  • adb.crawler.csv.columns.specify.header.columns Specifies the header column names manually. Separate multiple column names with commas (,), such as id,name,age. Default value: an empty string, which indicates that no column names are specified and the system processes the header based on the header.mode parameter.

  • adb.crawler.csv.columns.allow.single.column Specifies whether to allow the identification of CSV files that contain only a single field. Default value: false, which indicates that single-column files are not allowed. Valid values: true and false.

Response elements

Element

Type

Description

Example

object

HttpStatusCode

integer

The HTTP status code. A value of 200 indicates success.

200

Data

boolean

Indicates whether the request was processed successfully.

True

RequestId

string

The request tracking ID.

019F3BE7-E8FA-3DC5-8EE7-501A90B5A54D

Success

boolean

Indicates whether the call was successful. Valid values:

  • true: The call was successful.

  • false: The call failed.

True

Code

string

The status code.

200

Message

string

The returned message. The value is OK if the request is successful.

OK

TaskId

string

The operation result. A value of true indicates that the task was created successfully.

241

Examples

Success response

JSON format

{
  "HttpStatusCode": 200,
  "Data": true,
  "RequestId": "019F3BE7-E8FA-3DC5-8EE7-501A90B5A54D",
  "Success": true,
  "Code": "200",
  "Message": "OK",
  "TaskId": "241"
}

Error codes

HTTP status code

Error code

Error message

Description

409 AlreadyExists The formation task already exists.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.