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: articles/postgresql/azure-ai/generative-ai-age-overview.md
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -150,6 +150,35 @@ Foreign-key constraints:
150
150
Access method: heap
151
151
```
152
152
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
+
SETa.disp_label=a.title
170
+
SETb.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
+
153
182
## Related content
154
183
155
184
-[Azure Database for PostgreSQL documentation](../overview.md)
Copy file name to clipboardExpand all lines: articles/postgresql/developer/vs-code-extension/vs-code-overview.md
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,35 @@ The Results Viewer enables you to interact with query results through features s
64
64
- Search, filter, and sort options to analyze data efficiently.
65
65
- Persistent data views to maintain context while navigating between tabs.
66
66
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
+
SETa.disp_label=a.title
84
+
SETb.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
+
67
96
### GitHub Copilot integration
68
97
69
98
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