jexp / neo4j-shell-tools

A bunch of import/export tools for the neo4j-shell
289 stars 55 forks source link

Longs are converted to strings (Graphml backup and restore) #86

Open Sahasrara opened 8 years ago

Sahasrara commented 8 years ago

I dumped our neo4j database with export-graphml to a file. Then, in an empty database on another machine, I imported the file with import-graphml. We store dates as longs, and those were converted to strings during the import.

jexp commented 8 years ago

What does the keys section at the beginning of the file look like. What type is declared there?

Sahasrara commented 8 years ago

I don't see a keys section, but before the nodes section, I see this:


<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
<graph id="G" edgedefault="directed">

... nodes ...
...edges...

</graph>
</graphml>
Sahasrara commented 8 years ago

Ah! Looks like I forgot to add the -t option. Sorry about that. Thanks!

Sahasrara commented 8 years ago

Actually, even after adding in -t, some of the fields on some of the nodes don't have corresponding keys to specify their type. Here are two examples, both of them are Integers. I'm looking for others.

private Integer id;
private Integer requiredQuantity;
Sahasrara commented 8 years ago

I see other type="int" keys, so i don't think it's specific to the integers. Still digging.

Sahasrara commented 8 years ago

OK, so we have multiple nodes representing domain objects. These object have the same field names, but with different types. It appears that the keys use a global namespace for the typing. I don't know if this was a design choice reflecting something fundamental to the way neo4j works, or if maybe it just require more specificity.