static void ResetTable(KustoConnectionStringBuilder kscb, string tableName, Type type) { using (var admin = KustoClientFactory.CreateCslAdminProvider(kscb)) { string dropTable = CslCommandGenerator.GenerateTableDropCommand(tableName, true); admin.ExecuteControlCommand(dropTable); string createTable = CslCommandGenerator.GenerateTableCreateCommand(tableName, type); admin.ExecuteControlCommand(createTable); string enableIngestTime = CslCommandGenerator.GenerateIngestionTimePolicyAlterCommand(tableName, true); admin.ExecuteControlCommand(enableIngestTime); } }
private void CreateMergeKustoTable(ICslAdminProvider admin, IDictionary <string, object> value) { TableSchema tableSchema = new TableSchema(TableName); foreach (var pair in value) { tableSchema.AddColumnIfMissing(new ColumnSchema(pair.Key, _columnType[pair.Value != null ? pair.Value.GetType() : typeof(string)])); } string createTable = CslCommandGenerator.GenerateTableCreateMergeCommand(tableSchema); admin.ExecuteControlCommand(createTable); string enableIngestTime = CslCommandGenerator.GenerateIngestionTimePolicyAlterCommand(TableName, true); admin.ExecuteControlCommand(enableIngestTime); }