Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BATCH SQL scripts do not work? #8419

Closed
hrstoyanov opened this issue Jul 19, 2018 · 1 comment
Closed

BATCH SQL scripts do not work? #8419

hrstoyanov opened this issue Jul 19, 2018 · 1 comment

Comments

@hrstoyanov
Copy link

OrientDB Version: 3.0.5-SNAPSHOT

Java Version: 8

OS: any

I am trying to do some basic scripting following the docs - i can not get it to work at all;

DELETE FROM Account unsafe;
DELETE FROM Staffer unsafe;
DELETE FROM Account unsafe;
LET $i= 0 ;
WHILE($i<10){
    LET account = CREATE VERTEX Account SET name='Account '+$i, stripeId='stripe'+$i, emailAddress='inof@account'+$i+'.com', livemode=false, subscriptionStatus='active', subscriptionLivemode=false ;
    LET $i = $i + 1;
}

gives me :

Delete record(s) '[{count:0}]' in 0.002000 sec(s).

Delete record(s) '[{count:0}]' in 0.001000 sec(s).

Delete record(s) '[{count:0}]' in 0.001000 sec(s).

!Unrecognized command: 'LET $i= 0'

@hrstoyanov hrstoyanov changed the title SQL scripts do not work? BATCH SQL scripts do not work? Jul 19, 2018
@hrstoyanov
Copy link
Author

It is even more weird! If I try this:

begin
DELETE FROM Account unsafe;
LET account = CREATE VERTEX Account SET name='Account1', stripeId='stripe1', emailAddress='info1@accounts.com', livemode=false, subscriptionStatus='active', subscriptionLivemode=false ;
commit

I get:

WARNING - Transactions are not supported from console in remote, please use an sql script:
eg.

script sql
begin;
<your commands here>
commit;
end


Delete record(s) '[{count:0}]' in 0.001000 sec(s).

!Unrecognized command: 'LET account = CREATE VERTEX Account SET name='Account1', stripeId='stripe1', emailAddress='info1@accounts.com', livemode=false, subscriptionStatus='active', subscriptionLivemode=false'

then when I try to correct the code based on the message above:

script sql
begin;
DELETE FROM Account unsafe;
LET account = CREATE VERTEX Account SET name='Account1', stripeId='stripe1', emailAddress='info1@accounts.com', livemode=false, subscriptionStatus='active', subscriptionLivemode=false ;
commit;
end

I get:

[Started multi-line command. Type just 'end' to finish and execute]

Error: com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error parsing query:

    ^
Encountered " <BEGIN> "begin "" at line 1, column 1.
Was expecting one of:
    <WHILE> ...
    <IF> ...
    <FOREACH> ...
    ";" ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants