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.

Multiple database access on a single query not quite there yet?

Hello, I tried to do this:

USE saguenay MATCH (i:Immeuble) WHERE exists(i.latitude) AND i.logements = 4
CALL
{
WITH i
USE suivi
MATCH (si:Immeuble {uuid:i.uuid})
RETURN si.couleur AS couleur
}
RETURN i.latitude AS lat, i.longitude AS lng, i.dureePossession AS duree, i.uuid AS uuid, couleur, 'saguenay' AS secteur

And I got this error:

Nested subqueries must use the same graph as their parent query.
Attempted to access graph suivi
"USE suivi"

And then I got sad, if I can't do that, I have to rethink the whole model.
Fabric is kind of useless if we can only use it with the UNION clause.

1 REPLY 1

I figured out something who works, but there is a lot of weird limitations with a virtual database.

CALL
{
USE quebec MATCH (i:Immeuble) WHERE exists(i.latitude) AND i.logements = 6
RETURN properties(i) AS i
}
CALL
{
WITH i
USE suivi
OPTIONAL MATCH (si:Immeuble {uuid:i.uuid})
RETURN si.couleur AS couleur
}
RETURN i.latitude AS lat, i.longitude AS lng, i.dureePossession AS duree, i.uuid AS uuid, couleur, 'saguenay' AS secteur

For now it works, hoping some future upgrades will remove some of theses weird not intuitive limitations:

  • Not possible to pass a node to the subclause, but you can pass the whole properties map...why?
  • Not possible to USE an another database then the parent one for subclause ( I triked it by using my 'local' fabric virtual database as the default database and by putting a CALL as the first clause of my query )
  • Can't use PROFILE with Fabric, your blind to fix your query performance ( But can still do it individually)
  • I don't remember the others but it seems there is a bunch of them

I think Fabric need a lot of intuitiveness improvement to fit with Cypher's intuitiveness.

But still, it's powerful and performance looks ok for now.