Skip to content

ExecuteQuery

Source: src/AWS/NeptuneGraph/ExecuteQuery.ts

Runtime binding for neptune-graph:ExecuteQuery — run an openCypher query against a Neptune Analytics Graph.

Bind this operation to a Graph inside a function runtime to get a callable that automatically injects the graph identifier and grants the data-plane query actions (ReadDataViaQuery, WriteDataViaQuery, DeleteDataViaQuery) on the graph.

The response payload is a streaming body — collect it to parse the JSON result document.

Run an openCypher query

const executeQuery = yield* AWS.NeptuneGraph.ExecuteQuery(graph);
const response = yield* executeQuery({
queryString: "MATCH (n) RETURN count(n) AS nodes",
language: "OPEN_CYPHER",
});
const body = yield* Stream.mkString(
Stream.decodeText(response.payload),
);
const { results } = JSON.parse(body);

Write data with parameters

yield* executeQuery({
queryString: "CREATE (n:Person {name: $name})",
language: "OPEN_CYPHER",
parameters: { name: "Ada" },
});