Reset database through HTTP?

336 views
Skip to first unread message

Johnny Weng Luu

unread,
Dec 25, 2011, 3:42:18 AM12/25/11
to ne...@googlegroups.com
Is there a way to reset the database to an empty state through HTTP for my integration tests?

Or do I have to fetch all nodes and relationships and delete them manually?

Peter Neubauer

unread,
Dec 25, 2011, 4:41:05 AM12/25/11
to ne...@googlegroups.com
Michael has written
https://github.com/jexp/neo4j-clean-remote-db-addon that comes in
handy there ...

Cheers,

/peter neubauer

Google:neubauer.peter
Skype:peter.neubauer
Phone: +46 704 106975
LinkedIn   http://www.linkedin.com/in/neubauer
Twitter      @peterneubauer

brew install neo4j && neo4j start
heroku addons:add neo4j

Johnny Weng Luu

unread,
Dec 25, 2011, 4:51:05 AM12/25/11
to ne...@googlegroups.com
I am using the hosted Neo4j instance from Heroku.

How do I use this plugin there?

Johnny

James Thornton

unread,
Dec 25, 2011, 4:52:10 AM12/25/11
to ne...@googlegroups.com
Use the Gremlin plugin (http://docs.neo4j.org/chunked/1.4/gremlin-plugin.html) to execute the script g.clear()...

BODY '{"script"="g.clear()"}'

The Gremlin plugin provides Groovy scripting access to the:

1. Gremlin API

2. Blueprints API

3. Neo4j Java API

The g.clear() method is part of the Blueprints API (http://tinkerpop.com/maven2/com/tinkerpop/blueprints/blueprints/1.1/api/), and Neo4j Server pre-sets the Blueprints Graph var "g" var for you. 

FYI: To get a reference to the raw Neo4j graph so you can use the Neo4j Java API, use the Blueprints getRawGraph() method:

neo4j = g.getRawGraph();


- James

Johnny Weng Luu

unread,
Jan 16, 2012, 4:28:29 AM1/16/12
to ne...@googlegroups.com
Is there a way to delete all nodes except the reference node(0) ?

Johnny

Johnny Weng Luu

unread,
Jan 16, 2012, 4:38:52 AM1/16/12
to ne...@googlegroups.com
An error I got:

javax.script.ScriptException: java.lang.RuntimeException: read only index

I can't delete the auto_nodex_index manually either.

Any clue?

Peter Neubauer

unread,
Jan 16, 2012, 10:55:15 AM1/16/12
to ne...@googlegroups.com
https://github.com/jexp/neo4j-clean-remote-db-addon is probably the
best way to remove the DB right if you have autoindexing involved.

Cheers,

/peter neubauer

Google:    neubauer.peter
Skype:     peter.neubauer
Phone:     +46 704 106975
LinkedIn:  http://www.linkedin.com/in/neubauer
Twitter:    @peterneubauer

Tungle:    tungle.me/peterneubauer

brew install neo4j && neo4j start
heroku addons:add neo4j

Johnny Weng Luu

unread,
Jan 20, 2012, 5:32:35 AM1/20/12
to ne...@googlegroups.com
How can I use the plugin with the Heroku addon?

Johnny

Peter Neubauer

unread,
Jan 20, 2012, 5:34:33 AM1/20/12
to ne...@googlegroups.com
Johnny,
adding plugins on hosted instances is in the works, currently you
can't. Gremlin removing is probably the best thing to do there.

Cheers,

/peter neubauer

Google:    neubauer.peter
Skype:     peter.neubauer
Phone:     +46 704 106975
LinkedIn:  http://www.linkedin.com/in/neubauer
Twitter:    @peterneubauer
Tungle:    tungle.me/peterneubauer

brew install neo4j && neo4j start
heroku addons:add neo4j

Johnny Weng Luu

unread,
Jan 20, 2012, 5:36:18 AM1/20/12
to ne...@googlegroups.com
It doesn't work since there is an node_auto_index that can't be deleted.

Johnny

Peter Neubauer

unread,
Jan 20, 2012, 5:39:08 AM1/20/12
to ne...@googlegroups.com, Thomas baum
Ok,
that is an issue. Let me circle back with Thomas and see if we can
deploy the clean-plugin on Heroku. Per default.

Cheers,

/peter neubauer

Google:    neubauer.peter
Skype:     peter.neubauer
Phone:     +46 704 106975
LinkedIn:  http://www.linkedin.com/in/neubauer
Twitter:    @peterneubauer
Tungle:    tungle.me/peterneubauer

brew install neo4j && neo4j start
heroku addons:add neo4j

On Fri, Jan 20, 2012 at 11:36 AM, Johnny Weng Luu

Johnny Weng Luu

unread,
Jan 20, 2012, 5:40:42 AM1/20/12
to ne...@googlegroups.com
That would be great for testing purpose!

Johnny

Peter Neubauer

unread,
Jan 28, 2012, 7:05:45 AM1/28/12
to ne...@googlegroups.com
Yes,
this is a valid issue, added
https://github.com/neo4j/cloud-issues/issues/2 to track it.

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

Neo4j 1.6 released                 - dzone.com/6S4K
The Neo4j Heroku Challenge   - http://neo4j-challenge.herokuapp.com/

On Fri, Jan 20, 2012 at 11:40 AM, Johnny Weng Luu

Reply all
Reply to author
Forward
0 new messages