Skip to content

Commit 2f1dc69

Browse files
committed
almost there
1 parent 641f901 commit 2f1dc69

11 files changed

+102
-56
lines changed

docs/en-US/Connect-Kusto.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ This non mandatory parameter determines which Database in your Cluster will be t
229229
230230
> [!TIP]
231231
>
232-
> The `Invoke-` cmdlets also offer supplying this value if it wasn't provided during connection.
232+
> The `Invoke-*` and `Set-*` cmdlets also offer supplying this value if it wasn't provided during connection.
233233

234234
```yaml
235235
Type: String

docs/en-US/Invoke-KustoIngestFromStorage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Ingests local or blob storage files into Azure Data Explorer.
1717
Invoke-KustoIngestFromStorage
1818
[-Path] <String>
1919
[-Table] <String>
20-
[-Database <String>]
20+
[[-Database] <String>]
2121
[-Mapping <IngestionMapping>]
2222
[-Format <DataSourceFormat>]
2323
[-IgnoreFirstRecord]

docs/en-US/Invoke-KustoQuery.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,11 @@ Accept wildcard characters: False
115115

116116
### -RequestProperties
117117

118-
Request properties control how a query or command executes and returns results.
119-
For creating a `ClientRequestProperties` object, checkout [`New-KustoClientRequestProperties`](New-KustoClientRequestProperties.md).
118+
Request properties control how a query or command executes and returns results. If no `ClientRequestProperties` object is supplied this cmdlet will use default properties.
119+
120+
> [!NOTE]
121+
>
122+
> You can create new request properties using [New-KustoClientRequestProperties](New-KustoClientRequestProperties.md).
120123

121124
```yaml
122125
Type: ClientRequestProperties

docs/en-US/New-KustoColumnMapping.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Accept wildcard characters: False
7676
7777
### -Properties
7878
79-
Property-bag containing properties specific for each mapping as described in each specific mapping type page.
79+
Property-bag containing properties specific for each mapping as described in each specific mapping type page.
8080
8181
```yaml
8282
Type: Hashtable

docs/en-US/Set-KustoBatchingPolicy.md

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ schema: 2.0.0
99

1010
## SYNOPSIS
1111

12-
{{ Fill in the Synopsis }}
12+
Sets ingestion batching policy on a Kusto Database or Table.
1313

1414
## SYNTAX
1515

1616
```powershell
1717
Set-KustoBatchingPolicy
18-
[-Table] <String>
18+
[[-Table] <String>]
1919
[[-Database] <String>]
2020
[-MaximumBatchingTimeSpan <TimeSpan>]
2121
[-MaximumNumberOfItems <Int32>]
@@ -27,23 +27,47 @@ Set-KustoBatchingPolicy
2727

2828
## DESCRIPTION
2929

30-
{{ Fill in the Description }}
30+
The `Set-KustoBatchingPolicy` cmdlet is used to alter the batching policy of a Database or specific Table on an Azure Data Explorer Cluster. See [__Ingestion batching policy__](https://learn.microsoft.com/en-us/kusto/management/batching-policy?view=microsoft-fabric) for more details.
3131

3232
## EXAMPLES
3333

34-
### Example 1
34+
### Example 1: Set new ingestion batching policy for a Table
3535

3636
```powershell
37-
PS C:\> {{ Add example code here }}
37+
$params = @{
38+
MaximumBatchingTimeSpan = '00:00:30'
39+
MaximumNumberOfItems = 500
40+
MaximumRawDataSizeMB = 1024
41+
}
42+
Set-KustoBatchingPolicy -Table myTable -Database myDb @params
3843
```
3944

40-
{{ Add example description here }}
45+
This example alters the ingestion batching policy of `myTable` on `myDb` Database.
46+
47+
### Example 2: Set new ingestion batching policy for a Database
48+
49+
```powershell
50+
$params = @{
51+
MaximumBatchingTimeSpan = '00:00:30'
52+
MaximumNumberOfItems = 500
53+
MaximumRawDataSizeMB = 1024
54+
}
55+
Set-KustoBatchingPolicy -Database myDb @params
56+
```
57+
58+
> [!TIP]
59+
>
60+
> When `-Table` isn't specified, the ingestion batching policy is altered at Database level.
4161
4262
## PARAMETERS
4363

4464
### -Database
4565

46-
{{ Fill Database Description }}
66+
Specifies the name of the Database for which to alter the ingestion batching policy.
67+
68+
> [!NOTE]
69+
>
70+
> If not supplied, the Database used will be the one specified when you called [`Connect-Kusto`](Connect-Kusto.md).
4771
4872
```yaml
4973
Type: String
@@ -59,7 +83,7 @@ Accept wildcard characters: False
5983
6084
### -MaximumBatchingTimeSpan
6185
62-
{{ Fill MaximumBatchingTimeSpan Description }}
86+
The time limit after which a batch is sealed. __The default value is 5 minutes__.
6387
6488
```yaml
6589
Type: TimeSpan
@@ -68,14 +92,14 @@ Aliases:
6892

6993
Required: False
7094
Position: Named
71-
Default value: None
95+
Default value: [timespan] '00:05:00'
7296
Accept pipeline input: False
7397
Accept wildcard characters: False
7498
```
7599
76100
### -MaximumNumberOfItems
77101
78-
{{ Fill MaximumNumberOfItems Description }}
102+
The number of files defined as the limit after which a batch is sealed. This setting should only be set in scenarios where you can control the data units, such as blobs or files. In message-based scenarios, such as Event Hubs, IoT Hub, and Azure Cosmos DB change feed, consider using the Time and Size settings to control batching. __The default value is 500 items__.
79103
80104
```yaml
81105
Type: Int32
@@ -84,14 +108,14 @@ Aliases:
84108

85109
Required: False
86110
Position: Named
87-
Default value: None
111+
Default value: 500
88112
Accept pipeline input: False
89113
Accept wildcard characters: False
90114
```
91115
92116
### -MaximumRawDataSizeMB
93117
94-
{{ Fill MaximumRawDataSizeMB Description }}
118+
The size limit after which a batch is sealed. __The default value is 1024 MB__.
95119
96120
```yaml
97121
Type: Int32
@@ -100,14 +124,14 @@ Aliases:
100124

101125
Required: False
102126
Position: Named
103-
Default value: None
127+
Default value: 1024
104128
Accept pipeline input: False
105129
Accept wildcard characters: False
106130
```
107131
108132
### -OutputType
109133
110-
{{ Fill OutputType Description }}
134+
Determines the output type this cmdlet will produce. __The default value is `PSObject`__.
111135

112136
```yaml
113137
Type: OutputType
@@ -124,7 +148,11 @@ Accept wildcard characters: False
124148

125149
### -RequestProperties
126150

127-
{{ Fill RequestProperties Description }}
151+
Request properties control how a query or command executes and returns results. If no `ClientRequestProperties` object is supplied this cmdlet will use default properties.
152+
153+
> [!NOTE]
154+
>
155+
> You can create new request properties using [New-KustoClientRequestProperties](New-KustoClientRequestProperties.md).
128156

129157
```yaml
130158
Type: ClientRequestProperties
@@ -140,14 +168,18 @@ Accept wildcard characters: False
140168

141169
### -Table
142170

143-
{{ Fill Table Description }}
171+
Specifies the Table for which to alter the ingestion batching policy.
172+
173+
> [!NOTE]
174+
>
175+
> This parameter is optional. If not specified, the ingestion batching policy is altered on Database level.
144176

145177
```yaml
146178
Type: String
147179
Parameter Sets: (All)
148180
Aliases:
149181
150-
Required: True
182+
Required: False
151183
Position: 0
152184
Default value: None
153185
Accept pipeline input: False
@@ -174,3 +206,9 @@ For more information, see [about_CommonParameters](http://go.microsoft.com/fwlin
174206
## NOTES
175207

176208
## RELATED LINKS
209+
210+
[__Ingestion batching policy__](https://learn.microsoft.com/en-us/kusto/management/batching-policy?view=microsoft-fabric)
211+
212+
[__.alter database policy ingestionbatching command__](https://learn.microsoft.com/en-us/kusto/management/alter-database-ingestion-batching-policy?view=microsoft-fabric)
213+
214+
[__Create a table's ingestion batching policy with the table batching policy wizard__](https://docs.azure.cn/en-us/data-explorer/table-batching-policy-wizard)

docs/en-US/Set-KustoIngestionMapping.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,17 @@ PS C:\> {{ Add example code here }}
4545

4646
{{ Fill Database Description }}
4747

48+
> [!NOTE]
49+
>
50+
> If not supplied, the Database used will be the one specified when you called [`Connect-Kusto`](Connect-Kusto.md).
51+
4852
```yaml
4953
Type: String
5054
Parameter Sets: (All)
5155
Aliases:
5256

5357
Required: False
54-
Position: 2
58+
Position: 1
5559
Default value: None
5660
Accept pipeline input: False
5761
Accept wildcard characters: False
@@ -83,15 +87,15 @@ Parameter Sets: (All)
8387
Aliases:
8488

8589
Required: True
86-
Position: 0
90+
Position: 2
8791
Default value: None
8892
Accept pipeline input: False
8993
Accept wildcard characters: False
9094
```
9195
9296
### -OutputType
9397
94-
{{ Fill OutputType Description }}
98+
Determines the output type this cmdlet will produce. __The default value is `PSObject`__.
9599

96100
```yaml
97101
Type: OutputType
@@ -124,7 +128,11 @@ Accept wildcard characters: False
124128

125129
### -RequestProperties
126130

127-
{{ Fill RequestProperties Description }}
131+
Request properties control how a query or command executes and returns results. If no `ClientRequestProperties` object is supplied this cmdlet will use default properties.
132+
133+
> [!NOTE]
134+
>
135+
> You can create new request properties using [New-KustoClientRequestProperties](New-KustoClientRequestProperties.md).
128136

129137
```yaml
130138
Type: ClientRequestProperties
@@ -148,7 +156,7 @@ Parameter Sets: (All)
148156
Aliases:
149157
150158
Required: True
151-
Position: 1
159+
Position: 0
152160
Default value: None
153161
Accept pipeline input: False
154162
Accept wildcard characters: False

src/PowerShellKusto/Commands/InvokeKustoControlCommandCommand.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ public sealed class InvokeKustoControlCommandCommand : KustoReaderCommandBase
1313
[Parameter(Mandatory = true, Position = 0)]
1414
public string Command { get; set; } = null!;
1515

16-
[Parameter(Position = 1)]
17-
[ValidateNotNullOrEmpty]
18-
public string? Database { get; set; }
19-
2016
protected override void EndProcessing()
2117
{
2218
try

src/PowerShellKusto/Commands/InvokeKustoQueryCommand.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ public sealed class InvokeKustoQueryCommand : KustoReaderCommandBase
1313
[Parameter(Mandatory = true, Position = 0)]
1414
public string Query { get; set; } = null!;
1515

16-
[Parameter(Position = 1)]
17-
[ValidateNotNullOrEmpty]
18-
public string? Database { get; set; }
19-
2016
protected override void EndProcessing()
2117
{
2218
try

src/PowerShellKusto/Commands/SetKustoBatchingPolicyCommand.cs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,17 @@ namespace PowerShellKusto.Commands;
1111
[OutputType(typeof(PSObject), typeof(string), typeof(DataTable))]
1212
public sealed class SetKustoBatchingPolicyCommand : KustoReaderCommandBase
1313
{
14-
[Parameter(Mandatory = true, Position = 0)]
15-
public string Table { get; set; } = null!;
16-
17-
[Parameter(Position = 1)]
14+
[Parameter(Position = 0)]
1815
[ValidateNotNullOrEmpty]
19-
public string? Database { get; set; }
16+
public string? Table { get; set; }
2017

2118
[Parameter]
2219
[ValidateTimespan]
23-
public TimeSpan MaximumBatchingTimeSpan { get; set; } = TimeSpan.FromSeconds(10);
20+
public TimeSpan MaximumBatchingTimeSpan { get; set; } = TimeSpan.FromMinutes(5);
2421

2522
[Parameter]
2623
[ValidateRange(1, int.MaxValue)]
27-
public int MaximumNumberOfItems { get; set; } = 100;
24+
public int MaximumNumberOfItems { get; set; } = 500;
2825

2926
[Parameter]
3027
[ValidateRange(1, int.MaxValue)]
@@ -34,15 +31,22 @@ protected override void EndProcessing()
3431
{
3532
try
3633
{
37-
using ICslAdminProvider client = KustoClientFactory.CreateCslAdminProvider(Builder);
38-
string command = CslCommandGenerator.GenerateTableAlterIngestionBatchingPolicyCommand(
39-
databaseName: Database ?? Builder?.InitialCatalog,
40-
tableName: Table,
41-
ingestionBatchingPolicy: new IngestionBatchingPolicy(
34+
Database ??= Builder?.InitialCatalog;
35+
IngestionBatchingPolicy policy = new(
4236
maximumBatchingTimeSpan: MaximumBatchingTimeSpan,
4337
maximumNumberOfItems: MaximumNumberOfItems,
44-
maximumRawDataSizeMB: MaximumRawDataSizeMB));
38+
maximumRawDataSizeMB: MaximumRawDataSizeMB);
4539

40+
string command = Table is null
41+
? CslCommandGenerator.GenerateDatabaseAlterIngestionBatchingPolicyCommand(
42+
databaseName: Database,
43+
ingestionBatchingPolicy: policy)
44+
: CslCommandGenerator.GenerateTableAlterIngestionBatchingPolicyCommand(
45+
databaseName: Database,
46+
tableName: Table,
47+
ingestionBatchingPolicy: policy);
48+
49+
using ICslAdminProvider client = KustoClientFactory.CreateCslAdminProvider(Builder);
4650
using IDataReader reader = RequestProperties is null
4751
? client.ExecuteControlCommand(command)
4852
: client.ExecuteControlCommand(command, RequestProperties);

src/PowerShellKusto/Commands/SetKustoIngestionMappingCommand.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@ namespace PowerShellKusto.Commands;
1212
public sealed class SetKustoIngestionMappingCommand : KustoReaderCommandBase
1313
{
1414
[Parameter(Mandatory = true, Position = 0)]
15-
public string MappingName { get; set; } = null!;
16-
17-
[Parameter(Mandatory = true, Position = 1)]
1815
public string Table { get; set; } = null!;
1916

20-
[Parameter(Position = 2)]
21-
public string? Database { get; set; }
17+
[Parameter(Mandatory = true, Position = 2)]
18+
public string MappingName { get; set; } = null!;
2219

2320
[Parameter(Mandatory = true)]
2421
public IngestionMapping IngestionMapping { get; set; } = null!;
@@ -30,7 +27,7 @@ protected override void EndProcessing()
3027
{
3128
try
3229
{
33-
string? database = Database ?? Builder?.InitialCatalog;
30+
Database ??= Builder?.InitialCatalog;
3431
using ICslAdminProvider client = KustoClientFactory.CreateCslAdminProvider(Builder);
3532
string command = CslCommandGenerator.GenerateTableMappingCreateCommand(
3633
mappingKind: IngestionMapping.IngestionMappingKind,
@@ -40,8 +37,8 @@ protected override void EndProcessing()
4037
removeOldestIfRequired: RemoveOldestIfRequired);
4138

4239
using IDataReader reader = RequestProperties is null
43-
? client.ExecuteControlCommand(database, command)
44-
: client.ExecuteControlCommand(database, command, RequestProperties);
40+
? client.ExecuteControlCommand(Database, command)
41+
: client.ExecuteControlCommand(Database, command, RequestProperties);
4542

4643
HandleReader(reader);
4744
}

src/PowerShellKusto/KustoReaderCommandBase.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ private bool NoHeader
2323
get => _noHeaderParam is { NoHeader.IsPresent: not true };
2424
}
2525

26+
[Parameter(Position = 1)]
27+
[ValidateNotNullOrEmpty]
28+
public string? Database { get; set; }
29+
2630
[Parameter]
2731
public OutputType OutputType { get; set; } = OutputType.PSObject;
2832

0 commit comments

Comments
 (0)