[英]Connecting to Neo4j database after importing CSV
I have imported my csv files using the neo4j-admin according to the documentation using the following command我已经根据 文档使用以下命令使用 neo4j-admin 导入了我的 csv 文件
/bin/neo4j-admin import --mode=csv --nodes all_nodes_ne_header.csv,all_nodes_ne.csv --relationships all_relations_ne_header.csv,all_relations_ne.csv
the result looks like结果看起来像
IMPORT DONE in 15s 997ms.
Imported:
19354 nodes
11759454 relationships
58062 properties
Peak memory usage: 1.03 GB
and I can see a file called graph.db
in the data/databases
folder.我可以在data/databases
文件夹中看到一个名为graph.db
的文件。
I go to python and do:我去 python 并执行以下操作:
from py2neo import Graph, Node, Relationship, Database
%matplotlib inline
%load_ext cypher
default_db = Database(db = Database())
graph = Graph("bolt://localhost:3637")
and after running my query I get the following:运行我的查询后,我得到以下信息:
Format: (http|https)://username:password@hostname:port/db/name
...
ConnectionError: HTTPConnectionPool(host='localhost', port=7474): Max retries exceeded with url: /db/data/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x12e269790>: Failed to establish a new connection: [Errno 61] Connection refused'))
I guess I am not doing the connection correctly within Python and didn't find anywhere in the documentation how to do it.我想我没有在 Python 中正确地进行连接,也没有在文档中的任何地方找到如何做到这一点。 Basically, I have not set any password, username and even don't the port.基本上,我没有设置任何密码、用户名,甚至没有设置端口。 I generated a report using neo4j-admin report
and there was not anything relevant either.我使用neo4j-admin report
生成了一份neo4j-admin report
,但也没有任何相关内容。 therefore, I appreciate your comments on how I can build the connection and start querying from python.因此,我感谢您对我如何建立连接并从 python 开始查询的评论。
One has to to the config file and edit the following line in the neo4j.config
必须到配置文件并在neo4j.config
编辑以下行
# The name of the database to mount
dbms.active_database=graph.db
then can run ./bin/neo4j consol
然后可以运行./bin/neo4j consol
the output should end like输出应该像
Starting Neo4j.
2019-12-01 23:42:14.731+0000 INFO ======== Neo4j 3.5.3 ========
2019-12-01 23:42:14.743+0000 INFO Starting...
2019-12-01 23:42:16.599+0000 INFO Bolt enabled on 127.0.0.1:7687.
2019-12-01 23:42:18.122+0000 INFO Started.
2019-12-01 23:42:19.065+0000 INFO Remote interface available at http://localhost:7474/
then going back to the jupyter notebook ...然后回到 jupyter notebook ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.