diff --git a/docs/en-US/Connect-Kusto.md b/docs/en-US/Connect-Kusto.md index f356cd9..e0869e4 100644 --- a/docs/en-US/Connect-Kusto.md +++ b/docs/en-US/Connect-Kusto.md @@ -345,7 +345,7 @@ Parameter Sets: (All) Aliases: Required: True -Position: Named +Position: 0 Default value: None Accept pipeline input: False Accept wildcard characters: False diff --git a/docs/en-US/Invoke-KustoControlCommand.md b/docs/en-US/Invoke-KustoControlCommand.md index fc0cc68..a045d17 100644 --- a/docs/en-US/Invoke-KustoControlCommand.md +++ b/docs/en-US/Invoke-KustoControlCommand.md @@ -16,8 +16,8 @@ Invokes management commands over an Azure Data Explorer Cluster. ```powershell Invoke-KustoControlCommand [-Command] - [-Database ] - [[-OutputType] ] + [[-Database] ] + [-OutputType ] [-RequestProperties ] [] ``` @@ -101,7 +101,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: Named +Position: 1 Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -118,7 +118,7 @@ Aliases: Accepted values: PSObject, Json, Csv, DataTable, Html Required: False -Position: 1 +Position: Named Default value: PSObject Accept pipeline input: False Accept wildcard characters: False diff --git a/docs/en-US/Invoke-KustoQuery.md b/docs/en-US/Invoke-KustoQuery.md index 0b95b52..81dbe63 100644 --- a/docs/en-US/Invoke-KustoQuery.md +++ b/docs/en-US/Invoke-KustoQuery.md @@ -16,8 +16,8 @@ Invokes a KQL or T-SQL query over an Azure Data Explorer Cluster. ```powershell Invoke-KustoQuery [-Query] - [-Database ] - [[-OutputType] ] + [[-Database] ] + [-OutputType ] [-RequestProperties ] [] ``` @@ -74,7 +74,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: Named +Position: 1 Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -91,7 +91,7 @@ Aliases: Accepted values: PSObject, Json, Csv, DataTable, Html Required: False -Position: 1 +Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False diff --git a/docs/en-US/New-KustoClientRequestProperties.md b/docs/en-US/New-KustoClientRequestProperties.md index cae8192..97a81ce 100644 --- a/docs/en-US/New-KustoClientRequestProperties.md +++ b/docs/en-US/New-KustoClientRequestProperties.md @@ -28,7 +28,8 @@ New-KustoClientRequestProperties ## DESCRIPTION The `New-KustoClientRequestProperties` cmdlet can be used to create a new `ClientRequestProperties` object -to manage the interaction between client and service. This object can be later on passed as argument to the request cmdlets: [`Invoke-KustoControlCommand`](Invoke-KustoControlCommand.md) and [`Invoke-KustoQuery`](Invoke-KustoQuery.md). +to manage the interaction between client and service. This object can be later on passed as argument to the request cmdlets: [`Invoke-KustoControlCommand`](Invoke-KustoControlCommand.md), [`Invoke-KustoQuery`](Invoke-KustoQuery.md), +[`Set-KustoBatchingPolicy`](Set-KustoBatchingPolicy.md) and [`Set-KustoIngestionMapping`](Set-KustoIngestionMapping.md). The object contains the following information: @@ -58,6 +59,7 @@ $requestProps = New-KustoClientRequestProperties -Options @{ request_app_name = 'myApp' norequesttimeout = $true } +Invoke-KustoQuery 'SELECT top(10) * FROM MyTable' -RequestProperties $requestProps ``` > [!TIP] diff --git a/docs/en-US/New-KustoColumnMapping.md b/docs/en-US/New-KustoColumnMapping.md index 4581ff4..a2da5d7 100644 --- a/docs/en-US/New-KustoColumnMapping.md +++ b/docs/en-US/New-KustoColumnMapping.md @@ -23,23 +23,44 @@ New-KustoColumnMapping ## DESCRIPTION -{{ Fill in the Description }} +The `New-KustoColumnMapping` cmdlet is used to create a new object of type `ColumnMapping`, this object can be later on passed as argument to the [`New-KustoIngestionMapping`](New-KustoIngestionMapping.md) cmdlet. See [__Ingestion mappings__](https://learn.microsoft.com/en-us/kusto/management/mappings?view=microsoft-fabric) for more details. ## EXAMPLES -### Example 1 +### Example 1: CSV mapping ```powershell -PS C:\> {{ Add example code here }} +$columns = @( + New-KustoColumnMapping event_time -Properties @{ Ordinal = 0 } + New-KustoColumnMapping event_name -Properties @{ Ordinal = 1 } + New-KustoColumnMapping event_type -Properties @{ Ordinal = 2 } + New-KustoColumnMapping ingestion_time -Properties @{ ConstValue = '2023-01-01T10:32:00' } + New-KustoColumnMapping source_location -Properties @{ Transform = 'SourceLocation' }) ``` -{{ Add example description here }} +Demonstrates how to create columns for a new [__CSV mapping__](https://learn.microsoft.com/en-us/kusto/management/csv-mapping?view=microsoft-fabric). + +### Example 2: JSON Mapping + +```powershell +$columns = @( + New-KustoColumnMapping event_timestamp -Properties @{Path = '$.Timestamp' } + New-KustoColumnMapping event_name -Properties @{ Path = '$.Event.Name' } + New-KustoColumnMapping event_type -Properties @{ Path = '$.Event.Type' } + New-KustoColumnMapping source_uri -Properties @{ Transform = 'SourceLocation' } + New-KustoColumnMapping source_line -Properties @{ Transform = 'SourceLineNumber' } + New-KustoColumnMapping event_time -Properties @{ Path = '$.Timestamp'; Transform = 'DateTimeFromUnixMilliseconds' } + New-KustoColumnMapping ingestion_time -Properties @{ ConstValue = '2021-01-01T10:32:00' } + New-KustoColumnMapping full_record -Properties @{ Path = '$' }) +``` + +Demonstrates how to create columns for a new [__JSON mapping__](https://learn.microsoft.com/en-us/kusto/management/json-mapping?view=microsoft-fabric). ## PARAMETERS ### -Name -{{ Fill Name Description }} +Specifies the Target column name in the table. ```yaml Type: String @@ -55,7 +76,7 @@ Accept wildcard characters: False ### -Properties -{{ Fill Properties Description }} +Property-bag containing properties specific for each mapping as described in each specific mapping type page. ```yaml Type: Hashtable @@ -71,7 +92,7 @@ Accept wildcard characters: False ### -Type -{{ Fill Type Description }} +Specifies the Datatype with which to create the mapped column if it doesn't already exist in the table. ```yaml Type: ColumnType @@ -86,22 +107,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction - -{{ Fill ProgressAction Description }} - -```yaml -Type: ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### CommonParameters This cmdlet supports the common parameters. @@ -118,3 +123,5 @@ For more information, see [about_CommonParameters](http://go.microsoft.com/fwlin ## NOTES ## RELATED LINKS + +[__Ingestion mappings__](https://learn.microsoft.com/en-us/kusto/management/mappings?view=microsoft-fabric) diff --git a/docs/en-US/New-KustoIngestionMapping.md b/docs/en-US/New-KustoIngestionMapping.md index bdfd03b..62222cb 100644 --- a/docs/en-US/New-KustoIngestionMapping.md +++ b/docs/en-US/New-KustoIngestionMapping.md @@ -9,37 +9,40 @@ schema: 2.0.0 ## SYNOPSIS -{{ Fill in the Synopsis }} +Creates a `IngestionMapping` object. ## SYNTAX ```powershell New-KustoIngestionMapping - [-Kind ] + [[-Kind] ] [-Reference ] - [-Columns ] + [[-Columns] ] [] ``` ## DESCRIPTION -{{ Fill in the Description }} +The `New-KustoIngestionMapping` is used to create a new object of type `IngestionMapping` that can be later on passed as argument to the [`Invoke-KustoIngestFromStorage`](Invoke-KustoIngestFromStorage.md), [`Invoke-KustoIngestFromStream`](Invoke-KustoIngestFromStream.md) and [`Set-KustoIngestionMapping`](Set-KustoIngestionMapping.md) commands. ## EXAMPLES -### Example 1 +### Example 1: Create a new Ingestion Mapping object ```powershell -PS C:\> {{ Add example code here }} -``` +$columns = @( + New-KustoColumnMapping .... + New-KustoColumnMapping .... + New-KustoColumnMapping ....) -{{ Add example description here }} +$mapping = New-KustoIngestionMapping -Columns $columns -Kind Json +``` ## PARAMETERS ### -Columns -{{ Fill Columns Description }} +Specifies an array of `ColumnMapping` objects to be used with the ingestion mapping. See [`New-KustoColumnMapping`](New-KustoColumnMapping.md) for details on how to create new column mappings. ```yaml Type: ColumnMapping[] @@ -47,7 +50,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: Named +Position: 0 Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -55,7 +58,7 @@ Accept wildcard characters: False ### -Kind -{{ Fill Kind Description }} +Specifies the type of mapping. __Default value is `Unknown`__. ```yaml Type: IngestionMappingKind @@ -64,7 +67,7 @@ Aliases: Accepted values: Unknown, Csv, Json, Avro, Parquet, SStream, Orc, ApacheAvro, W3CLogFile Required: False -Position: Named +Position: 1 Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -72,7 +75,7 @@ Accept wildcard characters: False ### -Reference -{{ Fill Reference Description }} +A value that indicates how to map data from the source file to the actual columns in the table using a named mapping policy object. ```yaml Type: String @@ -86,22 +89,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction - -{{ Fill ProgressAction Description }} - -```yaml -Type: ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### CommonParameters This cmdlet supports the common parameters. @@ -118,3 +105,7 @@ For more information, see [about_CommonParameters](http://go.microsoft.com/fwlin ## NOTES ## RELATED LINKS + +[.create ingestion mapping command](https://learn.microsoft.com/en-us/kusto/management/create-ingestion-mapping-command?view=azure-data-explorer&preserve-view=true) + +[Ingestion properties](https://learn.microsoft.com/en-us/kusto/ingestion-properties?view=microsoft-fabric#ingestion-properties) diff --git a/docs/en-US/Set-KustoBatchingPolicy.md b/docs/en-US/Set-KustoBatchingPolicy.md index 6c2cc51..07d1194 100644 --- a/docs/en-US/Set-KustoBatchingPolicy.md +++ b/docs/en-US/Set-KustoBatchingPolicy.md @@ -16,11 +16,11 @@ schema: 2.0.0 ```powershell Set-KustoBatchingPolicy [-Table] - [-Database ] + [[-Database] ] [-MaximumBatchingTimeSpan ] [-MaximumNumberOfItems ] [-MaximumRawDataSizeMB ] - [[-OutputType] ] + [-OutputType ] [-RequestProperties ] [] ``` @@ -51,7 +51,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: Named +Position: 1 Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -116,7 +116,7 @@ Aliases: Accepted values: PSObject, Json, Csv, DataTable, Html Required: False -Position: 1 +Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -154,22 +154,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction - -{{ Fill ProgressAction Description }} - -```yaml -Type: ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### CommonParameters This cmdlet supports the common parameters. diff --git a/docs/en-US/Set-KustoIngestionMapping.md b/docs/en-US/Set-KustoIngestionMapping.md index a444e16..5ce27b8 100644 --- a/docs/en-US/Set-KustoIngestionMapping.md +++ b/docs/en-US/Set-KustoIngestionMapping.md @@ -20,7 +20,7 @@ Set-KustoIngestionMapping [[-Database] ] -IngestionMapping [-RemoveOldestIfRequired] - [[-OutputType] ] + [-OutputType ] [-RequestProperties ] [] ``` @@ -154,22 +154,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction - -{{ Fill ProgressAction Description }} - -```yaml -Type: ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### CommonParameters This cmdlet supports the common parameters. diff --git a/src/PowerShellKusto/Commands/InvokeKustoControlCommandCommand.cs b/src/PowerShellKusto/Commands/InvokeKustoControlCommandCommand.cs index 0005893..c3549be 100644 --- a/src/PowerShellKusto/Commands/InvokeKustoControlCommandCommand.cs +++ b/src/PowerShellKusto/Commands/InvokeKustoControlCommandCommand.cs @@ -13,7 +13,7 @@ public sealed class InvokeKustoControlCommandCommand : KustoReaderCommandBase [Parameter(Mandatory = true, Position = 0)] public string Command { get; set; } = null!; - [Parameter] + [Parameter(Position = 1)] [ValidateNotNullOrEmpty] public string? Database { get; set; } diff --git a/src/PowerShellKusto/Commands/InvokeKustoQueryCommand.cs b/src/PowerShellKusto/Commands/InvokeKustoQueryCommand.cs index 566b233..fb151e0 100644 --- a/src/PowerShellKusto/Commands/InvokeKustoQueryCommand.cs +++ b/src/PowerShellKusto/Commands/InvokeKustoQueryCommand.cs @@ -13,7 +13,7 @@ public sealed class InvokeKustoQueryCommand : KustoReaderCommandBase [Parameter(Mandatory = true, Position = 0)] public string Query { get; set; } = null!; - [Parameter] + [Parameter(Position = 1)] [ValidateNotNullOrEmpty] public string? Database { get; set; } diff --git a/src/PowerShellKusto/Commands/NewKustoIngestionMappingCommand.cs b/src/PowerShellKusto/Commands/NewKustoIngestionMappingCommand.cs index 2f7652f..e0eb46f 100644 --- a/src/PowerShellKusto/Commands/NewKustoIngestionMappingCommand.cs +++ b/src/PowerShellKusto/Commands/NewKustoIngestionMappingCommand.cs @@ -9,17 +9,17 @@ namespace PowerShellKusto.Commands; [OutputType(typeof(IngestionMapping))] public sealed class NewKustoIngestionMappingCommand : PSCmdlet { - [Parameter] + [Parameter(Position = 0)] + [ValidateNotNullOrEmpty] + public ColumnMapping[]? Columns { get; set; } + + [Parameter(Position = 1)] public IngestionMappingKind Kind { get; set; } = IngestionMappingKind.Unknown; [Parameter] [ValidateNotNullOrEmpty] public string? Reference { get; set; } - [Parameter] - [ValidateNotNullOrEmpty] - public ColumnMapping[]? Columns { get; set; } - protected override void EndProcessing() { IngestionMapping mapping = new() diff --git a/src/PowerShellKusto/Commands/SetKustoBatchingPolicyCommand.cs b/src/PowerShellKusto/Commands/SetKustoBatchingPolicyCommand.cs index 800eed1..6c6270b 100644 --- a/src/PowerShellKusto/Commands/SetKustoBatchingPolicyCommand.cs +++ b/src/PowerShellKusto/Commands/SetKustoBatchingPolicyCommand.cs @@ -14,7 +14,7 @@ public sealed class SetKustoBatchingPolicyCommand : KustoReaderCommandBase [Parameter(Mandatory = true, Position = 0)] public string Table { get; set; } = null!; - [Parameter] + [Parameter(Position = 1)] [ValidateNotNullOrEmpty] public string? Database { get; set; } diff --git a/src/PowerShellKusto/KustoReaderCommandBase.cs b/src/PowerShellKusto/KustoReaderCommandBase.cs index 095bdfb..5b8b6f8 100644 --- a/src/PowerShellKusto/KustoReaderCommandBase.cs +++ b/src/PowerShellKusto/KustoReaderCommandBase.cs @@ -23,7 +23,7 @@ private bool NoHeader get => _noHeaderParam is { NoHeader.IsPresent: not true }; } - [Parameter(Position = 1)] + [Parameter] public OutputType OutputType { get; set; } = OutputType.PSObject; [Parameter]