Set permanent data in an Azure Data Explorer table

Viewed 398

I must be missing something basic, as this functionality seems so simple. I created a table in the Azure Data Explorer cluster I am working in,

.create table MyCows (CowName:string, CowType:string);

Now I want to enter data into that table that will always be there, even after my querying work is done, that data should persist in the table. I don't want to ingest it from somewhere else, I don't want to have to run a query to set the values each time I enter this cluster, I just want the data to persist in this table perpetually.

I just want to input 4 records to the table. "Bill", "Vanilla" "Bela", "Rum" "Clark", "Smooth" "Randy", "Chocolate"

How can I do this? I tried variations on 'let' such as

let MyCows = ["Bill", "Vanilla"]

and other variations without luck. The ingest command does not seem to be what I want either as that has to point to a file, but I'm not sure.

1 Answers

the following are perhaps the 2 simplest of options:

  1. using .ingest inline: https://docs.microsoft.com/en-us/azure/data-explorer/kusto/management/data-ingestion/ingest-inline

    • e.g.:
    .ingest inline into table T <|
    Bill,Vanilla
    Bela,Rum
    Clark,Smooth
    Randy,Chocolate
    
  2. using .set-or-append: https://docs.microsoft.com/en-us/azure/data-explorer/kusto/management/data-ingestion/ingest-from-query

    • e.g.:
    .set-or-append T <| 
       datatable(CowName:string, CowType:string)
       [
          "Bill", "Vanilla",
          "Bela", "Rum",
          "Clark", "Smooth",
          "Randy", "Chocolate
       ]
    

make sure you configure the table's retention policy to comply with your requirements of never dropping the data (e.g. put something like 36500.00:00:00 - 36500 days - as the SoftDeletePeriod)

Related