neo4j / neo4j-javascript-driver

Neo4j Bolt driver for JavaScript
https://neo4j.com/docs/javascript-manual/current/
Apache License 2.0
853 stars 148 forks source link

:auto statement not working #1136

Closed mipcios closed 1 year ago

mipcios commented 1 year ago

Bug Report

When executing this query from a nodejs app :auto LOAD CSV WITH HEADERS FROM "file:///file.csv" AS csvLine FIELDTERMINATOR ';' CALL { ... } IN TRANSACTIONS

I get the following error:

Neo4jError: Invalid input ':': expected
  "ALTER"
  "CALL"
  "CREATE"
  "DEALLOCATE"
  "DELETE"
  "DENY"
  "DETACH"
  "DROP"
  "DRYRUN"
  "ENABLE"
  "FOREACH"
  "GRANT"
  "LOAD"
  "MATCH"
  "MERGE"
  "OPTIONAL"
  "REALLOCATE"
  "REMOVE"
  "RENAME"
  "RETURN"
  "REVOKE"
  "SET"
  "SHOW"
  "START"
  "STOP"
  "TERMINATE"
  "UNWIND"
  "USE"
  "USING"
  "WITH" (line 1, column 1 (offset: 0))
":auto LOAD CSV WITH HEADERS FROM "file:///file.csv" AS csvLine FIELDTERMINATOR ';'     CALL {   ...  } IN TRANSACTIONS;"

I can execute that query from the browser with no issue at all.

My Environment

Javascript Runtime Version: node 20 Neo4j Version: 5.7.0 neo4j-driver: 5.11.0 Operating System: Ubuntu 20.04

bigmontz commented 1 year ago

Hey @mipcios, thanks for reporting.

this is not an issue. Browser has a set of commands started : which are not cypher code, but special Browser commands.

Afaik, The :auto command runs the query in a auto-commit transaction. This can be done in the driver by calling session.run("your query", params).

mipcios commented 1 year ago

Okey, thanks for the input. Great library.