Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Builds the minimal schema that admits all values of DynamicExpr.
Note
This function is used in conjunction with the summarize operator.
Syntax
buildschema (DynamicExpr)
Learn more about syntax conventions.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| DynamicExpr | dynamic |
✔️ | Expression used for the aggregation calculation. |
Returns
Returns the minimal schema that admits all values of DynamicExpr.
Tip
If the input is a JSON string, use the parse_json() function to convert the JSON to a dynamic value. Otherwise, an error might occur.
Examples
The following example builds a schema based on:
{"x":1, "y":3.5}{"x":"somevalue", "z":[1, 2, 3]}{"y":{"w":"zzz"}, "t":["aa", "bb"], "z":["foo"]}
datatable(value: dynamic) [
dynamic({"x":1, "y":3.5}),
dynamic({"x":"somevalue", "z":[1, 2, 3]}),
dynamic({"y":{"w":"zzz"}, "t":["aa", "bb"], "z":["foo"]})
]
| summarize buildschema(value)
Output
| schema_value |
|---|
{"x":["long","string"],"y":["double",{"w":"string"}],"z":{"indexer":["long","string"]},"t":{"indexer":"string"}} |
Schema breakdown
In the resulting schema:
- The root object is a container with four properties named
x,y,z, andt. - Property
xis either type long or type string. - Property
yis either type double or another container with a propertywof type string. - Property
zis an array, indicated by theindexerkeyword, where each item can be either type long or type string. - Property
tis an array, indicated by theindexerkeyword, where each item is a string. - Every property is implicitly optional, and any array might be empty.