【问题标题】:How to define PRIMARY KEY in azure cosmosdb arm template如何在 azure cosmosdb arm 模板中定义主键
【发布时间】:2021-01-31 00:05:57
【问题描述】:

是否可以在 azure cosmosdb cassandra arm 模板中定义 PRIMARY 键?

假设我有下一张桌子:

CREATE TABLE foo
(
 id text
 name test
 PRIMARY KEY (id)
)

还有我的 ARM 模板:

"schema":{
 "columns":[
   {
   "name":"id",
   "type":"text"
   }   
  ],
  "partitionKeys":[
    {"name":"id"} // how to define primary key ?
 }

【问题讨论】:

    标签: azure cassandra azure-cosmosdb arm-template azure-cosmosdb-cassandra-api


    【解决方案1】:

    Cassandra 中的主键由一个或多个分区列以及零个或多个集群列组成。在 ARM 模板中,它们被定义为 partitionKeysclusterKeys 对象数组。以下是来自documentation 的示例:

    "partitionKeys": [
        { "name": "machine" },
        { "name": "cpu" },
        { "name": "mtime" }
    ],
    "clusterKeys": [
        {
          "name": "loadid",
          "orderBy": "asc"
        }
    ]
    
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多