# SQL执行
"SQL执行"节点用于执行SQL语句，当前版本仅支持查询语句（SELECT）。
#### 前提条件
已[构建工作流](https://support.huaweicloud.com/usermanual-dataartsplatform/dataartsplatform_02_0027.html)。
#### 配置SQL执行节点
1. 在工作流编排画布中，单击"添加节点"按钮，从节点列表中选择"SQL执行"，即可将该节点添加至当前工作流编排画布中。 
   图1添加SQL执行节点   
   ![](https://support.huaweicloud.com/usermanual-dataartsplatform/figure/zh-cn_image_0000002741149459.png "点击放大")
   
   
2. 单击"SQL执行"节点，在弹出的节点详情页面中进行参数配置，参考[表1]。
   
   图2SQL执行节点配置   
   ![](https://support.huaweicloud.com/usermanual-dataartsplatform/figure/zh-cn_image_0000002712949691.png "点击放大")
    表1SQL执行节点配置 
   | **参数名称** | **参数说明**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | **示例**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
   |:---|:---|:---|
   | 数据连接  | "SQL执行"节点需指定数据源，支持以下两种配置方式： - 手动选择：从数据源列表中直接选择某个数据源。  - 引用参数：选择当前工作流中某前置节点的输出参数作为数据源，该参数内容须为数据源的ID。                                                                                                                                                                                                           | 引用参数 sys.query(String) sys.files(Array)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
   | 输入       | 用户可自定义"SQL执行"节点的输入参数，并在SQL语句中引用这些参数。 - 新增参数：单击右侧的![](https://support.huaweicloud.com/usermanual-dataartsplatform/figure/zh-cn_image_0000002683118750.png)按钮，可新增输入参数。  - 删除参数：单击对应参数右侧的![](https://support.huaweicloud.com/usermanual-dataartsplatform/figure/zh-cn_image_0000002712838475.png)按钮，可删除该参数。   | - 名称：limit  - 类型：Integer  - 引用/值：10                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
   | SQL     | 用户在文本框中输入SQL语句内容，可通过${inputName}的方式在SQL语句中引用已定义的输入参数，其中*inputName*为参数的名称。SQL语句最大支持65535个字符。                                                                                                                                                                                                                                                                                                                                                                                                                                                             | **参数替换规则** 1. 整个SQL语句将作为一个整体参数进行处理。  2. [SQL简单参数替换规则]（为确保安全性）。   **一维数组参数替换规则** - 仅适用于SQL中的IN和VALUE子句场景。  - 转换结果为数组所有元素使用逗号（,）分隔。  - 数组中每个元素的转换规则与第2条规则相同。                                                                                                                                                                                                                                                                                                                              |
   | 输出     | - record_count：返回结果的总条数。  - cell_data：返回的查询结果数据，格式类似于表格。                                                                                                                                                                                                                                                                                         | ``` { "cell_data": { "headers": [ { "id": "wwb_sale_internal", "caption": "wwb_sale_internal", "name": "wwb_sale_internal", "data_type": "STRING", "level_type": null, "model_type": "COLUMN", "format": null }, { "id": "order_date", "caption": "order_date", "name": "order_date", "data_type": "DATE", "level_type": "ymdLevel", "model_type": "COLUMN", "format": null }, { "id": "category", "caption": "category", "name": "category", "data_type": "STRING", "level_type": null, "model_type": "COLUMN", "format": null }, { "id": "region", "caption": "region", "name": "region", "data_type": "STRING", "level_type": null, "model_type": "COLUMN", "format": null }, { "id": "quantity", "caption": "quantity", "name": "quantity", "data_type": "NUMBER", "level_type": null, "model_type": "COLUMN", "format": null }, { "id": "sales_amount", "caption": "sales_amount", "name": "sales_amount", "data_type": "NUMBER", "level_type": null, "model_type": "COLUMN", "format": null } ], "cell_values": [ ["SALE_20260701_001", "2026-07-01", "电子产品", "华南", 5, 1299.50] ], "cell_raw_values": [ ["SALE_20260701_001", "2026-07-01", "电子产品", "华南", 5, 1299.50] ] } } ``` |
      
    表2SQL简单参数替换规则 
   | 参数类型      | 替换规则                           | 示例                                                                   |
   |:---|:---|:---|
   | 空值（None） | 替换为null                       | -                                                                    |
   | 布尔类型      | 替换为True/False                   | -                                                                    |
   | 整数类型    | 替换为数字字面量                       | 10 → 10                                                                |
   | 浮点类型     | 替换为数字字面量                       | 100 → 100.0 10.134 → 10.134 |
   | 字符串类型  | 替换为英文单引号括住的字符串                 | 123 → '123'                                                           |
   | 其他类型      | 强制使用Python的str()函数转换为字符串，转换结果未知 | -                                                                     |
      
   
   
3. 单击上方的"保存"。
 
