SQL Importer
From Neo4j Wiki
In order to ease rapid prototyping of data that is stored in existing RDBMS data structures, the SQLImporter component has been started at [1]
[edit] Different import strategies
Depending on the available metadata of your SQL export, you might have different strategies for importing it into a graph. By default, there are right now the following alternatives
[edit] Auto-import insert statements into Neo4j
If your SQL export data looks like
--Comment
Insert into Book
(BOOK_ID,TITLE,CREATED_DATE_TIME) values
(1,'Pippi Långstrump','2009-05-13');
Insert into Author
(AUTHOR_ID,NAME) values
(1,'Astrid Lindgren');
Insert into Author_Book
(AUTHOR_ID,BOOK_ID) values
(1,1);
Insert into Comment
(ID,BOOK_ID,CONTENT) values
(1,1,'best childrens book ever!');
--Comment
Insert into TEST
(ID,DATE,PROC) values
(132164, 2009-06-
05,some_proc('2009-06-
05','RRRR-MM-DD'));
Which is, there are field names available and you want to fast get in just the data, you will probably want to go for a first auto-import using code like
SQLImporter importer = new SQLImporter("target/db");
importer.autoImport("my.sql");
//make the links
importer.autoLink("Comment","BOOK_ID", "Book", "BOOK_ID", "talks_about");
importer.autoLink("Author_Book","Author","AUTHOR_ID", "Book", "BOOK_ID", "author_of");
//actually start the work
importer.startLinking();
resulting in a graph like
That is, the root node is linked to a subreference node holding all tuples for one table. the Subref node has a name property with the table name on it, something like
referenceNode--subref_Books-->node[name=subref_Book]--IS_A-->node[id=2, BOOK_ID=1,....]


