Crie uma tabela do MaxCompute.
Sintaxe
{
"Type": "ALIYUN::MaxCompute::Table",
"Properties": {
"Comment": String,
"Project": String,
"IfNotExists": Boolean,
"Lifecycle": Number,
"Schema": Map,
"StringSchema": String,
"Name": String
}
}
Propriedades
|
Propriedade |
Tipo |
Obrigatória |
Editável |
Descrição |
Restrição |
|
Comment |
String |
Não |
Não |
Comentário da tabela. |
Nenhuma |
|
Project |
String |
Sim |
Não |
Nome do projeto. |
Se você não especifique esse parâmetro, o sistema usará o projeto padrão. |
|
IfNotExists |
Boolean |
Não |
Não |
Defina se o sistema deve retornar um erro quando já existir uma tabela com o mesmo nome. |
Se você não especifique esse parâmetro, o sistema retornará um erro ao detectar uma tabela com nome duplicado. Se você especifique esse parâmetro, nenhuma falha ocorrerá, independentemente da existência prévia de outra tabela com o mesmo nome. Ao criar uma tabela com o nome de uma já existente, a nova tabela não será criada e os metadados da tabela original permanecerão inalterados. |
|
Lifecycle |
Number |
Não |
Não |
Ciclo de vida da tabela. |
Nenhuma |
|
Schema |
Map |
Não |
Não |
Schema da tabela. |
Para obter mais informações, consulte Propriedades de Schema. |
|
StringSchema |
String |
Não |
Não |
Schema que define nomes e tipos de campos como strings. |
Nenhuma |
|
Name |
String |
Sim |
Não |
Nome da tabela. |
O nome deve ter de 1 a 128 caracteres e pode conter letras, dígitos e sublinhados (_). |
Sintaxe de Schema
"Schema": {
"Partitions": List,
"Columns": List
}
Propriedades de Schema
|
Propriedade |
Tipo |
Obrigatória |
Editável |
Descrição |
Restrição |
|
Partitions |
List |
Não |
Não |
Partições da tabela. |
Para obter mais informações, consulte Propriedades de Partitions. |
|
Columns |
List |
Sim |
Não |
Colunas da tabela. |
Para obter mais informações, consulte Propriedades de Columns. |
Sintaxe de Partitions
"Partitions": [
{
"Comment": String,
"Type": String,
"Name": String
}
]
Propriedades de Partitions
|
Propriedade |
Tipo |
Obrigatória |
Editável |
Descrição |
Restrição |
|
Comment |
String |
Não |
Não |
Comentário da partição. |
Nenhuma |
|
Type |
String |
Sim |
Não |
Tipo da partição. |
Nenhuma |
|
Name |
String |
Sim |
Não |
Nome da partição. |
Nenhuma |
Sintaxe de Columns
"Columns": [
{
"Comment": String,
"Type": String,
"Name": String
}
]
Propriedades de Columns
|
Propriedade |
Tipo |
Obrigatória |
Editável |
Descrição |
Restrição |
|
Comment |
String |
Não |
Não |
Comentário da coluna. |
Nenhuma |
|
Type |
String |
Sim |
Não |
Tipo da coluna. |
Nenhuma |
|
Name |
String |
Sim |
Não |
Nome da coluna. |
Nenhuma |
Parâmetros de resposta
Fn::GetAtt
Project: nome do projeto.
Name: nome da tabela.
Exemplos
Formato JSON
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"Comment": {
"Type": "String",
"Description": "Table comment"
},
"Project": {
"Type": "String",
"Description": "Project name, if not provided, will be the default project"
},
"IfNotExists": {
"Type": "Boolean",
"Description": "If you create a table by using the name of an existing table and \nthe parameter set to false, an error is returned. \nIf you specify the if not exists parameter, a success message \nis returned when you create a table by using the name of an \nexisting table. The success message is returned even if the \nschema of the existing table is different from that of the table you want to create. \nIf you create a table by using the name of an existing table, \nthe table is not created and the metadata of the existing table is not changed.",
"AllowedValues": [
"True",
"true",
"False",
"false"
]
},
"Lifecycle": {
"Type": "Number",
"Description": "Table's lifecycle."
},
"Schema": {
"Type": "Json",
"Description": "Table schema"
},
"StringSchema": {
"Type": "String",
"Description": "Create a table with field names and field type strings.\nExample: 'num bigint, num2 double', 'pt string'"
},
"Name": {
"Type": "String",
"Description": "Table name",
"AllowedPattern": "[A-Za-z0-9_]{1,128}"
}
},
"Resources": {
"Table": {
"Type": "ALIYUN::MaxCompute::Table",
"Properties": {
"Comment": {
"Ref": "Comment"
},
"Project": {
"Ref": "Project"
},
"IfNotExists": {
"Ref": "IfNotExists"
},
"Lifecycle": {
"Ref": "Lifecycle"
},
"Schema": {
"Ref": "Schema"
},
"StringSchema": {
"Ref": "StringSchema"
},
"Name": {
"Ref": "Name"
}
}
}
},
"Outputs": {
"Project": {
"Description": "Project name",
"Value": {
"Fn::GetAtt": [
"Table",
"Project"
]
}
},
"Name": {
"Description": "Table name",
"Value": {
"Fn::GetAtt": [
"Table",
"Name"
]
}
}
}
}
Formato YAML
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
Comment:
Description: Table comment
Type: String
IfNotExists:
AllowedValues:
- 'True'
- 'true'
- 'False'
- 'false'
Description: "If you create a table by using the name of an existing table and\
\ \nthe parameter set to false, an error is returned. \nIf you specify the if\
\ not exists parameter, a success message \nis returned when you create a table\
\ by using the name of an \nexisting table. The success message is returned\
\ even if the \nschema of the existing table is different from that of the table\
\ you want to create. \nIf you create a table by using the name of an existing\
\ table, \nthe table is not created and the metadata of the existing table is\
\ not changed."
Type: Boolean
Lifecycle:
Description: Table's lifecycle.
Type: Number
Name:
AllowedPattern: '[A-Za-z0-9_]{1,128}'
Description: Table name
Type: String
Project:
Description: Project name, if not provided, will be the default project
Type: String
Schema:
Description: Table schema
Type: Json
StringSchema:
Description: 'Create a table with field names and field type strings.
Example: ''num bigint, num2 double'', ''pt string'''
Type: String
Resources:
Table:
Properties:
Comment:
Ref: Comment
IfNotExists:
Ref: IfNotExists
Lifecycle:
Ref: Lifecycle
Name:
Ref: Name
Project:
Ref: Project
Schema:
Ref: Schema
StringSchema:
Ref: StringSchema
Type: ALIYUN::MaxCompute::Table
Outputs:
Name:
Description: Table name
Value:
Fn::GetAtt:
- Table
- Name
Project:
Description: Project name
Value:
Fn::GetAtt:
- Table
- Project