-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Method to clean-up/delete db #4
Comments
Do you have a draft for such thing? |
I think the main question is how to know when this is garbage collected? And besides, the user might in a certain case, keep the DB for later. Probably we could work everything with tempfiles and offer a method to dump the database to a certain file for later storing. from shutil import copyfile
...
def dump_db(self, filename='tinynpydb'):
copyfile(self.dn, Path(filename).with_suffix(".dat"))
copyfile(self.dp, Path(filename).with_suffix(".map")) Also we could offer a flag to avoid cleaning the DB unintentionally. Leave it True as default class NumPyDB(object):
def __init__(self, database_name, mode="store", purgable=True):
... |
The method called on destruction is called So we could have something like:
Alternative to |
Add a method that deletes self.dn and self.pn, or automatically delete when class is garbage collected?
The text was updated successfully, but these errors were encountered: