neo4j-contrib / neo4j-apoc-procedures

Awesome Procedures On Cypher for Neo4j - codenamed "apoc"                     If you like it, please ★ above ⇧            
https://neo4j.com/labs/apoc
Apache License 2.0
1.71k stars 494 forks source link

apoc.export.cypher.query with format:cypher-shell does not load in cypher-shell #731

Closed stuartlaurie closed 6 years ago

stuartlaurie commented 6 years ago

While trying to take a subset of a graph (so i could test re-factoring on a smaller set) I was trying a few ways to export/import.

when trying to export using (Neo4j 3.3.2 Enterprise - APOC 3.3.0.1)

call apoc.export.cypher.query("match (n)-[r]-(n2) return * limit 100","/tmp/mysubset_cyphershell.cypher",{format:'cypher-shell'})

and then

cat /tmp/mysubset_cyphershell.cypher | ./bin/cypher-shell

I get the following error:

Invalid input ':': expected <init> (line 1, column 1 (offset: 0))
":BEGIN"
 ^ 

When doing the export using the {format:plain} the pipe to cypher-shell works

I was expecting the format:cypher-shell to work with cypher-shell

jexp commented 6 years ago

Sorry that was an oversight :( during a refactoring.

Will be fixed in release this week, already in code.

jexp commented 6 years ago

Try this meanwhile: https://www.dropbox.com/s/v1chsae8jkfb8he/apoc-3.3.0.1.jar?dl=0

gabrielpires commented 4 years ago

Hi, I'm facing a similar issue.

NEO4J: 2019-12-09 22:54:09.510+0000 INFO ======== Neo4j 3.5.12 ======== APOC: apoc-3.5.0.6-all.jar

Error:

Failed to invoke procedureapoc.cypher.runFile: Caused by: org.neo4j.cypher.internal.v3_5.util.SyntaxException: Invalid input ':': expected <init> (line 2, column 1 (offset: 1))

Start of the file: :begin CREATE CONSTRAINT ON (node:WorkingDay) ASSERT (node.productHash, node.sku, node.supplierId, node.facilityId, node.dayOfWeek) IS NODE KEY; CREATE CONSTRAINT ON (node:ProductVariation) ASSERT (node.productHash, node.sku, node.supplierId) IS NODE KEY; CREATE CONSTRAINT ON (node:ProductionDay) ASSERT (node.supplierId, node.facilityId, node.productHash, node.sku, node.days) IS NODE KEY;

Export: call apoc.export.cypher.query("<QUERY OMITTED>","export_cypher_format_updateAll.cypher", {format:'cypher-shell',cypherFormat:'updateAll'})

Still not compatible?

conker84 commented 4 years ago

Are you using the cypher-shell for importing the file? In case so please try:

$ cat <your_folder>/export_cypher_format_updateAll.cypher | <NEO4J_HOME>/bin/cypher-shell -u username -p password

For a deep dive, please look at this article: https://medium.com/neo4j/efficient-neo4j-data-import-using-cypher-scripts-7d1268b0747

Feel free to ask if you need more infos

conker84 commented 4 years ago

@gabrielpires please look at the comment above :)

gabrielpires commented 4 years ago

@conker84 thanks for the return. I figure out that testing after I post my comment.

Thanks for the reference.