简体   繁体   中英

Adding unique constraint in Kusto tables

I have recently started working on Kusto, I am struggling to find out how we can add unique constraint in any kusto table as I used to do in Mysql.

Suppose I have created a table in kusto.

.create table Mytable( Time:datetime, NoOfOperations: long);

If it was a sql table, I can easily define to add a unique key, I am unable to find out something k like this in kusto. Tried searching on kusto documents but couldn't find.

ALTER TABLE MyTable
ADD UNIQUE (Time);

Any help is highly appreciated..

In Kusto, tables don't have the traditional primary/unique keys. To create a new table with unique Time values from the table MyTable , you could try the following:

.make-unique Mytable
| where Time != ""
| project Time

or you could use the summarize operator to group the data by Time and retrieve the first value:

. summarize arg_min(Time, *) by Time
| project Time

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM