MDSuite icon indicating copy to clipboard operation
MDSuite copied to clipboard

Work with read-only databases

Open PythonFZ opened this issue 4 years ago • 5 comments

What feature would you like to see added? Give the possibility to use read-only databases e.g., from someone else.

Describe how this feature would improve the code Disable logfiles in the data directory, that currently do not allow the usage of read-only databases.

PythonFZ avatar Aug 16 '21 11:08 PythonFZ

I think the only issue is the log files right? I'm not sure what python integrated things we could use to make them open. It seems that when loading a class something in the log files is also loaded? In reality this is not necessary as the other log files don't need to be read. The issue found would be that the storage path of the experiment would need to be ignored in a case where the database is read from another location that you cannot write to.

SamTov avatar Aug 17 '21 10:08 SamTov

Or we could add a try-except that raises an error: Can not write database logs, please use "read_only=True" for read-only access and then we disable all attempts to write any files?

PythonFZ avatar Aug 17 '21 11:08 PythonFZ

log files could still be written in principle unless the device being run on is completely without write access. It could still be good to have a local log writer. I wouldn't suggest a bit of logic:

if CantWriteToStoragPath:
    try:
        Write to './'
    except:
        We will not write any files

SamTov avatar Aug 17 '21 11:08 SamTov

Is this desired? I am not sure, because one might try to access a read-only db from e.g. their home drive and does not expect log files to be written in that place? If I define a storage path I don't expect log files to be written outside that path. If you raise an error and demand a read-only access it might be more clear and in that case nothing on the database is being change.

PythonFZ avatar Aug 17 '21 11:08 PythonFZ

Yes but you may want them to be written somewhere. I think there needs to be functionality for both. If I don't want any output then I can demand it but if I want a log file written, picture saved, or anything else stored during the analysis, I should be able to store it somewhere. Consider the SQL database updates or even the returns on a calculator. It must go somewhere unless you truly suppress everything. If I was using a remote database but wanted to see the data, using a full suppression it would be impossible to physically access the results.

SamTov avatar Aug 17 '21 12:08 SamTov