Search code examples
memgraphdb

Are subqueries supported in Memgraph?


I am using Memgraph Platform 2.6.4 and I want to call a subquery within a query. For example:

UNWIND [0, 1, 2] AS n
CALL {
  RETURN 'hi' AS returnValue
}
RETURN returnValue

I couldn't find anything like that in Memgraph documentation, but saw it in Cypher best practices blog post. Is there a way to run subqueries in Memgraph?


Solution

  • Unfortunately, Memgraph doesn't support subqueries, but if you have a particular query maybe you can rewrite it using other constructs, or you can implement a custom query module. Here is a how-to guide on implementing a custom query module in Python, although you can do it in C/C++, Rust, or any other programming language that can be compiled to a shared object library.