简体   繁体   中英

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

/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.

I go to python and do:

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. 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. therefore, I appreciate your comments on how I can build the connection and start querying from python.

One has to to the config file and edit the following line in the neo4j.config

# The name of the database to mount
dbms.active_database=graph.db

then can run ./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 ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM