导入 CSV 后连接到 Neo4j 数据库
Connecting to Neo4j database after importing CSV
我已经根据 documentation 使用以下命令
使用 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
结果看起来像
IMPORT DONE in 15s 997ms.
Imported:
19354 nodes
11759454 relationships
58062 properties
Peak memory usage: 1.03 GB
我可以在 data/databases
文件夹中看到一个名为 graph.db
的文件。
我去 python 做:
from py2neo import Graph, Node, Relationship, Database
%matplotlib inline
%load_ext cypher
default_db = Database(db = Database())
graph = Graph("bolt://localhost:3637")
在 运行 我的查询之后,我得到以下信息:
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'))
我想我没有在 Python 中正确地进行连接,并且在文档中没有找到如何进行连接的任何地方。基本上,我没有设置任何密码、用户名甚至端口。我使用 neo4j-admin report
生成了一份报告,但也没有任何相关内容。因此,非常感谢您对我如何建立连接并从 python.
开始查询的评论
必须转到配置文件并在 neo4j.config
中编辑以下行
# The name of the database to mount
dbms.active_database=graph.db
那么可以运行./bin/neo4j consol
输出结果应该像
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/
然后回到 jupyter notebook ...
我已经根据 documentation 使用以下命令
使用 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
结果看起来像
IMPORT DONE in 15s 997ms.
Imported:
19354 nodes
11759454 relationships
58062 properties
Peak memory usage: 1.03 GB
我可以在 data/databases
文件夹中看到一个名为 graph.db
的文件。
我去 python 做:
from py2neo import Graph, Node, Relationship, Database
%matplotlib inline
%load_ext cypher
default_db = Database(db = Database())
graph = Graph("bolt://localhost:3637")
在 运行 我的查询之后,我得到以下信息:
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'))
我想我没有在 Python 中正确地进行连接,并且在文档中没有找到如何进行连接的任何地方。基本上,我没有设置任何密码、用户名甚至端口。我使用 neo4j-admin report
生成了一份报告,但也没有任何相关内容。因此,非常感谢您对我如何建立连接并从 python.
必须转到配置文件并在 neo4j.config
# The name of the database to mount
dbms.active_database=graph.db
那么可以运行./bin/neo4j consol
输出结果应该像
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/
然后回到 jupyter notebook ...