cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Can you query multiple dbs in one (fabric) cypher statement?

mike
Graph Buddy

Hi,

We are evaluating fabric but before testing I wanted to find out if there are any limitations on cypher queries (including GDS)

I understand this is possible:
Query db#1 and use output as input for a query to db#2

And also this;
Query db#1 and combine output with output from a query to db#2 (using UNION)

But is this possible?
Construct a query which includes labels/properties from both db#1 and db#2

e.g.

WITH ["db#1", "db#2"] AS dbs
UNWIND fabric.graphIds() AS graphId
CALL {
  USE fabric.graph(graphId)
  OPTIONAL MATCH (db1:Label {db1prop: ""})-[COMMON_REL]-(db2:Label { db2prop: ""})
  .....

If this could work I assume it would depend on having the node and relationship labels identical in both.

I read this but am still not clear

2 REPLIES 2

Yes if both have the same labels and rel-types you can send the same query to all shards.

But you currently cannot have relationships that span shards, so you need to have proxy nodes of that other shard that carry at least the id, to continue matching from.

mike
Graph Buddy

thanks for clarifying @michael.hunger