Think I broke my Replit DB, any way to reset it?

Hi guys,

As I said in the title, I think I may have borked by db and I want to factory reset it.
I’ve tried db.clear() and

for key in db:    
    del db[key]

But neither seem to fix the issue. I just want to make sure those would actually reset in the case of a broken db. I’m just getting an error in the console of my Flask app that is the name of the key in question, and nothing else.
error:<key name>

I’m pretty sure it’s a borked-db issue because I rolled back the repo and I am getting the exact same error.

I found a thread from 2 years ago where people were saying that if you accidentally enter a special character into your db, that you can break it and it requires forking your repo to reset the db. I would hope that isn’t still an issue 2 years on. It’s possible something like this happened when I was trying to manually edit keys and values.

Any help appreciated.

Thanks,
Jimmy

This would not work. It will delete the keys 1, 2, 3, etc, not the name of the key. The variable ‘key’ is merely a variable, not the actual keys.

If you want to really delete the keys, do this:

print(db.keys()) #Lists the keys

Then, you can delete the db keys, knowing what they are.

Uh, yes it would? If OP did del key then it would do what you described…

1 Like

Well, I didn’t test it, just typing out what I thought would be correct :upside_down_face: .
I mean, my method would work riight…?

So what I did should have worked?

Yes, both methods you tried should have worked.

Try (in Shell) running:

replit nuke --i-am-sure
2 Likes

Shell: please input nuclear launch codes

Is there some more complete way to reset or reinitialize it?

@JimmyPronto use Firepup650’s post in the Shell.

I have used it before and it works perfectly fine.

1 Like

I just want to reset the database, I don’t want to lose all of my code.

@JimmyPronto it doesn’t remove your code it just resets your db (Idk why that is the thing to reset it though).

1 Like

Ok thank you, and thanks to @Firepup650

2 Likes

@JimmyPronto if it works mark Firepup650’s post as the solution.

3 Likes

That did indeed reset the db, but it didn’t fix the problem I was encountering.
For the record, and I don’t know if this will help anyone, but my issue was that when I queried a key that didn’t exist, instead of the database returning None, it was raising an exception (unhandled). I just got an error that was the name of the key, but it wasn’t obvious to me what the problem was, because I thought that the key was being created if it didn’t already exist. Obviously that process was being short circuited.

5 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.