Skip to content

Commit 10134e2

Browse files
SinsBreclaude
andcommitted
feat(sentinel-graph): Update to public preview API format
Microsoft moved Sentinel custom graph to public preview with a new response schema. Updates the plugin to match: - Rewrite response parsing for new envelope: result.graph.{nodes,edges} and result.rawData.tables (replacing the old Graph/RawData format) - Add responseFormats request parameter (default: ["Graph"]) - Add sentinel_graph_list() to discover available graph instances via GET /graphs/graph-instances?graphTypes=Custom - Remove sys_* / JSON-encoded-string field handling (pre-preview only) - Rewrite test fixtures and tests for new schema; add TestSentinelGraphList, TestResponseFormats, and TestTableFormatParsing test classes - Update demo notebook with list-then-configure pattern and responseFormats example Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b0337c0 commit 10134e2

6 files changed

Lines changed: 692 additions & 569 deletions

File tree

demos/demos_databases_apis/microsoft/sentinel/sentinel_graph_examples.ipynb

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,14 @@
5959
{
6060
"cell_type": "markdown",
6161
"metadata": {},
62-
"source": [
63-
"## Configure Sentinel Graph API\n",
64-
"\n",
65-
"Set up authentication to Microsoft Security Platform. This will open a browser window for interactive login."
66-
]
62+
"source": "## Discover Available Graph Instances\n\nUse `sentinel_graph_list()` to see what graph instances are available in your tenant. You only need a placeholder `graph_instance` for this call — the value is not used by the list endpoint."
63+
},
64+
{
65+
"cell_type": "code",
66+
"source": "g = graphistry.configure_sentinel_graph(\n graph_instance=graph_instance_name,\n credential=credential,\n response_formats=[\"Graph\"] # default; use [\"Table\", \"Graph\"] to also get raw tabular data\n)\n\nprint(f\"✓ Sentinel Graph configured for instance: {graph_instance_name}\")",
67+
"metadata": {},
68+
"execution_count": null,
69+
"outputs": []
6770
},
6871
{
6972
"cell_type": "code",
@@ -84,13 +87,9 @@
8487
]
8588
},
8689
{
87-
"cell_type": "markdown",
90+
"cell_type": "code",
8891
"metadata": {},
89-
"source": [
90-
"## Example 1: Basic Graph Query\n",
91-
"\n",
92-
"Query nodes and edges from your graph instance."
93-
]
92+
"source": "query = \"\"\"\nMATCH (n)-[e]->(m)\nRETURN *\nLIMIT 50\n\"\"\"\n\nviz = g.sentinel_graph(query)\nprint(f\"Query returned {len(viz._nodes)} nodes and {len(viz._edges)} edges\")\n\nviz.plot()"
9493
},
9594
{
9695
"cell_type": "code",
@@ -112,13 +111,9 @@
112111
]
113112
},
114113
{
115-
"cell_type": "markdown",
114+
"cell_type": "code",
116115
"metadata": {},
117-
"source": [
118-
"## Example 2: Inspect the Data\n",
119-
"\n",
120-
"Examine the structure of nodes and edges returned."
121-
]
116+
"source": "print(\"=\" * 80)\nprint(\"NODES\")\nprint(\"=\" * 80)\nprint(f\"Shape: {viz._nodes.shape}\")\nprint(f\"Columns: {list(viz._nodes.columns)}\")\nprint(\"\\nSample nodes:\")\ndisplay(viz._nodes.head(3))\n\nprint(\"\\n\" + \"=\" * 80)\nprint(\"EDGES\")\nprint(\"=\" * 80)\nprint(f\"Shape: {viz._edges.shape}\")\nprint(f\"Columns: {list(viz._edges.columns)}\")\nprint(\"\\nSample edges:\")\ndisplay(viz._edges.head(3))"
122117
},
123118
{
124119
"cell_type": "code",
@@ -233,6 +228,18 @@
233228
"Demonstrate robust error handling."
234229
]
235230
},
231+
{
232+
"cell_type": "code",
233+
"source": "# Request both Table and Graph formats in a single call\n# Graphistry automatically parses the Graph section for visualization\nboth_formats_viz = g.sentinel_graph(\n \"MATCH (n)-[e]->(m) RETURN * LIMIT 20\",\n response_formats=[\"Table\", \"Graph\"]\n)\n\nprint(f\"Nodes: {len(both_formats_viz._nodes)}, Edges: {len(both_formats_viz._edges)}\")\nboth_formats_viz.plot()",
234+
"metadata": {},
235+
"execution_count": null,
236+
"outputs": []
237+
},
238+
{
239+
"cell_type": "markdown",
240+
"source": "## Requesting Both Graph and Table Formats\n\nPass `response_formats=[\"Table\", \"Graph\"]` to get both structured graph data and the raw tabular rows in a single API call. Graphistry will parse the `Graph` section; the `Table` section is available for additional inspection if needed.",
241+
"metadata": {}
242+
},
236243
{
237244
"cell_type": "code",
238245
"execution_count": null,
@@ -319,4 +326,4 @@
319326
},
320327
"nbformat": 4,
321328
"nbformat_minor": 4
322-
}
329+
}

0 commit comments

Comments
 (0)