Is there a way to truncate a graph using Java?
Got this from Jonathan:
You can run system queries by building a SimpleGraphStatement with the query as a string:
GraphStatement s = new SimpleGraphStatement("system.graph('demo').ifExists().truncate()") .setSystemQuery(); dseSession.executeGraph(s);
Sean, that's what I do. I've got it coded a few different ways.
In my integration tests class, I first make sure that allow_scan is enabled and then run g.V().drop().iterate().
I have a data loader code that uses DSE Analytics with the Java API (and let me tell you, coding Spark with Java is a pain, but I'm in a Java-only shop and Scala wouldn't fly here.). It too uses g.V().drop().iterate(), but it seems to take a long time even with graphs that are just a few GB of data.
I suspect that there's some bookkeeping that DSE Graph is wanting to do in the background which prevent it from just doing a TRUNCATE TABLE operation on each table.
5 People are following this question.