Reputation: 73
I'm a Neo4j new user and I played around with the webadmin interface of Neo4j to create small databases and simple queries in Cypher. Now I want to use Neo4J to create a graph with my existing database. It's a postgresql database with millions of entries with the same structure (Neo4J is very adapted to represent these data). My question is how to import these data ? What is the easiest way to do that ? I already saw that Cypher recognizes csv files but do I have to create a csv file with my data or is there another way to import them ? Thank you for your help. Sam
Upvotes: 3
Views: 2066
Reputation: 11
Seconding the JDBC approach, there is a great documentation about using JDBC to connect with RDBMS. Summary of the steps plus extra steps not mentioned in docs:
$NEO4J_HOME
$NEO4J_HOME\plugins\
, check that $NEO4J_HOME\plugins\
contains APOC core and extended, and DBMS specific .jar filesCALL apoc.load.driver('{JDBC driver class name for the vendor}')
, this is a non exhaustive list of the namesCALL apoc.load.jdbc('jdbc:{connection string}','select * from {table name}') YIELD row
to test connectionUpvotes: 0
Reputation: 39915
One option is to export your postgres data to csv and apply LOAD CSV to import them into the graph.
Another way is writing a script in a language of choice (I'd vote for groovy here) that connects to Postgres using JDBC and connects to Neo4j and then applies the business logic to transform between the two.
A third option is using a ETL tool like Talend. It basically does the same as your custom script but provides a point & click interface to define the transformation, see http://neo4j.com/blog/fun-with-music-neo4j-and-talend/ for more details.
Upvotes: 1