You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: data-explorer/kusto/management/alter-merge-table-update-policy-command.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,6 @@ Changes the table's update policy. The [update policy](update-policy.md) simplif
15
15
>
16
16
> * The source table and the table for which the update policy is defined must be in the same database.
17
17
> * The update policy function schema and the target table schema must match in their column names, types, and order.
18
-
> * If the policy already defined on the table, the PolicyObjects specified in the command are added to the array of PolicyObjects in the existing policy.
19
18
20
19
## Permissions
21
20
@@ -31,14 +30,17 @@ You must have at least [Table Admin](../access-control/role-based-access-control
31
30
32
31
|Name|Type|Required|Description|
33
32
|--|--|--|--|
34
-
|*DatabaseName*|`string`|| The name of the database. When you run the command from the database context that contains the table to alter, *DatabaseName*is not required. |
33
+
|*DatabaseName*|`string`|| The name of the database. When you run the command from the database context that contains the table to alter, *DatabaseName*isn't required. |
35
34
|*TableName*|`string`|:heavy_check_mark:| The name of the table. A wildcard, `*`, denotes all tables.|
36
35
|*ArrayOfPolicyObjects*|`string`|:heavy_check_mark:| A serialized array of policy objects. For more information, see [update policy](update-policy.md).|
37
36
38
37
## Returns
39
38
40
39
Returns a JSON representation of the policy.
41
40
41
+
> [!WARNING]
42
+
> If an update policy is already defined on the table, the PolicyObjects specified in the command are added to the array of PolicyObjects in the existing policy. Entries aren't deduplicated, so if the exact same PolicyObject already exists in the current update policy, another entry will be added, potentially causing duplicates during ingestion time.
43
+
42
44
## Example
43
45
44
46
The following command changes the update policy for a table using [multi-line string literals](../query/scalar-data-types/string.md#multi-line-string-literals).
Copy file name to clipboardExpand all lines: data-explorer/kusto/management/alter-table-update-policy-command.md
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,8 +12,9 @@ ms.date: 08/11/2024
12
12
Use this command to change the table update policy. The [update policy](update-policy.md) simplifies the process of syncing and updating data between two tables. When new data is inserted into the source table, a transformation query runs over this data to modify and insert the data into the target table.
13
13
14
14
> [!NOTE]
15
-
> The source table and the table for which the update policy is defined must be in the same database.
16
-
> The update policy function schema and the target table schema must match in their column names, types, and order.
15
+
>
16
+
> * The source table and the table for which the update policy is defined must be in the same database.
17
+
> * The update policy function schema and the target table schema must match in their column names, types, and order.
17
18
18
19
## Permissions
19
20
@@ -37,6 +38,11 @@ You must have at least [Table Admin](../access-control/role-based-access-control
37
38
38
39
Returns a JSON representation of the policy.
39
40
41
+
> [!WARNING]
42
+
> The alter command *replaces* the current update policy with a new policy. If you would like to *add* a new entry to the array
43
+
> of policy objects, in addition to the current ones, use the
Copy file name to clipboardExpand all lines: data-explorer/kusto/management/materialized-views/materialized-view-create.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ There are two possible ways to create a materialized view, as noted by the *back
22
22
23
23
* See [Backfill a materialized view](#backfill-a-materialized-view).
24
24
* Creation might take a long while to complete, depending on the number of records in the source table. The view isn't available for queries until backfill is complete.
25
-
* When you're using this option, the create command must be `async`. You can monitor execution by using the [`.show operations`](../show-operations.md) command.
25
+
* When you're using this option, the create command must be `async`. You can monitor execution by using the [`.show operations`](../show-operations.md) command. Query for the entire operation log to view the progress of the backfill (see [examples here](../show-operations.md#example)).
26
26
* You can cancel the backfill process by using the [`.cancel operation`](#cancel-materialized-view-creation) command.
Copy file name to clipboardExpand all lines: data-explorer/kusto/management/show-operations.md
+43-12Lines changed: 43 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,9 +15,7 @@ Entries are appended to the log when operations start and change their state, in
15
15
Users can view the ongoing and past operations they started by using the `.show operations` command.
16
16
Database administrators can view all operations that apply to the databases they administer.
17
17
18
-
Users can also view the results of an operation by using the [`.show operation details`](show-operation-details.md)
19
-
command. Normally, the results are returned as part of `.show operations` command itself. For asynchronous
20
-
management commands, the `.show operation details` command is the only way to view the command's results.
18
+
The `.show operations` command returns general details about all operations running on the cluster. Some of the operations also support retrieving the operation's results by using the [`.show operation details`](show-operation-details.md) command.
21
19
22
20
## Syntax
23
21
@@ -33,7 +31,8 @@ management commands, the `.show operation details` command is the only way to vi
33
31
34
32
## Returns
35
33
36
-
When an operation ID is omitted, the command returns a table displaying all administrative operations executed in the last two weeks, whether ongoing or completed. It includes entries accessible to the user, with multiple records possible for a single operation. Only one record indicates the terminal state of 'Completed' or 'Failed.' This mode is for checking the history of operations, but note that records may take time to appear in the historic log.
34
+
When an operation ID is omitted, the command returns a table displaying all administrative operations executed in the last two weeks, whether ongoing or completed. It includes entries accessible to the user, with multiple records possible for a single operation. Only one record indicates the terminal state of 'Completed' or 'Failed.' This mode is for checking the history of operations. Records may take a short time to appear in the historical log.
35
+
You can use [arg_max()](../query/arg-max-aggregation-function.md) over the results of the historical log to view the latest state for each operation ID (see [examples](#example)).
37
36
38
37
When one or more operation IDs are provided, the command returns the latest update for each ID, given the user's access and the record being less than 6 hours old. This mode helps quickly check the latest status of recently executed operations.
39
38
@@ -69,17 +68,49 @@ The following table describes the possible values for the result table's *State*
69
68
70
69
## Example
71
70
71
+
The following command returns the latest state per operation ID for operations that started after `2026-01-05`:
72
+
73
+
```kusto
74
+
.show operations
75
+
| where StartedOn > datetime(2026-01-05)
76
+
| summarize arg_max(LastUpdatedOn, *) by OperationId
77
+
| project OperationId, Operation, StartedOn, LastUpdatedOn, Duration, State
The following command returns only the latest state for the same operation. Operations that completed over 6 hours ago will not be returned using this method. Use the options above to query for entries that are older than 6 hours.
Copy file name to clipboardExpand all lines: data-explorer/kusto/management/update-policy.md
+92-2Lines changed: 92 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,8 +92,9 @@ Each such object is represented as a JSON property bag, with the following prope
92
92
|Property |Type | Description |
93
93
|---------|---------|----------------|
94
94
|IsEnabled |`bool`|States if update policy is *true* - enabled, or *false* - disabled|
95
-
|Source |`string`|Name of the table that triggers invocation of the update policy |
96
-
|Query |`string`|A query used to produce data for the update |
95
+
|Source |`string`|Name of the table that triggers invocation of the update policy. |
96
+
|SourceIsWildCard |`bool`|If *true*, the `Source` property can be a wildcard pattern. See [Update policy with source table wildcard pattern](#update-policy-with-source-table-wildcard-pattern)|
97
+
|Query |`string`|A query used to produce data for the update. |
97
98
|IsTransactional |`bool`|States if the update policy is transactional or not, default is *false*. If the policy is transactional and the update policy fails, the source table isn't updated. |
98
99
|PropagateIngestionProperties |`bool`|States if properties specified during ingestion to the source table, such as [extent tags](extent-tags.md) and creation time, apply to the target table. |
99
100
|ManagedIdentity |`string`| The managed identity on behalf of which the update policy runs. The managed identity can be an object ID, or the `system` reserved word. The update policy must be configured with a managed identity when the query references tables in other databases or tables with an enabled [row level security policy](row-level-security-policy.md). For more information, see [Use a managed identity to run a update policy](update-policy-with-managed-identity.md). |
@@ -105,6 +106,7 @@ Each such object is represented as a JSON property bag, with the following prope
105
106
|---------|---------|----------------|
106
107
|IsEnabled |`bool`|States if update policy is *true* - enabled, or *false* - disabled|
107
108
|Source |`string`|Name of the table that triggers invocation of the update policy |
109
+
|SourceIsWildCard |`bool`|If *true*, the `Source` property can be a wildcard pattern. |
108
110
|Query |`string`|A query used to produce data for the update |
109
111
|IsTransactional |`bool`|States if the update policy is transactional or not, default is *false*. If the policy is transactional and the update policy fails, the source table isn't updated. |
110
112
|PropagateIngestionProperties |`bool`|States if properties specified during ingestion to the source table, such as [extent tags](extent-tags.md) and creation time, apply to the target table. |
@@ -144,6 +146,14 @@ Update policies take effect when data is ingested or moved to a source table, or
144
146
> Data may be lost in all tables with an update policy relationship if the `replace` command is invoked.
145
147
> Consider using `.set-or-append` instead.
146
148
149
+
## Update policy with source table wildcard pattern
150
+
151
+
Update policy supports ingesting from multiple source tables that share the same pattern, while using the
152
+
same query as the update policy query. This is useful if you have several source tables, usually sharing the same schema (or a subset of columns that share a common schema), and you would like to trigger ingestion to a
153
+
single target table, when ingesting to either of those tables. In this case, instead of defining multiple
154
+
update policies, each for a single source table, you can define a single update policy with wildcard as `Source`.The `Query` of the update policy must comply with all source tables matching the pattern.
155
+
To reference the source table in the update policy query, you can use a special symbol named `$source_table`. See example in [Example of wild card update policy](#example-of-wild-card-update-policy).
156
+
147
157
## Remove data from source table
148
158
149
159
After ingesting data to the target table, you can optionally remove it from the source table. Set a soft-delete period of `0sec` (or `00:00:00`) in the source table's [retention policy](retention-policy.md), and the update policy as transactional. The following conditions apply:
@@ -251,6 +261,86 @@ In this example, use an update policy with a simple function to perform ETL. Fir
The following example creates an update policy with a single entry on table `TargetTable`. The policy references all tables matching pattern `SourceTable*` as its source.
267
+
Any ingestion to a table which matches the pattern (in local database) will trigger the update policy, and ingest data to `TargetTable`, based on the update policy query.
1. Create a function which will serve as the `Query` of the update policy. The function uses the `$source_table` symbol to reference the `Source` of the update policy. Use `skipValidation=true` to skip validation during the create function, since `$source_table` is only known during update policy execution. The function is validated during the next step, when altering the update policy.
286
+
287
+
```kusto
288
+
.create function with(skipValidation=true) IngestToTarget()
289
+
{
290
+
$source_table
291
+
| parse Value with "I'm from table " Source
292
+
| project Id, Value, Source
293
+
}
294
+
```
295
+
296
+
1. Create the update policy on `TargetTable`. The policy references all tables matching pattern `SourceTable*` as its source.
297
+
298
+
````kusto
299
+
.alter table TargetTable policy update
300
+
```[{
301
+
"IsEnabled": true,
302
+
"Source": "SourceTable*",
303
+
"SourceIsWildCard" : true,
304
+
"Query": "IngestToTarget()",
305
+
"IsTransactional": true,
306
+
"PropagateIngestionProperties": true
307
+
}]```
308
+
309
+
````
310
+
311
+
1. Ingest to source tables. Both ingestions trigger the update policy:
312
+
313
+
```kusto
314
+
.set-or-append SourceTable1 <|
315
+
datatable (Id:long, Value:string)
316
+
[
317
+
1, "I'm from table SourceTable1",
318
+
2, "I'm from table SourceTable1"
319
+
]
320
+
```
321
+
322
+
```kusto
323
+
.set-or-append SourceTable2 <|
324
+
datatable (Id:long, Value:string)
325
+
[
326
+
3, "I'm from table SourceTable2",
327
+
4, "I'm from table SourceTable2"
328
+
]
329
+
```
330
+
331
+
1. Query `TargetTable`:
332
+
333
+
```kusto
334
+
TargetTable
335
+
```
336
+
337
+
|Id|Value|Source|
338
+
|---|---|---|
339
+
|1|I'm from table SourceTable1|SourceTable1|
340
+
|2|I'm from table SourceTable1|SourceTable1|
341
+
|3|I'm from table SourceTable2|SourceTable2|
342
+
|4|I'm from table SourceTable2|SourceTable2|
343
+
254
344
## Related content
255
345
256
346
* [Common scenarios for using table update policies](update-policy-common-scenarios.md)
0 commit comments