More consistent arguments to db init functions#7967
Merged
jenshnielsen merged 5 commits intomicrosoft:mainfrom Mar 24, 2026
Merged
More consistent arguments to db init functions#7967jenshnielsen merged 5 commits intomicrosoft:mainfrom
jenshnielsen merged 5 commits intomicrosoft:mainfrom
Conversation
jenshnielsen
commented
Mar 24, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes QCoDeS’ SQLite database initialization helpers accept more consistent arguments, allowing callers to explicitly specify a database path and to control journal_mode across related helpers.
Changes:
- Add an optional
db_pathparameter toinitialise_database(supportsstr | Path) to initialise/upgrade a database without relying on configdb_location. - Extend
initialised_database_atwith ajournal_modeparameter and forward it toinitialise_or_create_database_at. - Expand tests and add a newsfragment documenting the API adjustments.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/qcodes/dataset/sqlite/database.py |
Extends db init APIs (db_path, journal_mode) and adjusts implementation/docstrings. |
tests/dataset/test_database_creation_and_upgrading.py |
Adds coverage for new db_path and journal_mode behavior and improves typing/path handling in tests. |
docs/changes/newsfragments/7967.improved |
Documents the new/updated init function parameters. |
Comments suppressed due to low confidence (1)
src/qcodes/dataset/sqlite/database.py:232
- The summary line of this docstring is now inaccurate:
initialise_databasecan initialize using the explicitdb_pathargument, not only the path from the config. Please update the opening description to mention thatdb_pathoverrides the config path (and clarify whether/that the configdb_locationis left unchanged whendb_pathis provided).
Initialise a database in the location specified by the config object
and set ``atomic commit and rollback mode`` of the db. The db is created
with the latest supported version. If the database already exists the
``atomic commit and rollback mode`` is set and the database is upgraded
to the latest version.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7967 +/- ##
==========================================
+ Coverage 60.54% 60.56% +0.01%
==========================================
Files 333 333
Lines 32230 32245 +15
==========================================
+ Hits 19514 19529 +15
Misses 12716 12716 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d85bd15 to
10712fa
Compare
astafan8
approved these changes
Mar 24, 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.
All functions take WALmode and db_path as argument. The arguments are not in the same order to maintain backwards compatibility. One could consider changing this by making WAL mode kwarg only