4

I have developed a .net project which has a SQL database. I want to know is there any way, that I can import my SQL DB file into the neo4j database directly?

sasi
  • 4,192
  • 4
  • 28
  • 47
user862226
  • 129
  • 2
  • 8
  • Do you mean avoiding writing a program to do it? i.e. you want a function on the neo4j server that you can point at a sql server instance and have it just read the server? – Charlotte Skardon Oct 08 '13 at 06:43
  • yes, something like that , or rather than creating tables and data in neo4j server cypher language it can accept sql language, so I can use sql export tools and run the script at neo4j server and import them there – user862226 Oct 08 '13 at 09:22
  • Graph databases and relational databases are two different worlds. Exactly what do you mean by importing it "directly"? – Werner Kvalem Vesterås Oct 08 '13 at 10:04
  • well, I am using LINQ to sql to talk to my database , I want to replace it with graph database, so my programme can talk to graph database , I saw on Tatham video [http://vimeo.com/43676873], that he import some data into the graph database and then he query against it from its programme, I wonder how can I import my data to it all in one go or ask it to use my sql database – user862226 Oct 08 '13 at 10:52
  • There is: http://neo4j.org/develop/import with some information on how to import data from relational databases. Also https://github.com/peterneubauer/sql-import – Michael Hunger Oct 10 '13 at 11:03

3 Answers3

11

Chris Skardon is right, you might want to iron out the categories a little bit. Neo4j is not a graph layer on top of a relational database, it is a competing/complementary kind of database. While it's possible to imitate your relational schema in Neo4j, its probably not very useful, and you will likely have to do a some remodeling to benefit from using Neo4j.

If you decide you do want to transfer data from your SQL database to Neo4j, but prefer not to code the actual import yourself, here are some tips and tools to look at. (I apologize for the list being so Java-centric, but I haven't interacted with Neo4j from .NET yet––I'm sure someone else here can help.)

I would, however, humbly recommend writing as much of your own code as possible for interacting with Neo4j. Probably someone else has done it better (at least that's what I tend to find) but writing it yourself will greatly enhance your understanding of the database and APIs and you will get much better mileage when you really know how to drive.

jjaderberg
  • 9,844
  • 34
  • 34
0

I don't know of any way Neo4j can import SQL directly, you mention you're using LinqToSQL to read your DB currently, so I presume you also have a set of classes representing your data?

As far as I know, your best bet is to read the data in via your LinqToSQL code, and then push it into the Neo4j database. However you will want to make sure your code makes sense, for example, you say

rather than creating tables and data

Neo4j has no concept of tables, I would spend time experimenting with a limited subset of the data you have to see if it actually makes sense to spend any time migrating. You may/probably will find your current data objects don't make sense in a graph world...

Charlotte Skardon
  • 6,220
  • 2
  • 31
  • 42
0

In addition to jjaderberg answer here, you can use Talend Open Studio for Big Data to query SQL server and import the results to Neo4j graph directly without export it to .csv or spreadsheets first.
Here is a tutorial on how to use Talend with Neo4j: http://neo4j.com/blog/fun-with-music-neo4j-and-talend/
Note that he is using .csv, but you can easily use task tMSSqlInput as a data source instead, task [tNeo4jOutput] as destination for your data, and task [tNeo4jOutputRelationship] for graph relationships.

yass
  • 1,066
  • 8
  • 12
  • I wrote a blog post walks through a method to import data into Neo4j from Microsoft SQL Server directly, you can check it at: [Import Data into Neo4j from MS SQL Server Directly using Talend](http://lucidwebdreams.wordpress.com/2014/07/24/import-data-into-neo4j-from-ms-sql-server-directly-using-talend/) – yass Jul 24 '14 at 08:59