-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from github/caol-ila-constinuous-export
Add continuous exports
- Loading branch information
Showing
5 changed files
with
94 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using KustoSchemaTools.Changes; | ||
using YamlDotNet.Serialization; | ||
|
||
namespace KustoSchemaTools.Model | ||
{ | ||
public class ContinuousExport : IKustoBaseEntity | ||
{ | ||
public string ExternalTable { get; set; } | ||
public int ForcedLatencyInMinutes { get; set; } | ||
public int IntervalBetweenRuns { get; set; } | ||
public long SizeLimit { get; set; } | ||
public bool Distributed { get; set; } | ||
public string ManagedIdentity { get; set; } | ||
[YamlMember(ScalarStyle = YamlDotNet.Core.ScalarStyle.Literal)] | ||
public string Query { get; set; } | ||
|
||
public List<DatabaseScriptContainer> CreateScripts(string name) | ||
{ | ||
return new List<DatabaseScriptContainer> | ||
{ | ||
new DatabaseScriptContainer("ContinuousExport",120,@$".create-or-alter continuous-export {name} to table {ExternalTable} with (forcedLatency={ForcedLatencyInMinutes}m, intervalBetweenRuns={ForcedLatencyInMinutes}m, sizeLimit={SizeLimit}, distributed={Distributed}, managedIdentity='{ManagedIdentity}') <| {Query}") | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
KustoSchemaTools/Parser/KustoLoader/KustoContinuousExportBulkLoader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using KustoSchemaTools.Model; | ||
|
||
namespace KustoSchemaTools.Parser.KustoLoader | ||
{ | ||
public class KustoContinuousExportBulkLoader : KustoBulkEntityLoader<ContinuousExport> | ||
{ | ||
const string LoadContinuousExports = @".show database hydro cslschema script | ||
| parse-where DatabaseSchemaScript with '.create-or-alter continuous-export ' EntityName:string ' to table ' ExternalTable:string ' with (forcedLatency=time(' ForcedLatency:timespan '), intervalBetweenRuns=time('IntervalBetweenRuns:timespan '), sizeLimit='SizeLimit:long', distributed='Distributed:bool', managedIdentity='ManagedIdentity:string') <| ' Query:string | ||
| project EntityName=trim("" "",EntityName), Body = bag_pack( | ||
'ExternalTable', ExternalTable, | ||
'ForcedLatencyInMinutes',toint(ForcedLatency /1m), | ||
'IntervalBetweenRuns',toint(IntervalBetweenRuns /1m), | ||
'SizeLimit',SizeLimit, | ||
'Distributed', Distributed, | ||
'ManagedIdentity',ManagedIdentity, | ||
'Query',Query)"; | ||
|
||
public KustoContinuousExportBulkLoader() : base(d => d.ContinuousExports) { } | ||
|
||
protected override IEnumerable<string> EnumerateScripts() | ||
{ | ||
yield return LoadContinuousExports; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using KustoSchemaTools.Model; | ||
|
||
namespace KustoSchemaTools.Plugins | ||
{ | ||
public class ContinuousExportPlugin : EntityPlugin<ContinuousExport> | ||
{ | ||
public ContinuousExportPlugin(string subFolder = "continuous-exports", int minRowLength = 5) : base(db => db.ContinuousExports, subFolder, minRowLength) | ||
{ | ||
} | ||
} | ||
} |