Search code examples
.netazureazure-data-explorerkql

ADX - create table based-on - without throwing error when it already exists


I'm using the .NET SDK to create tables in Azure Data Explorer. I'm creating the tables based on a template like this:

_kustoAdminClient.ExecuteControlCommand("mydb", ".create table my_new_table based-on my_template_table with (folder='/')");

This all works as long as the table does not yet exist. So I'm looking for some easy way to ignore the fact if the table is already there. There is .create-merge table but that does not work with based-on.

Should I just catch the exception and discard it or is there a better way, directly in kql?


Solution

  • you can specify the ifnotexists option (see documentation)