cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Neo4j-shell: unterminated multi-line input

Jiropole
Graph Voyager

I’m having an issue importing from a cypher file using neo4j-shell -file <file>. The file includes transaction directives. The first few clear old data, reset and rebuild the schema. Then I have a ~300 line single query that seeds default data (runs fine in the browser). On this, the shell dies with “Transaction started\nWarning: Exiting with unterminated multi-line input.”

Is there a limit to the size of a query the shell can import? Thanks!

1 ACCEPTED SOLUTION

I think it should also work with cypher-shell if you moved your comments a bit, or perhaps use /* */ style comments

View solution in original post

8 REPLIES 8

Could it be that you either have stray quotes in your script, like 15" Monitor or perhaps an && which is command separator in neo4j-shell?

Please note that neo4j-shell is deprecated, and you should move to cypher-shell instead.

No stray quotes or &&. I tried with cat seeder.cql | cypher-shell, but this method does not seem to support multiple transactions in the file? For instance, if the following file only contains the first transaction, it works, but if the second is included, it dies.

:begin
MATCH (n) DETACH DELETE n
:commit

:begin
CALL apoc.schema.assert({}, {});
CREATE CONSTRAINT ON (n:Axis) ASSERT n.uuid IS UNIQUE;
:commit

Do you get any exceptions? How big is your graph? If it is too large you might want to batch the deletes.

Jiropole
Graph Voyager

The graph is quite tiny, under 300KiB, all-in.

With the above, the error is (and exception starting at org.neo4j.driver.internal.util.ErrorUtil.newNeo4jError(ErrorUtil.java:61):

WITH is required between DELETE and CALL (line 5, column 1 (offset: 42))
"CALL apoc.schema.assert({}, {});"
 ^

Derp, ok fixed by NOT omitting semicolons, even for single-statement transactions.

AND, I see my initial issue is due to having comments in the input file. Comments not supported with cypher-shell?

Yes, there is an open issue, for fixing comments in cypher-shell input files. Which has unfortunately not been addressed.

Thanks for the info! Well when I fixed my lack of semicolons, everything's working with neo4j-shell, for now. #newb. I'll watch for the bug to be fixed in cypher-shell so I can get on the modern stuff.

I think it should also work with cypher-shell if you moved your comments a bit, or perhaps use /* */ style comments