Neo4j to Sql File

469 views
Skip to first unread message

Dilip

unread,
Sep 12, 2012, 6:24:03 AM9/12/12
to ne...@googlegroups.com
Hi

I need to convert the neo4j data into Sql file . help me out

Nigel Small

unread,
Sep 12, 2012, 6:36:01 AM9/12/12
to ne...@googlegroups.com
Hi Dilip

SQL is built for relational database and isn't relevant to Neo4j. What's your use case?

Nigel


On 12 September 2012 11:24, Dilip <dilip...@gmail.com> wrote:
Hi

I need to convert the neo4j data into Sql file . help me out

--
 
 

Dilip

unread,
Sep 12, 2012, 6:39:17 AM9/12/12
to ne...@googlegroups.com
Hi

Some how , I need to convert neo4j data into flat file /Sql file. 

Another Requirement 

I need to connect to Running neo4j instance and manipulate the data

Help me out

Jim Webber

unread,
Sep 12, 2012, 6:53:17 AM9/12/12
to ne...@googlegroups.com
Hi Dilip,

As Nigel hinted, there is no general tool to convert a graph to tables - it's domain specific. How to you want to convert "customer" nodes? To a "Customers" table? How will you link it back to the products they've bought, what does the join table look like?

The short answer is that you have to do the work to map between these two very different data models.

However on the neo4j side you can at least do a brute force search of the graph (in Cypher or Java, your choice) to ensure you don't miss anything. What you map that to in SQL is really your choice.


Jim

Nigel Small

unread,
Sep 12, 2012, 6:53:21 AM9/12/12
to ne...@googlegroups.com
One option would be to use the command line cypher tool in py2neo. With this, you can execute a query to output to CSV (among other formats). Simply install py2neo (using pip or easy_install) and run something like the following (this will export all nodes):

cypher -f csv "start n=node(*) return n"

You can of course redirect the output to a file or another process.

Hope this helps
Nige

--
 
 

Dilip

unread,
Sep 12, 2012, 8:16:31 AM9/12/12
to ne...@googlegroups.com
Thank very much

I need a another help

I have created a Graph using Java . I need a way to connect to graphdb and select few records

help me out

Michael Hunger

unread,
Sep 12, 2012, 8:19:16 AM9/12/12
to ne...@googlegroups.com
You just create a EmbeddedGraphDatabase pointing to the store-directory and then you use any of the methods described in this intro tutorial to retrieve nodes from the graph: id-lookup, index-lookup, traversals, cypher.


Michael

--
 
 

Dilip

unread,
Sep 12, 2012, 8:47:11 AM9/12/12
to ne...@googlegroups.com
I have installed py2neo , When i ran the query , the below error is thrown

[root@dbserver ~]# /usr/bin/cypher -D /data/duplicate/ -f csv "start n=node(*) return n"
  File "/usr/bin/cypher", line 136
    max(column_widths[i], None if row[i] is None else len(_stringify(row[i], with_properties=True)))
                                ^
SyntaxError: invalid syntax

Nigel Small

unread,
Sep 12, 2012, 9:12:38 AM9/12/12
to ne...@googlegroups.com
Can you check your python version? I develop under 2.7 and most should work under 2.6 although I may have missed something!

Nige


--
 
 

Reply all
Reply to author
Forward
0 new messages