Splitting OSQL across multiple lines

106 views
Skip to first unread message

Charles Munat

unread,
Aug 14, 2015, 7:09:54 PM8/14/15
to OrientDB
I'm creating and seeding my database using .osql files loaded through the console (is this the best way?).

I have some large documents and I'm finding that I must do the insert entirely on one line, which can make for very long lines. I've tried numerous ways to split the lines and have searched the documentation for answers to no avail.

Is there a way to do inserts with multiple lines in an osql file loaded through the console?

I'm doing inserts like this:

insert into User set name = "Joe", emailAddress = "j...@schmoe.com"

Thanks!

Chas.

Giulia Brignoli

unread,
Aug 17, 2015, 3:33:13 AM8/17/15
to OrientDB
Hi Charles,

if you have already created the database with classes and want to do only the insertion through the file .osql, then you must create the file myscritp.osql in the bin folder of OrientDB like this:


connect remote:localhost/testScript admin admin;

insert into User(name, emailAddress) values ("Joe","j...@schmoe.com);
insert into User(name, emailAddress) values ("Bob","b...@schmoe.com);
insert into User(name, emailAddress) values ("Mike","m...@schmoe.com);
...


Then, after you create this file, access to the bin folder from the command line and run the following command:


console.bat myscript.osql
 

and this automatically performs the insertion of data.

Regards,
Giulia

Charles F. Munat

unread,
Aug 17, 2015, 5:58:19 AM8/17/15
to orient-...@googlegroups.com
Hi Guilia,

I am already doing this. The question I had was about spreading individual inserts across more than one line. In other words this:


insert into User(name, emailAddress)
  values ("Joe", "j...@schmoe.com");

As opposed to this:


insert into User(name, emailAddress) values ("Joe", "j...@schmoe.com");

When I include a line break it does not work. Some of the inserts are quite long and it would be nice to be able to break them up across lines.

Incidentally, I have no semicolons in my osql file and it seems to work fine, but maybe that's the problem?

Thanks!

Chas.
--

---
You received this message because you are subscribed to a topic in the Google Groups "OrientDB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/orient-database/dQg8ZbeiWAQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Luigi Dell'Aquila

unread,
Aug 24, 2015, 4:30:18 AM8/24/15
to orient-...@googlegroups.com
Hi Charles,

Which OrientDB version are you using? It should work fine in 2.1

Luigi


--

---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.

Charles F. Munat

unread,
Aug 24, 2015, 5:20:09 AM8/24/15
to orient-...@googlegroups.com
Yes, 2.1. I'll try again. Maybe I just did something dumb.

Thanks!
Reply all
Reply to author
Forward
0 new messages