ALIYUN::DMS::ScriptExecution

ALIYUN::DMS::ScriptExecution类型用于执行SQL脚本。

语法

{
  "Type": "ALIYUN::DMS::ScriptExecution",
  "Properties": {
    "DbId": Integer,
    "Logic": Boolean,
    "Script": String,
    "Tid": Integer
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

DbId

Integer

数据库 ID。

说明

该参数对应为 SearchDatabase - 搜索数据库详情列表、 ListDatabases - 获取实例的数据库详情列表、 GetDatabase - 获取具体库详情信息等接口中的 DatabaseId 参数,您可以调用这些接口获取。

Logic

Boolean

是否逻辑库。

Script

String

要执行的具体 SQL 脚本。

包括 DQL、DDL 和 DML,其中 DDL 和 DML 是否允许依赖于实例的安全管控配置。

Tid

Integer

租户 ID。

返回值

Fn::GetAtt

示例

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  Script:
    Type: String
    Description:
      en: The specific SQL script to execute. Includes DQL, DDL, and DML. Whether DDL and DML are allowed depends on the security configuration of the instance.
    Required: true
    Default: select dt from report_daily
  DbId:
    Type: Number
    Description:
      en: |-
        The database ID.
        > This parameter corresponds to the DatabaseId parameter in interfaces like SearchDatabase, ListDatabases, GetDatabase, etc. You can call these interfaces to obtain the value.
    Required: true
  Logic:
    Type: Boolean
    Description:
      en: Whether it is a logical database.
    Required: true
Resources:
  ScriptExecution:
    Type: ALIYUN::DMS::ScriptExecution
    Properties:
      Script:
        Ref: Script
      DbId:
        Ref: DbId
      Logic:
        Ref: Logic
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "Script": {
      "Type": "String",
      "Description": {
        "en": "The specific SQL script to execute. Includes DQL, DDL, and DML. Whether DDL and DML are allowed depends on the security configuration of the instance."
      },
      "Required": true,
      "Default": "select dt from report_daily"
    },
    "DbId": {
      "Type": "Number",
      "Description": {
        "en": "The database ID.\n> This parameter corresponds to the DatabaseId parameter in interfaces like SearchDatabase, ListDatabases, GetDatabase, etc. You can call these interfaces to obtain the value."
      },
      "Required": true
    },
    "Logic": {
      "Type": "Boolean",
      "Description": {
        "en": "Whether it is a logical database."
      },
      "Required": true
    }
  },
  "Resources": {
    "ScriptExecution": {
      "Type": "ALIYUN::DMS::ScriptExecution",
      "Properties": {
        "Script": {
          "Ref": "Script"
        },
        "DbId": {
          "Ref": "DbId"
        },
        "Logic": {
          "Ref": "Logic"
        }
      }
    }
  }
}