microsoft / microsoft/Qcodes

Loosen coupling between DataSet/Experiment and Sqlite storage

Open
#955 8 comments 5 reactions 0 assignees View on GitHub
new dataset
Dominant language
Python
Stars
459
Forks
359
Avg merge
3d 6h
Merged PRs (30d)
73

Description

https://github.com/QCoDeS/Qcodes/pull/664 introduces a new DataSet and Experiment class, both of which are very hard coupled to Sqlite storage. This prevents re-use of the DataSet/Experiment classes in situations where sqlite backing is undesirable (for example, when implementing a more micro-service oriented architecture).

Instead of hard-coding calls to imported non-instance functions in the DataSet object, it would make more sense to use the dependency-injection design pattern. Ie, give the constructor an object that is responsible for the persistence of the DataSet, instead of relying on non-object methods imported from the sqlite_base module. So basically, have an object that represents the sqlite3 db, and define methods on that object that are now functions in the sqlite_base module.

That way, the whole DataSet class becomes more future-proof and allows for customisation by simply giving the constructor another object with the same interface but for example writing to mongodb, memory, hdf5 or whatever. Doing things this way breaks the dependency of DataSet on sqlite_base, which makes the code more maintainable and testable, and thus more future-proof and stable.

The same I think can be said for Experiment class.

Contributor guide

Open the contributing guide

Research direction

Start by reading PR 664 and tracing how DataSet and Experiment call functions from sqlite_base. Identify the persistence interface those classes need and the existing SQLite responsibilities that must implement it; done means both classes no longer depend directly on sqlite_base while SQLite-backed behavior remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlite
Domain
databases
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.