Use qcodes.dataset.get_db_overview when available#462
Merged
Conversation
The fast SQL database-overview implementation has been upstreamed to QCoDeS. Prefer `qcodes.dataset.get_db_overview` when the installed QCoDeS version exposes it, and fall back to the local implementation for older versions. The local implementation is generalized to match the upstreamed API: it now accepts an optional existing connection and an `extra_columns` argument for reading ad-hoc metadata columns, replacing the hard-coded `inspectr_tag` handling. `inspectr` requests the `inspectr_tag` column explicitly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Mirror the review changes made to the upstreamed QCoDeS implementation: make conn/start_run_id/extra_columns keyword-only, catch sqlite3.Error instead of bare Exception, and drop the misleading result_counter fallback (it is the run ordinal, not a data-point count) in favour of reporting 0 when unknown. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
astafan8
commented
Jul 3, 2026
astafan8
commented
Jul 3, 2026
Make plottr's fallback implementation an exact copy of the upstreamed QCoDeS `get_db_overview` (same signature, docstring and body), documenting that snapshots are not read and that the record count may be less precise than DataSet.number_of_results. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address review feedback on the plottr PR: - Move the local get_db_overview implementation into a new private module plottr/data/_qcodes_db_overview.py (an exact copy of the upstream QCoDeS implementation), and reduce plottr/data/qcodes_db_overview.py to just the logic that imports get_db_overview/RunOverviewDict from qcodes when available and falls back to the vendored copy otherwise (now at the top of the module). - Import the private QCoDeS SQLite helpers (conn_from_dbpath_or_conn, is_column_in_table) lazily inside get_db_overview rather than at module import time, since they are private QCoDeS API. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jenshnielsen
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The fast SQL database-overview implementation used by
inspectr(
plottr.data.qcodes_db_overview.get_db_overview) has been upstreamed toQCoDeS (see companion PR microsoft/Qcodes#8266).
This PR makes plottr prefer the QCoDeS implementation when it is available,
falling back to the local implementation for older QCoDeS versions that do not
yet expose
qcodes.dataset.get_db_overview.Changes
plottr/data/qcodes_db_overview.pyfrom qcodes.dataset import get_db_overview; onImportError(older QCoDeS) keep the local implementation.connin addition topath_to_db;extra_columnsargument to pull ad-hoc metadata columns (e.g.inspectr_tag) into each overview entry, replacing the previouslyhard-coded
inspectr_taghandling;sys.version_inforead-only guard (plottr requires Pythonplottr/apps/inspectr.pyLoadDBProcess.loadDBnow callsget_db_overview(self.path, extra_columns=['inspectr_tag'])so theinspectr_tagcolumn is included regardless of which implementation isused.
Behaviour
The returned overview dict keys are unchanged, so
inspectrbehavesidentically whether the QCoDeS or the local implementation is used. Existing
tests (
test/pytest/test_qcodes_data.py) exercise both the record-countheuristics and the incremental refresh and continue to pass.
Verification
mypy plottr— clean.pytest test/pytest/test_qcodes_data.py— 19 passed (including theinspectrrefresh GUI test).Verified against the currently released QCoDeS (0.58.0, which does not yet
expose
get_db_overview, so the fallback path is exercised) as well as a stubconfirming the upstream path shadows the local implementation when present.
Note
This pull request was created by an agent on behalf of @astafan8.