13

Just looking to create a quick in-memory/temp table for testing out queries. I've seen this done before but I'm having trouble finding any examples from a web search or StackOverflow search. I'm looking for something like this:

let TempTable = table("TestTable",
    Column column1 = [1,2,3],
    Column comumn2 = ["A","B","C"]
    );

Result:

resulting table

I don't need to save the table in any database, just want to use for testing & demonstration purposes.

SendETHToThisAddress
  • 2,756
  • 7
  • 29
  • 54

1 Answers1

22

you could use the datatable operator: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/datatableoperator

for example:

let T = datatable(column1:int, column2:string)
[
   1, "A",
   2, "B",
   3, "C",
];
... do something with T ...
Yoni L.
  • 22,627
  • 2
  • 29
  • 48
  • 2
    Thanks Yoni you're the best! Only thing I would suggest to improve your answer is also show how to assign it to a var `let TestTable = datatable(column1:int, column2:string) [1, "A", 2, "B", 3, "C", ]; TestTable` – SendETHToThisAddress Dec 02 '20 at 04:17