[Neo4j] Cleaning the DB programmatically
david.montag at neotechnology.com
Wed Jul 14 10:41:25 CEST 2010
If you could provide your code and Spring config, I could have a look at it
and see if I can help you out. A git/hg/svn repo would be great.
On Mon, Jul 12, 2010 at 6:45 PM, Georg M. Sorst <georgsorst at gmx.de> wrote:
> Hi Rick,
> admittedly I'm relatively new to Spring (and the whole Java thing) so
> there may well be better ways to do this. Anyway, the main reason for me
> to use Spring is the Dependency Injection / Inversion of Control.
> Unfortunately, this is keeping me from stopping, clearing and restarting
> Neo4j for each test as Spring is starting it up.
> Now of course I could set it all up manually for the tests but I like
> the convenience that DI offers. Also, I can use the same configuration I
> use in my actual application while only having to overwrite a few beans
> with mocks and stubs.
> Worth it?
> Best regards,
> On 12.07.2010 15:41, Rick Bullotta wrote:
> > Sounds like another good reason not to use Spring. ;-)
> > In your case, Georg, it certainly sounds like it would be best to delete
> > recreate. In essence, that's what you're doing anyway.
> > Can you help us understand what value you get from Spring in this
> > versus your own Neo lifecycle management code?
> > Rick
> > -----Original Message-----
> > From: user-bounces at lists.neo4j.org [mailto:user-bounces at lists.neo4j.org]
> > Behalf Of Georg M. Sorst
> > Sent: Monday, July 12, 2010 7:43 AM
> > To: Neo4j user discussions
> > Subject: Re: [Neo4j] Cleaning the DB programmatically
> > Hi Peter,
> > thanks for the reply. I can't say that it's not ok for me, can I? :)
> > In my previous mail I mentioned errors such as "Node[xyz] has been
> > deleted in this TX". Turns out I had forgotten to clean all indices
> > (because there does not seem to be a way to find out which indices exist
> > currently). Anyway, the errors are gone so I'm fine for now.
> > Just for reference, what I'm doing is:
> > - graph.getAllNodes()
> > - iterate over all the nodes
> > - for each node delete all its relationships
> > - delete the node
> > - after deleting all nodes delete the indices
> > Guess I didn't have to tell you that :)
> > Still, thanks for picking up that item for your to-do.
> > Thanks and best regards,
> > Georg
> > On 12.07.2010 09:30, Peter Neubauer wrote:
> >> Georg,
> >> normally people shut down Neo4j and delete the db directory in order
> >> to get rid of the entire db. However, I see your point in having a
> >> fast way to bulk delete the _content_ of the db.
> >> It's not totally simple to do that nicely, so Johan just wrote a note
> >> to look at this after Neo4j 1.1. It will probably be a helper doing
> >> this, but it needs closer examination. Would that be ok for you?
> >> Cheers,
> >> /peter neubauer
> >> COO and Sales, Neo Technology
> >> GTalk: neubauer.peter
> >> Skype peter.neubauer
> >> Phone +46 704 106975
> >> LinkedIn http://www.linkedin.com/in/neubauer
> >> Twitter http://twitter.com/peterneubauer
> >> http://www.neo4j.org - Your high performance graph
> >> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
> >> On Fri, Jul 9, 2010 at 12:33 AM, Georg M. Sorst<georgsorst at gmx.de>
> >>> Hi list,
> >>> is there a way to clean the DB and the indices programmatically?
> >>> The reason I'm looking for this is that I'm using (and instantiating)
> >>> Neo4j from Spring. This works just great, however in order to run my
> >>> tests from a clean state I need a way to clean the DB and indices.
> >>> Stopping Neo4j and deleting the store dir is not really a viable option
> >>> as I would have to recreate the start-up sequence that I have already
> >>> defined in my Spring context config.
> >>> What I'm currently doing is iterate over the entire graph and delete
> >>> nodes and relationships. This works fine most of the time but sometimes
> >>> gives me unexpected errors like "Node[xyz] has been deleted in this
> >>> This seems to be especially true when I run all tests in succession.
> >>> Another problem with that approach is that there doesn't seem to be a
> >>> way to find out which indices currently exist making it hard to safely
> >>> delete them all.
> >>> So, any pointers would be greatly appreciated.
> >>> Thanks and best regards,
> >>> Georg
> >>> _______________________________________________
> >>> Neo4j mailing list
> >>> User at lists.neo4j.org
> >>> https://lists.neo4j.org/mailman/listinfo/user
> >> _______________________________________________
> >> Neo4j mailing list
> >> User at lists.neo4j.org
> >> https://lists.neo4j.org/mailman/listinfo/user
> Georg M. Sorst
> Dipl. Inf. (FH)
> Ignaz-Harrer-Str. 13 / Top 19
> 5020 Salzburg
> Tel: +43 (0)650 / 53 47 200
> Neo4j mailing list
> User at lists.neo4j.org
More information about the User