Password gets changed automatically to default

Hello,

I'm using neo4j library in Python and everything works well so far.

However, I tried to add in the pipeline a function that automatically deletes nodes and relationships, but when I execute it, for some reason my neo4j password gets reset to default.

Any idea why this happens ? And how to avoid it ?

But if i try to run this command in the terminal directly, everything works fine and the password isn't changed.

For info, in python I'm using :

import subprocess

subprocess.run(["rm", "-r", path_to_neo4j, "/data/databases"])
subprocess.run(["rm", "-r", path_to_neo4j "/data/transactions"])

@Neoo

what version of Neo4j ?

your python snippet

import subprocess

subprocess.run(["rm", "-r", path_to_neo4j, "/data/databases"])
subprocess.run(["rm", "-r", path_to_neo4j "/data/transactions"])

why are you doing this? this doesnt really appear supported?
As to why is the password reset to default, most likely as users are recorded in the system database and to which your python snippet deletes all databases ( including the system database) and all transactions the password is thus reset.

But again this appears very much unsupported.

@dana_canzano

I'm using the Community edition 5.6.0

I'm using this procedure because I need to delete the whole database instead of individual nodes / relationships. It is actually recommended as good practice from neo4j (Large Delete Transaction Best Practices in Neo4j - Knowledge Base)

The weird part is that the password doesn't get reset when I run the exact same command from the terminal.

Would you have another method that should be more suitable to remove everything in a simple way ? (if I actually use a DELETE statement, I get a memory issue)

@Neoo

The weird part is that the password doesn't get reset when I run the exact same command from the terminal.

you mean the password is not reset on running rm ? or the password is not reset on running cypher to perform the deletes?

if I actually use a DELETE statement, I get a memory issue

are you batching the deletes? or for example are you trying to delete 100 million nodes in a single txn?

@dana_canzano

The password is not reset when I run the rm command from the terminal (it only deletes the nodes/relationships as expected) but when I run the subprocess command from the python pipeline, it resets the password to default.

Yes I might have an issue because I don't necessarily batch them (even though I only have 350k nodes and 800k relationships).

@Neoo

Yes I might have an issue because I don't necessarily batch them (even though I only have 350k nodes and 800k relationships).

but Large Delete Transaction Best Practices in Neo4j - Knowledge Base

suggests batching the deletes.

And deleting 350k nodes and 800k rels, and this 1 million+ 'objects' in a single txn may still fail or may succeed but it depends how much RAM you have allocated to the java heap. If your environment for example has 2GB of total RAM then yeah I might expect a out of memory. Whereas if your environment has 32G of RAM and you have allocated 16GB of RAM to the Java heap it may work... but again if you batch in smaller increments then you shouldnt have to worry about this

1 Like

Create or replace database is what I use.

1 Like

@glilienfield does that command work with Community edition ? I'm getting an error :

ClientError: {code: Neo.ClientError.Statement.UnsupportedAdministrationCommand} {message: Unsupported administration command: CREATE OR REPLACE DATABASE mydatabase}

I don't know if the fact that community edition allows only one database could be a reason. I've seen a solution here but it doesn't seem to work

It looks like that is the case. All the database management commands are enterprise only.

This must be a sandbox database if you intend to blow it away periodically. As such, is it moderately sized where match(n) detach delete n(or in a call subquery) would have satisfactory performance?