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.

Check existence graph projection

Hello,

I would like to check if a graph projection exists and if yes, drop it.

Here is the code tried without success:
</>CALL gds.graph.list()
YIELD graphName
WITH graphName AS graph
CALL gds.graph.drop(graph)
YIELD graphName
RETURN graphName</>

Neo4j Kernel:4.4.2:enterprise
gdsVersion:1.8.2
neo4jVersion:4.4.2

Thank you for your help.

Julie

1 ACCEPTED SOLUTION

Hello @julie.cavarroc and welcome to the Neo4j community

You could use directly (doc😞

CALL gds.graph.drop('your-graph-name', false) YIELD graphName;

If you want to drop all graph projections:

CALL gds.graph.list()
YIELD graphName
WITH graphName AS g
CALL gds.graph.drop(g, false)
YIELD graphName
RETURN graphName

Regards,
Cobra

View solution in original post

4 REPLIES 4

Hello @julie.cavarroc and welcome to the Neo4j community

You could use directly (doc😞

CALL gds.graph.drop('your-graph-name', false) YIELD graphName;

If you want to drop all graph projections:

CALL gds.graph.list()
YIELD graphName
WITH graphName AS g
CALL gds.graph.drop(g, false)
YIELD graphName
RETURN graphName

Regards,
Cobra

Thank you for your answer.

It is for an automatic use. So I need:

  1. Check if the graph projection exists,
  2. If it exists, get the name and drop it by the command you suggest

Regards,
Julie

The query I sent you do the both at the time. It will delete the graph if it exists.

Hello @julie.cavarroc, did you need more help?