Use the SymbolLoader family of classes to feed the Kusto parser with database schemas directly from your cluster.
The ServerSymbolLoader
class loads symbols from a Kusto server using admin commands to request schema.
var connection = new KustoConnectionStringBuilder(...);
var loader = new ServerSymbolLoader(connection);
var names = await loader.LoadDatabaseNamesAsync();
var loader = new ServerSymbolLoader(connection);
var db = await loader.LoadDatabaseAsync(dbName);
var globals = GlobalState.Default;
var loader = new ServerSymbolLoader(connection);
var globalsWithDB = await loader.AddOrUpdateDefaultDatabaseAsync(globals, dbName);
var parsed = KustoCode.ParseAndAnalyze(query, globalsWithDB);
The FileSymbolLoader
class loads and saves symbols into a file based symbol store.
var loader = new FileSymbolLoader(schemaCacheDirectoryPath, defaultClusterName);
var db = await loader.LoadDatabaseAsync(dbName);
var loader = new FileSymbolLoader(schemaCacheDirectoryPath, defaultClusterName);
loader.DeleteCache();
var loader = new CachedServerSymbolLoader(clusterConnectionString, schemaCacheDirectoryPath);
loader.FileLoader.DeleteCache();
var loader = new FileSymbolLoader(schemaCacheDirectoryPath, defaultClusterName);
loader.DeleteClusterCache(clusterName);
var loader = new FileSymbolLoader(schemaCacheDirectoryPath, defaultClusterName);
loader.DeleteClusterCache();
var loader = new FileSymbolLoader(schemaCacheDirectoryPath, defaultClusterName);
var databaseSymbol = ...;
await loader.SaveDatabaseAsync(databaseSymbol, clusterName);
var loader = new FileSymbolLoader(schemaCacheDirectoryPath, defaultClusterName);
var clusterSymbol = ...;
await loader.SaveClusterAsync(clusterSymbol);
var loader = new FileSymbolLoader(schemaCacheDirectoryPath, defaultClusterName);
var clusterSymbols = new ClusterSymbol[] { ... };
await loader.SaveClustersAsync(clusterSymbols);
The CachedSymbolLoader
class combines both the ServerSymbolLoader
and FileSymbolLoader
classes togther
to make a SymbolLoader
that loads symbols from either a file based cache or a kusto server when not found in the cache.
var connection = new KustoConnectionStringBuilder(...);
var loader = new CachedSymbolLoader(connection, schemaCacheDirectoryPath);
var db = await loader.LoadDatabaseAsync(dbName);