Skip to content

Commit 6b88b69

Browse files
Merge pull request #4933 from MicrosoftDocs/main
Auto Publish – main to live - 2026-05-01 22:04 UTC
2 parents 600a986 + eb0a059 commit 6b88b69

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

articles/postgresql/azure-ai/generative-ai-age-overview.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,35 @@ Foreign-key constraints:
150150
Access method: heap
151151
```
152152

153+
### Apache AGE Graph Visualization
154+
155+
The [PostgreSQL extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-ossdata.vscode-pgsql) lets you run Apache AGE Cypher queries and explore the results as an interactive node-edge graph. The extension automatically detects graph query results and renders them in a visual explorer with per-node callouts, zoom and pan controls, export support, and theme-aware styling. For more information on the extension, see [PostgreSQL extension](../developer/vs-code-extension/vs-code-overview.md).
156+
157+
To render results in the graph visualizer, your queries must meet the following requirements:
158+
- **Return full objects, not scalar properties** - The graph visualizer needs complete vertex and edge objects. Queries that extract scalar properties (`RETURN p.name, p.title`) return plain text values and won't render in the visualizer. Instead of returning properties, return the full objects and name the relationship variable:
159+
```sql
160+
SELECT * FROM cypher('my_graph', $$
161+
MATCH (a:Product)-[r:BOUGHT_TOGETHER]->(b:Product)
162+
RETURN a, r, b
163+
$$) AS (a agtype, r agtype, b agtype);
164+
```
165+
- **Set `disp_label` for meaningful node text** - Without `disp_label`, nodes display internal IDs. Set this property so the visualizer shows useful labels:
166+
```sql
167+
SELECT * FROM cypher('my_graph', $$
168+
MATCH (a:Product)-[r:BOUGHT_TOGETHER]->(b:Product)
169+
SET a.disp_label = a.title
170+
SET b.disp_label = b.title
171+
RETURN a, r, b
172+
$$) AS (a agtype, r agtype, b agtype);
173+
```
174+
- **Match output columns to returned objects** - The wrapper `AS (...)` clause must have one column per returned object. For multi-hop queries, include every intermediate node and edge:
175+
```sql
176+
SELECT * FROM cypher('my_graph', $$
177+
MATCH (a:Product)-[r1:BOUGHT_TOGETHER]->(mid:Product)-[r2:BOUGHT_TOGETHER]->(b:Product)
178+
RETURN a, r1, mid, r2, b
179+
$$) AS (a agtype, r1 agtype, mid agtype, r2 agtype, b agtype);
180+
```
181+
153182
## Related content
154183

155184
- [Azure Database for PostgreSQL documentation](../overview.md)

articles/postgresql/developer/vs-code-extension/vs-code-overview.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,35 @@ The Results Viewer enables you to interact with query results through features s
6464
- Search, filter, and sort options to analyze data efficiently.
6565
- Persistent data views to maintain context while navigating between tabs.
6666

67+
### Apache AGE Graph Visualization
68+
69+
The Apache AGE Graph Visualizer lets you run Apache AGE Cypher queries and explore the results as an interactive node-edge graph. The extension automatically detects graph query results and renders them in a visual explorer with per-node callouts, zoom and pan controls, export support, and theme-aware styling.
70+
71+
To render results in the graph visualizer, your queries must meet the following requirements:
72+
- **Return full objects, not scalar properties** - The graph visualizer needs complete vertex and edge objects. Queries that extract scalar properties (`RETURN p.name, p.title`) return plain text values and won't render in the visualizer. Instead of returning properties, return the full objects and name the relationship variable:
73+
```sql
74+
SELECT * FROM cypher('my_graph', $$
75+
MATCH (a:Product)-[r:BOUGHT_TOGETHER]->(b:Product)
76+
RETURN a, r, b
77+
$$) AS (a agtype, r agtype, b agtype);
78+
```
79+
- **Set `disp_label` for meaningful node text** - Without `disp_label`, nodes display internal IDs. Set this property so the visualizer shows useful labels:
80+
```sql
81+
SELECT * FROM cypher('my_graph', $$
82+
MATCH (a:Product)-[r:BOUGHT_TOGETHER]->(b:Product)
83+
SET a.disp_label = a.title
84+
SET b.disp_label = b.title
85+
RETURN a, r, b
86+
$$) AS (a agtype, r agtype, b agtype);
87+
```
88+
- **Match output columns to returned objects** - The wrapper `AS (...)` clause must have one column per returned object. For multi-hop queries, include every intermediate node and edge:
89+
```sql
90+
SELECT * FROM cypher('my_graph', $$
91+
MATCH (a:Product)-[r1:BOUGHT_TOGETHER]->(mid:Product)-[r2:BOUGHT_TOGETHER]->(b:Product)
92+
RETURN a, r1, mid, r2, b
93+
$$) AS (a agtype, r1 agtype, mid agtype, r2 agtype, b agtype);
94+
```
95+
6796
### GitHub Copilot integration
6897

6998
This extension integrates with GitHub Copilot to offer AI-driven assistance tailored to PostgreSQL development. With commands like `@pgsql`, you can query your database, optimize your schema, and even request Copilot to execute specific SQL operations. This feature enhances productivity by providing contextual guidance and actionable insights.

0 commit comments

Comments
 (0)