How to perform an atomic inserts?

114 views
Skip to first unread message

Dave

unread,
Jun 18, 2019, 7:52:54 AM6/18/19
to Gremlin-users
Hi

I'd like to know what is the recommended approach for achieving the atomic insert of a group of vertices and edges into a graph using bytecode queries and a remote Gremlin server?

I assumed that I should be using a single graph traversal, add the new elements and their properties and then commit with a terminal step, is this correct?

The reason I ask is that I keep coming up against issues that just don't occur if I use distinct traversals and don't worry about whether the inserts are atomic or not.

Thanks,

Dave

Fabio Lorenzi

unread,
Jun 18, 2019, 9:45:13 AM6/18/19
to Gremlin-users

Given bytecode traversals sent to a remote gremlin server, the traversal is treated as an atomic operation (persisted on success, rolled back on failure)
so...

>  I assumed that I should be using a single graph traversal, add the new elements and their properties and then commit with a terminal step, is this correct?

sounds like the correct approach.

Dave

unread,
Jun 18, 2019, 10:00:04 AM6/18/19
to Gremlin-users
Okay, thanks for the confirmation.

Stephen Mallette

unread,
Jun 18, 2019, 12:54:45 PM6/18/19
to gremli...@googlegroups.com
One thing to remember with transactions is that their behavior is somewhat dependent on the underlying graph database you are using. In other words, Gremlin Server will auto-commit for you at the end of the traversal execution and rollback on error, but the definition of commit() and rollback() is dependent on the graph itself. Make sure that you know how your graph works before making too many assumptions about what commit() and rollback() mean.

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/2b1cd7f3-1dd7-4020-b053-a60fe0425f3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages