diff --git a/data-explorer/kusto/query/make-graph-operator.md b/data-explorer/kusto/query/make-graph-operator.md index 628b3e2cb2..a88aee7baa 100644 --- a/data-explorer/kusto/query/make-graph-operator.md +++ b/data-explorer/kusto/query/make-graph-operator.md @@ -19,8 +19,6 @@ The `make-graph` operator builds a graph structure from tabular inputs of edges *Edges* `|` `make-graph` *SourceNodeId* `-->` *TargetNodeId* [ `with` *Nodes1* `on` *NodeId1* [`,` *Nodes2* `on` *NodeId2* ]] `partitioned-by` *PartitionColumn* `(` *GraphOperator* `)` -*Edges* `|` `make-graph` *SourceNodeId* `-->` *TargetNodeId* [ `with_node_id=` *NodeIdPropertyName* ] `partitioned-by` *PartitionColumn* `(` *GraphOperator* `)` - ## Parameters | Name | Type | Required | Description | @@ -40,6 +38,9 @@ The `make-graph` operator returns a graph expression and must be followed by a [ When using the `partitioned-by` clause, separate graphs are created for each unique value in the specified *PartitionColumn*. The specified *GraphOperator* is then applied to each partitioned graph independently, and the results are combined into a single output. This is particularly useful for multitenant scenarios where you want to analyze each tenant's data separately while maintaining the same graph structure and analysis logic. +> [!IMPORTANT] +> When using the `partitioned-by` clause, both the *Edges* table and all *Nodes* tables must contain the partition column. + > [!NOTE] > Each node has a unique identifier. If the same node ID appears in both the *Nodes1* and *Nodes2* tables, a single node is created by merging their properties. If there are conflicting property values for the same node, one of the values is arbitrarily chosen. @@ -123,13 +124,15 @@ edges |---|---|---| |Mallory|Bob|Trent| -### Multitenant partitioned graph +### Partitioned graph This example demonstrates using the `partitioned-by` clause to analyze a multitenant social network. The `partitioned-by` clause creates separate graphs for each unique value in the partition column (in this case, `tenantId`), applies the graph operator to each partition independently, and combines the results. +:::image type="content" source="media/graphs/graph-example-make-graph-partitioned.png" alt-text="A graph showing three different companies which are representing three different partitions."::: + :::moniker range="azure-data-explorer" > [!div class="nextstepaction"] -> Run the query +> Run the query ::: moniker-end ```kusto @@ -139,8 +142,8 @@ let nodes = datatable(userId:string, tenantId:string, name:string, department:st // Tenant: CompanyA - San Francisco Bay Area "u001", "CompanyA", "Alice Johnson", "Engineering", "Senior Developer", dynamic({"type": "Point", "coordinates": [-122.4194, 37.7749]}), "u002", "CompanyA", "Bob Smith", "Engineering", "Team Lead", dynamic({"type": "Point", "coordinates": [-122.4094, 37.7849]}), - "u003", "CompanyA", "Charlie Brown", "Marketing", "Manager", dynamic({"type": "Point", "coordinates": [-122.4294, 37.7649]}), - "u004", "CompanyA", "Diana Prince", "HR", "Director", dynamic({"type": "Point", "coordinates": [-122.3994, 37.7949]}), + "u003", "CompanyA", "Charlie Black", "Marketing", "Manager", dynamic({"type": "Point", "coordinates": [-122.4294, 37.7649]}), + "u004", "CompanyA", "Diana Finch", "HR", "Director", dynamic({"type": "Point", "coordinates": [-122.3994, 37.7949]}), "u005", "CompanyA", "Eve Wilson", "Engineering", "Junior Developer", dynamic({"type": "Point", "coordinates": [-122.4394, 37.7549]}), // Tenant: CompanyB - New York Area "u006", "CompanyB", "Frank Miller", "Sales", "Account Manager", dynamic({"type": "Point", "coordinates": [-74.0060, 40.7128]}), @@ -192,7 +195,7 @@ edges |Start|Tenants|End| |---|---|---| -|Bob Smith (CompanyA)|[
"CompanyA",
"CompanyA"
]|Diana Prince (CompanyA)| +|Bob Smith (CompanyA)|[
"CompanyA",
"CompanyA"
]|Diana Finch (CompanyA)| |Henry Davis (CompanyB)|[
"CompanyB",
"CompanyB"
]|Grace Lee (CompanyB)| ## Related content diff --git a/data-explorer/kusto/query/media/graphs/graph-example-make-graph-partitioned.png b/data-explorer/kusto/query/media/graphs/graph-example-make-graph-partitioned.png new file mode 100644 index 0000000000..7ff55bc240 Binary files /dev/null and b/data-explorer/kusto/query/media/graphs/graph-example-make-graph-partitioned.png differ