fastest way to export oracle database table into Neo4j

166 views
Skip to first unread message

abhi

unread,
Oct 8, 2013, 2:37:01 PM10/8/13
to ne...@googlegroups.com
How to export oracle database into Neo4j. In oracle I have around 55 million rows with 27 columns.Best and short way to export ? Any example.

Wes Freeman

unread,
Oct 8, 2013, 2:39:33 PM10/8/13
to ne...@googlegroups.com
Convert it to TSV files with something like: http://maxdemarzi.com/2012/02/28/batch-importer-part-2/

Use the batch-import tool (also mentioned above): https://github.com/jexp/batch-import

Wes

abhi

unread,
Oct 8, 2013, 3:20:53 PM10/8/13
to ne...@googlegroups.com
Thanks wes.actually in oracle db I have only one table.as per reference batch import it got two tables one for nodes and other for rels.In my case I have to create nodes with the set of column values and decide to create rels between them by iteration.so tsv file for rels to be manually created?

Wes Freeman

unread,
Oct 8, 2013, 3:26:41 PM10/8/13
to ne...@googlegroups.com
You're going to have to go through similar steps that max does. The first file creates nodes, indexed by line number. Then the second file for rels references the line numbers as "node ids" for start/end.

On Tue, Oct 8, 2013 at 3:20 PM, abhi <cbo...@gmail.com> wrote:
Thanks wes.actually in oracle db I have only one table.as per reference batch import it got two tables one for nodes and other for rels.In my case I have to create nodes with the set of column values and decide to create rels between them by iteration.so tsv file for rels to be manually created?

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

abhi

unread,
Oct 8, 2013, 3:30:17 PM10/8/13
to ne...@googlegroups.com
Yes.thanks for pointing me to right direction.I will try these steps. :)

abhi

unread,
Oct 9, 2013, 6:20:18 AM10/9/13
to ne...@googlegroups.com
See my oracle table contanis column values as :

id Amt Date PCName CName PDName DName

I want to create 4 nodes and create edges as between :

PCName --> CName
PDName --> DName
CName  --> DName

and place the attributes Amt and date on the edge between CName  --> DName.

Not able to figure it out how to use batch-importer on this. Because in this case how to use index number for node creation.

Mark Needham

unread,
Oct 9, 2013, 10:33:16 AM10/9/13
to ne...@googlegroups.com
Hi,

What I would do is build a map in memory for each node

e.g.

This:

id Amt Date PCName CName PDName DName
1 100 2013-10-09 A B C D

Would become:

[ {node_id : 1, name: "A", type: "PCName"}, {node_id : 2, name: "B",
type: "CName"}, {node_id : 3, name: "C", type: "PDName"}, {node_id :
4, name: "D", type: "DName"}]

Then before you write that to a nodes csv file you can sort it by the
node_id so everything is in order:

name type
A PCName
B CName
C PDName
D DName

You can then use those node ids to create an array of relationships

e.g.

[{ from: 1, to: 2}, { from: 3, to: 4}, { from: 2, to: 4, amt: 100,
date: "2013-10-09"}]

Then when you write that to a relationships csv file you'd end up with this:

from to amt date
1 2
3 4
2 4 100 2013-10-09

Hope that helps.
Message has been deleted

Michael Hunger

unread,
Oct 10, 2013, 5:29:08 AM10/10/13
to ne...@googlegroups.com
You can also use the csv batch inserter with index lookups which is a bit slower but should still work

Sent from mobile device

abhi

unread,
Oct 10, 2013, 6:00:07 AM10/10/13
to ne...@googlegroups.com
Hi Mark & Michael,

thanks for all your valuable input. Currently I am looking into it. My oracle table contains around 55millions rows with 25 columns. So worried about the import mechanism. But will give it a try.


Cheers .:)

Michael Hunger

unread,
Oct 10, 2013, 6:03:47 AM10/10/13
to ne...@googlegroups.com
Perhaps you can share a tiny fraction of your db as an sql insert file so we can demonstrate how to import it using the batch-inserter.

Cheers

Michael

Reply all
Reply to author
Forward
0 new messages