Hey, I was experimenting with using Replit DB and tried inserting some values using URLs as the keys. I quickly found out that having “/” in a key doesn’t work well in Replit. However, now I can’t seem to remove those faulty keys from my DB. Using python’s replit.db.clear() removes all keys except those with / and just silently fails on those. Trying to iterate through all keys causes a KeyError on the offending keys.
Anyone have any ideas for how I can remove those keys? I’m totally fine with nuking the whole DB and starting from scratch but I can’t find a way to do that which successfully removes all the faulty keys.
The way the database works, values are accessed by <db url>/key. Because of this, you might need to make sure the key is encoded correctly so that this works. Try using urllib.parse(key) on each key and see if that works.
You might actually need to create a new Repl because you might not actually be able to change or delete those keys once set. I’m assuming you’ve tried something like this:
for key in db:
db[key].delete()
If that doesn’t work (and I haven’t used ReplDB with Python before, I mainly use NodeJS, so that snippet might be incorrect), you will probably need to create a new Repl.