How to define PRIMARY KEY in azure cosmosdb arm template

is it possible to define PRIMARY key in azure cosmosdb cassandra arm template ?

Let's say I have next table:

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

And my ARM template:

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

Upvotes: 1

Views: 319

Answers (1)

Alex Ott
Alex Ott

Reputation: 87154

Primary key in Cassandra consists of one or more partition columns, and zero or more clustering columns. In ARM templates they are defined as partitionKeys and clusterKeys arrays of objects. Here is the example from documentation:

"partitionKeys": [
    { "name": "machine" },
    { "name": "cpu" },
    { "name": "mtime" }
],
"clusterKeys": [
    {
      "name": "loadid",
      "orderBy": "asc"
    }
]

Upvotes: 2

Related Questions