CreateFormationCrawler
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
StartFormationCrawlerto start the task.The
CrawlerInfofield 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
classifiersandfrequency, require double JSON encoding.The database name
dbNameis automatically converted to lowercase by the server.schemaChangePolicyis required. You must provide bothupdateRuleanddeleteRule.Use the
RUN_ON_DEMANDscheduling mode to avoid unnecessary repeated scans.Make sure that the product name is
adband the domain name format isadb.{regionId}.aliyuncs.com.After the task is created, you must manually call
StartFormationCrawlerto trigger the first metadata discovery.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
adb:CreateFormationCrawler |
none |
*DBClusterLakeVersion
|
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 asoss://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, orrun_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.charSpecifies 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.charSpecifies 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.modeSpecifies 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.columnsSpecifies 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.columnSpecifies 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 |
| 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.