KustoSchemaTools 1.0.0
See the version list below for details.
dotnet add package KustoSchemaTools --version 1.0.0
NuGet\Install-Package KustoSchemaTools -Version 1.0.0
<PackageReference Include="KustoSchemaTools" Version="1.0.0" />
paket add KustoSchemaTools --version 1.0.0
#r "nuget: KustoSchemaTools, 1.0.0"
// Install KustoSchemaTools as a Cake Addin #addin nuget:?package=KustoSchemaTools&version=1.0.0 // Install KustoSchemaTools as a Cake Tool #tool nuget:?package=KustoSchemaTools&version=1.0.0
KustoSchemaTools
This C# project provides functionality to work with schemas in Azure Data Explorer (Kusto). You can load a schema from yaml files or a database to the interal data structure. This can be used for creating diffs of two databases as scripts or markdown, and also to write it back to files or update schemas in a database.
A second project "KustoSchemaToolsAction" wraps that into CLI tool inside a docker container for usage in GitHub Actions.
Getting started
The database
object holds all schema related information for a Kusto database. It can be loaded from, or written to a cluster using the KustoDatabaseHandler
which can be created by the KustoDatabaseHandlerFactory
.There are several steps involved for loading a all relevant information from a kusto database into the database
object. These are covered by different plugins, which can be configured for the KustoDatabaseHandlerFactory
.
var dbFactory = new KustoDatabaseHandlerFactory(sp.GetService<ILogger<KustoDatabaseHandler>>())
.WithPlugin<KustoDatabasePrincipalLoader>()
.WithPlugin<KustoDatabaseRetentionAndCacheLoader>()
.WithPlugin<KustoTableBulkLoader>()
.WithPlugin<KustoFunctionBulkLoader>()
.WithPlugin<KustoMaterializedViewBulkLoader>()
.WithPlugin<DatabaseCleanup>()
For syncrhonizing it to files, the YamlDatabaseHandler
and the YamlDatabaseHandlerFactory
are the right tools. To prevent super large files, there are plugins that handle reading and writing functions, tables and materialized views to separate files and folders. They can be configured for the YamlDatabaseHandlerFactory
.
var yamlFactory = new YamlDatabaseHandlerFactory()
.WithPlugin(new TablePlugin())
.WithPlugin(new FunctionPlugin())
.WithPlugin(new MaterializedViewsPlugin())
.WithPlugin<DatabaseCleanup>();
Additional features can be added with custom plugins. A sample for table groups
, where the some parts of the schema are defined once, but is applied for several tables can be found in here.
The KustoSchemaHandler
is the central place for synching schemas between yaml and a database. It offers functions for generating changes formatted in markdown, writing a database to yaml files and applying changes from yaml files to a database.
Supported Features
Currently following features are supported:
- Database
- Permissions
- Default Retention
- Default Hot Cache
- Tables
- Columns
- Retention
- HotCache
- Update Policies
- Docstring
- Folder
- Functions
- Body
- Docstring
- Folder
- Materialized Views
- Query
- Retention
- HotCache
- Docstring
- Folder
The DatabaseCleanup
will remove redundant retention and hotcache definitions. It will also pretty print KQL queries in functions, update policies and materialized views.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Kusto.Toolkit (>= 1.5.0)
- Markdig (>= 0.31.0)
- Microsoft.Azure.Kusto.Data (>= 11.3.2)
- Microsoft.Azure.Kusto.Ingest (>= 11.3.2)
- Microsoft.Azure.Kusto.Language (>= 11.3.2)
- Microsoft.Azure.Kusto.Tools (>= 11.3.2)
- Microsoft.Extensions.Logging (>= 7.0.0)
- Newtonsoft.Json (>= 13.0.3)
- YamlDotNet (>= 13.1.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.