简体   繁体   中英

Migrating from SQL Server to neo4j , is there something like SSMS to import data into neo4j

I'm migrating from SQL Server to Neo4J (or ArangoDB, much more challenging), currently using the Windows stack, and C#. I saw the batch importer on github[ https://github.com/jexp/batch-import/tree/20 ].

This util is an export tool, but I can't figure out where the rels.csv and nodes.csv are, on the export side (I see it on the import into neo4j). Is this an option in the util, or is this something I tell SSMS (SQL Server Management Studio) to create. More specifically, what is the difference rels and nodes from a SQL RDB standpoint?

To migrate the data - what options/steps do I need to follow to, set so that I can 1) export from SQL Server 2) Import into Neo4j that can easily work with the .netdriver/client?

Here is what I know on the import, but not on the export side.

batch_import.nodes_files=nodes1.csv[,nodes2.csv]
batch_import.rels_files=rels1.csv[,rels2.csv]

Is there an import tool, like SSMS import in Neo4j, that will help in this and translate/keep the relationships as nodes to nodes

Am I correct in thinking this way -

  • Do schema tables map to nodes?
  • Do table columns/attributes map to (table) nodes in neo4j
  • Do FK's and PK's translate to relationships or labels?

I'll try to provide brief, succinct answers to your specific questions, but on the data modeling topics, you need to read some background. Check out Data Modeling in Graphs for a good intro. I'm not giving you the whole story here, becuase you're asking a question that requires an in-depth answer. That briefing is that answer.

  1. Do schema tables map to nodes? Sort of, yes - the way I would put it is more that in a relational database, "entities" map to nodes. Note that "entities" and "tables" are really not the same thing due to normalization and many other factors. Also, not all of the schema table maps to a node, in particular because tables include things like PKs/FKs which you won't use in neo4j (more on this in a moment)

  2. Do table columns/attributes map to (table) nodes in neo4j. No, they don't. Attributes map on to node attributes, but there are many exceptions. In particular, any attribute that you're using to join things on in a relational database likely maps to a neo4j relationship, not a node attribute.

  3. Do FK's and PK's translate to relationships or labes? They map to relationships. Any kind of joining is generally going to translate into a relationship between nodes.

I can only give you an general answer on how to import graph data into ArangoDB. Also checkout FrobberOfBits answers. For a more specific answer, please contact "hackers (at) arangodb.org".

Normally the sql schema corresponds to some entities, which are visible as C# objects. The modelling of a class hierarchy can done in different ways. Such entity would correspond to documents in ArangoDB.

For example: One way of modelling vehicles, cars and motorcycle is using three tables. One for the superclass and two for the subclass. There will be foreign keys to link the the subclass data to the superclass data. In ArangoDB there will only be a vehicle class and the documents contain attributes vary depending if it is a car or a motorcycle.

Now there might be a relationship between a person and a vehicle. This is different from the above example - also again foreign keys are used. In this case you would a edge in ArangoDB between two documents.

So you need an export to create all the documents (entities) and all the edges (relationship). You can then use "arangoimp" to import these files into ArangoDB.

You can export your data from sql server using export data tool of sql server management studio. Then you can use neo4j-admin tool to import these CSV files. But additionally you should create header CSV files to describe nodes properties and relationships. For relationships CSV files you should write sql queries and again generate CSV files with export data tool of sql server management studio.

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