How do I execute a batch of OriD db script?

This is the first time I am playing with a strange db. I run it and run simple scripts through the console.

However, I really want to use additional SQL Batch commands like 'let.'

eg. sample script from wiki:

begin
let account = create vertex Account set name = 'Luke'
let city = select from City where name = 'London'
let edge = create edge Lives from $account to $city
commit retry 100
return $edge

      

If I write a script using these commands, the console throws errors as they don't seem to be supported. The wikis believe that they are only available through the Java and HTTP APIs.

Inserting script content in Studio works great, but it's a rather unsatisfactory way to run a simple script.

Am I missing something or is there no way to run a script containing SQL Batch commands via a simple command line command line?

+3


source to share


1 answer


You can execute it from the console using the command script sql

. Don't forget to close it by typing end

on a new line. Example:



MacBook-Pro:bin luca$ ./console.sh

OrientDB console v.2.0-SNAPSHOT (build 2539) www.orientechnologies.com
Type 'help' to display all the supported commands.
Installing extensions for GREMLIN language v.2.6.0

orientdb> connect plocal:/temp/databases/ETLDemo admin admin

Connecting to database [plocal:/temp/databases/ETLDemo] with user 'admin'...OK
orientdb {db=ETLDemo}> script sql
[Started multi-line command. Type just 'end' to finish and execute]
orientdb {db=ETLDemo}> begin
orientdb {db=ETLDemo}> let a = create vertex v
orientdb {db=ETLDemo}> commit retry 100
orientdb {db=ETLDemo}> end

Server side script executed in 0,117000 sec(s). Value returned is: V#9:199 v1
orientdb {db=ETLDemo}>

      

+3


source







All Articles