.create ingestion mapping.create ingestion mapping

创建与特定表和特定格式相关联的引入映射。Creates an ingestion mapping that is associated with a specific table and a specific format.

语法Syntax

.create table TableName ingestion MappingKind mapping MappingName MappingFormattedAsJson .create table TableName ingestion MappingKind mapping MappingName MappingFormattedAsJson

备注

  • 创建映射后,可在引入命令中按名称引用映射,而不必将完整映射指定为命令的一部分。Once created, the mapping can be referenced by its name in ingestion commands, instead of specifying the complete mapping as part of the command.
  • MappingKind 的有效值为:CSVJSONavroparquetorcValid values for MappingKind are: CSV, JSON, avro, parquet, and orc
  • 如果该表已经存在相同名称的映射:If a mapping by the same name already exists for the table:
    • .create 将失败.create will fail
    • .create-or-alter 将更改现有映射.create-or-alter will alter the existing mapping

示例Example

.create table MyTable ingestion csv mapping "Mapping1"
'['
'   { "column" : "rownumber", "DataType":"int", "Properties":{"Ordinal":"0"}},'
'   { "column" : "rowguid", "DataType":"string", "Properties":{"Ordinal":"1"}}'
']'

.create-or-alter table MyTable ingestion json mapping "Mapping1"
'['
'    { "column" : "rownumber", "datatype" : "int", "Properties":{"Path":"$.rownumber"}},'
'    { "column" : "rowguid", "Properties":{"Path":"$.rowguid"}}'
']'

示例输出Example output

名称Name 种类Kind 映射Mapping
mapping1mapping1 CSVCSV [{"Name":"rownumber","DataType":"int","CsvDataType":null,"Ordinal":0,"ConstValue":null},{"Name":"rowguid","DataType":"string","CsvDataType":null,"Ordinal":1,"ConstValue":null}]

后续步骤Next steps

有关引入映射的详细信息,请参阅数据映射For more information about ingestion mapping, see Data mappings.