KustoSchemaTools 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package KustoSchemaTools --version 1.0.0                
NuGet\Install-Package KustoSchemaTools -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="KustoSchemaTools" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add KustoSchemaTools --version 1.0.0                
#r "nuget: KustoSchemaTools, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.4 205 8/23/2023
1.0.2 167 8/18/2023
1.0.1 164 8/16/2023
1.0.0 286 8/4/2023