neo4j-client是Neo4j的命令行shell(CLI)。它支持与Neo4j服务器的安全连接,发送语句(包括多行语句)、持久命令行历史记录以及将结果渲染成表或CSV。
neo4j-client 使用Bolt网络协议,并可在任何支持Bolt的服务器上工作。
环境要求:
neo4j-client可在GNU/Linux,MacOSX和FreeBSD平台上运行,需要neo4j3.0.0或更高版本。
neo4j-client的用法
Exampleinteractiveusage:
$ neo4j-client -u neo4j localhostThe authenticity of host 'localhost:7687' could not be established.TLS certificate fingerprint is ded0fd2e893cd0b579f47f7798e10cb68dfa2fd3bc9b3c973157da81bab451d74f9452ba99a9c5f66dadb8a360959e5ebd8abb2d7c81230841e60531a96d268.Would you like to trust this host (NO/yes/once)? yesPassword: *****neo4j> :helpEnter commands or cypher statements at the prompt.Commands always begin with a colon (:) and conclude at the end of the line,for example `:help`. Statements do not begin with a colon (:), may spanmultiple lines, are terminated with a semi-colon (;) and will be sent tothe Neo4j server for evaluation.Available commands::quit Exit the shell:connect '<url>' Connect to the specified URL:connect host [port] Connect to the specified host (and optional port):disconnect Disconnect the client from the server:export Display currently exported parameters:export name=val ... Export parameters for queries:unexport name ... Unexport parameters for queries:reset Reset the session with the server:set Display current option values:set option=value ... Set shell options:unset option ... Unset shell options:status Show the client connection status:help Show usage information:format (table|csv) Set the output format:width (<n>|auto) Set the number of columns in the table outputFor more information, see the neo4j-client(1) manpage.neo4j>neo4j> :statusConnected to 'neo4j://neo4j@localhost:7687'neo4j>neo4j> MATCH (n:Person) RETURN n LIMIT 3;+----------------------------------------------------------------------------+| n |+----------------------------------------------------------------------------+| (:Person{born:1964,name:"Keanu Reeves"}) || (:Person{born:1967,name:"Carrie-Anne Moss"}) || (:Person{born:1961,name:"Laurence Fishburne"}) |+----------------------------------------------------------------------------+neo4j>neo4j> :set echo=off // echo non-interactive commands before rendering results insecure=no // do not attempt to establish secure connections format=table // set the output format (`table` or `csv`). outfile= // redirect output to a file username="neo4j" // the default username for connections width=auto // the width to render tables (`auto` for term width)neo4j>neo4j> :quit$Examplenon-interactiveusage:
$ echo "MATCH (n:Person) RETURN n.name AS name, n.born AS born LIMIT 3" | \ neo4j-client -u neo4j -P localhost > result.csvPassword: *****$$ cat result.csv"name","born""Keanu Reeves",1964"Carrie-Anne Moss",1967"Laurence Fishburne",1961$
评论