I've got three classes:
I have 3 Users, that won't usually change.
I have potentially 10000's of Links, and each one is connected to at least one of the Users (usually only one) via an Edge.
Is it possible to join these two commands, which are always called in succession, into one?
link = "insert into Links set title='Link 1'"
"create edge Edges
from ( select from Users where user_id='"+user_id+"')
to ( select from " + link._rid + ")"
That is some kind of pseudocode, I'm checking this out with pyorient
.
Take a look at SQL Batch.
Your command(s) might look like the following...
pyorient_client.batch("""begin
let link = create vertex Links set name = 'Link 1'
let user = select from Users where user_id = '{}' lock record
let edge = create edge Edges from $user to $link
commit
return $edge""".format(user_id)
)