Search code examples
azure-data-explorerkql

Kusto command for generating create table & function script


Kusto explorer does allow scripting out functions and tables using the UI option "make command script". Is there any way we can use some sort of Kusto command to generate exactly the same output? Basically looking for command counterpart for clicking "make command script".


Solution

  • Continuing Yoni's answer, this should give you an executable command

    .show table MyTable cslschema | project strcat(".create table ",TableName," (", Schema , ")")
    
    • project lets you select what to output (same as SELECT in sql)

    • strcat lets you concat string