Skip to content

Commit 86e0b42

Browse files
committed
done doc for newkustoclientrequestprops
1 parent a5e66e2 commit 86e0b42

File tree

4 files changed

+59
-31
lines changed

4 files changed

+59
-31
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"Entra",
3434
"Kusto",
3535
"multijson",
36+
"norequesttimeout",
3637
"proga",
3738
"scsv",
3839
"singlejson",

docs/en-US/Invoke-KustoQuery.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,5 @@ By default, this cmdlet outputs `PSObject`.
157157
[Kusto Query Language (KQL)](https://learn.microsoft.com/en-us/kusto/query/?view=microsoft-fabric)
158158

159159
[T-SQL](https://learn.microsoft.com/en-us/kusto/query/t-sql?view=microsoft-fabric)
160+
161+
[Send T-SQL queries via the REST API](https://learn.microsoft.com/en-us/kusto/api/rest/t-sql?view=microsoft-fabric)

docs/en-US/New-KustoClientRequestProperties.md

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ schema: 2.0.0
99

1010
## SYNOPSIS
1111

12-
{{ Fill in the Synopsis }}
12+
Creates a `ClientRequestProperties` object.
1313

1414
## SYNTAX
1515

@@ -27,23 +27,50 @@ New-KustoClientRequestProperties
2727

2828
## DESCRIPTION
2929

30-
{{ Fill in the Description }}
30+
The `New-KustoClientRequestProperties` cmdlet can be used to create a new `ClientRequestProperties` object
31+
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).
32+
33+
The object contains the following information:
34+
35+
- [Request properties](https://learn.microsoft.com/en-us/kusto/api/netfx/client-request-properties?view=microsoft-fabric#request-properties): A mapping of specific options for customizing request behavior.
36+
- [Query parameters](https://learn.microsoft.com/en-us/kusto/api/netfx/client-request-properties?view=microsoft-fabric#query-parameters): A mapping of user-declared parameters that allow for secure query customization.
37+
- [Named properties](https://learn.microsoft.com/en-us/kusto/api/netfx/client-request-properties?view=microsoft-fabric#named-properties): Client request ID, application details, and user data, primarily used for debugging and tracing.
3138

3239
## EXAMPLES
3340

34-
### Example 1
41+
### Example 1: Run a KQL Query with specified request properties
42+
43+
```powershell
44+
$requestProps = New-KustoClientRequestProperties -NoTruncation -ServerTimeout '00:05:00'
45+
Invoke-KustoQuery 'myTable | project fooProp, barProp' -RequestProperties $requestProps
46+
```
47+
48+
This example demonstrates how you can specify request properties for your query.
49+
50+
- In this case `-NoTruncation` is particularly useful to overcome the 500k row limit on your query.
51+
- `-ServerTimeout '00:05:00'` allows the query to run for at least 5 minutes before timing out.
52+
53+
### Example 2: Create a new `ClientRequestProperties` object with supported request properties
3554

3655
```powershell
37-
PS C:\> {{ Add example code here }}
56+
$requestProps = New-KustoClientRequestProperties -Options @{
57+
query_language = 'sql'
58+
request_app_name = 'myApp'
59+
norequesttimeout = $true
60+
}
3861
```
3962

40-
{{ Add example description here }}
63+
> [!TIP]
64+
>
65+
> Out of the supported request properties, this cmdlet only offers `-NoTruncation` (`notruncation`) and `-ServerTimeout` (`servertimeout`).
66+
> The `-Options` parameters offers adding extra options to your request that aren't by default available as a Parameter.
67+
> See [__Supported request properties__](https://learn.microsoft.com/en-us/kusto/api/rest/request-properties?view=microsoft-fabric#supported-request-properties) for the additional options.
4168
4269
## PARAMETERS
4370

4471
### -Application
4572

46-
{{ Fill Application Description }}
73+
The name of the client application that makes the request. This value is used for tracing.
4774

4875
```yaml
4976
Type: String
@@ -59,7 +86,7 @@ Accept wildcard characters: False
5986
6087
### -ClientRequestId
6188
62-
{{ Fill ClientRequestId Description }}
89+
An ID used to identify the request. This specification is helpful for debugging and may be required for specific scenarios like query cancellation.
6390
6491
```yaml
6592
Type: String
@@ -75,7 +102,7 @@ Accept wildcard characters: False
75102
76103
### -NoTruncation
77104
78-
{{ Fill NoTruncation Description }}
105+
Disables truncation of query results returned to the caller.
79106
80107
```yaml
81108
Type: SwitchParameter
@@ -91,7 +118,7 @@ Accept wildcard characters: False
91118
92119
### -Options
93120
94-
{{ Fill Options Description }}
121+
Specifies a Hashtable of additional [Supported request properties](https://learn.microsoft.com/en-us/kusto/api/rest/request-properties?view=microsoft-fabric#supported-request-properties) that aren't by default available as a Parameter.
95122
96123
```yaml
97124
Type: Hashtable
@@ -107,7 +134,7 @@ Accept wildcard characters: False
107134
108135
### -Parameters
109136
110-
{{ Fill Parameters Description }}
137+
Specifies a Hashtable of [query parameters declaration statement](https://learn.microsoft.com/en-us/kusto/query/query-parameters-statement?view=microsoft-fabric) that are used to declare parameters for a Kusto Query Language (KQL) query.
111138
112139
```yaml
113140
Type: Hashtable
@@ -123,7 +150,7 @@ Accept wildcard characters: False
123150
124151
### -ServerTimeout
125152
126-
{{ Fill ServerTimeout Description }}
153+
Overrides the default request timeout.
127154
128155
```yaml
129156
Type: TimeSpan
@@ -139,7 +166,7 @@ Accept wildcard characters: False
139166
140167
### -User
141168
142-
{{ Fill User Description }}
169+
The identity of the user that makes the request. This value is used for tracing.
143170
144171
```yaml
145172
Type: String
@@ -153,22 +180,6 @@ Accept pipeline input: False
153180
Accept wildcard characters: False
154181
```
155182
156-
### -ProgressAction
157-
158-
{{ Fill ProgressAction Description }}
159-
160-
```yaml
161-
Type: ActionPreference
162-
Parameter Sets: (All)
163-
Aliases: proga
164-
165-
Required: False
166-
Position: Named
167-
Default value: None
168-
Accept pipeline input: False
169-
Accept wildcard characters: False
170-
```
171-
172183
### CommonParameters
173184
174185
This cmdlet supports the common parameters.
@@ -185,3 +196,9 @@ For more information, see [about_CommonParameters](http://go.microsoft.com/fwlin
185196
## NOTES
186197
187198
## RELATED LINKS
199+
200+
[Kusto Data ClientRequestProperties class](https://learn.microsoft.com/en-us/kusto/api/netfx/client-request-properties?view=microsoft-fabric)
201+
202+
[Query parameters declaration statement](https://learn.microsoft.com/en-us/kusto/query/query-parameters-statement?view=microsoft-fabric)
203+
204+
[Request properties](https://learn.microsoft.com/en-us/kusto/api/rest/request-properties?view=microsoft-fabric)

src/PowerShellKusto/Commands/NewKustoClientRequestPropertiesCommand.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public sealed class NewKustoClientRequestPropertiesCommand : PSCmdlet
3434

3535
[Parameter]
3636
[ValidateTimespan]
37-
public TimeSpan ServerTimeout { get; set; } = TimeSpan.FromSeconds(60);
37+
public TimeSpan? ServerTimeout { get; set; }
3838

3939
protected override void EndProcessing()
4040
{
@@ -60,8 +60,16 @@ protected override void EndProcessing()
6060
}
6161
}
6262

63-
properties.SetOption(ClientRequestProperties.OptionNoTruncation, NoTruncation);
64-
properties.SetOption(ClientRequestProperties.OptionServerTimeout, ServerTimeout);
63+
if (ServerTimeout is not null)
64+
{
65+
properties.SetOption(ClientRequestProperties.OptionServerTimeout, ServerTimeout);
66+
}
67+
68+
if (NoTruncation)
69+
{
70+
properties.SetOption(ClientRequestProperties.OptionNoTruncation, NoTruncation);
71+
}
72+
6573
WriteObject(properties);
6674
}
6775
}

0 commit comments

Comments
 (0)