4

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?
Ashish Gupta
  • 14,869
  • 20
  • 75
  • 134

3 Answers3

1

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.

FrobberOfBits
  • 17,634
  • 4
  • 52
  • 86
  • on #2-> so where do the columns translate/map to in the graph world. How do I keep components of a traction in a table together or grouped (like they were in a table, via columns). –  Oct 15 '14 at 20:00
  • 2
    Columns become node properties. So an "employees" table probably becomes a set of nodes with the label `Employee`. The "fname" attribute of the employees table becomes a property called "fname" on nodes labeled `Employee` – FrobberOfBits Oct 16 '14 at 12:40
  • I was thinking a Node would be a column, and the records would be an instance of it. From your comment I see Node is the instance, and the `schema` has to be maintained outside in the app (realizing that we dont have to follow a schema. –  Oct 17 '14 at 18:56
  • 2
    Yes, you're absolutely correct that an individual node is like an instance record in a database, NOT a table. – FrobberOfBits Oct 17 '14 at 19:52
0

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.

weinberger
  • 71
  • 2
  • **Because they're hybrid, I'm lost on what to export, and import where**, does document hold the data or the node... I've been on their website a lot, and there is no guidance, my friend also wrote them and there was no response. 1) What make Arrango challenging is the **lack of tooling, here Neo4j I found was more mature.** However, the architecture of Arrango, with its hybrid nature is so much more enticing. **If only we could it work with .Net** and maintain an upgrade path easily. 2) Arrango is relatively new, and I'm constantly in the hot seat when I back something new! 3) –  Oct 16 '14 at 03:09
  • I also wanted to share in Arrango's case - while I really like them, the licensing model for a startup is quite high, so we were considering lucene or elastic search with mongo (but they're not graphDB). In applicability, I believe ArrangoDb can outshine Neo4j... not sure about the ease of integration and use! –  Oct 16 '14 at 03:09
  • If you write to "hackers (at) arangodb.org" you normally get a response within a day. Please keep in mind that there might be a time difference. – fceller Oct 16 '14 at 09:13
  • I think the challenge here is, that you need to "switch" your modelling approach (in any case). Tools can help a bit, but I assume there will be no automatic tool to do the job. There is a .NET driver for ArangoDB on the web-site. – fceller Oct 16 '14 at 09:15
  • One of our technical managers is very gungho about your DB, and the possibilities. So he tried to "switch" our approach, soon found out, 1) you're also an app container - now from a .Net world, how does that translate, are you OWIN, self hosting, can we run the CLR or manage it via Arango - A good health picture on the site would help a lot. 2) how can we maintain the metadata, or schema, outside so it can be understood modified or managed - maybe this is the tooling you're referring to 3) –  Oct 17 '14 at 05:03
0

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.

nikolai.serdiuk
  • 762
  • 8
  • 11