Neo4j-shell: unterminated multi-line input

(Jiropole) #1

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!

(Michael Hunger) #2

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.

(Jiropole) #3

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.


CALL apoc.schema.assert({}, {});

(Michael Hunger) #4

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

(Jiropole) #5

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(

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

(Jiropole) #6

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?

(Michael Hunger) #7

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

(Jiropole) #8

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.

(Michael Hunger) #9

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