Skip to content

TypeError when clicking on a version in Changes viewer (history) #895

@RastoHu

Description

@RastoHu

Description

Opening the Changes viewer (history) for a project and clicking on a specific version throws a TypeError: 'sqlite3.Cursor' object does not support the context manager protocol. This issue is not project-specific — it was reproduced on other projects.

Environment
[x] Staging [ ] PROD

Application (+ app version, build, operating system)

  • QGIS 3.44.7-Solothurn
  • Mergin Maps Plugin build: d-137311
  • macOS Tahoe 26.3
  • Also reproduced on: QGIS 3.40.15-Bratislava, Windows 11 64-bit ARM

Steps to reproduce

  1. Open the Mergin Maps plugin in QGIS
  2. Open the Changes viewer (history) for project tester-ws-1 / v2push_exploratory
  3. Click on version v125

Actual results

Error is shown: TypeError: 'sqlite3.Cursor' object does not support the context manager protocol

Expected results

The selected version diff/changes should be displayed without error.

Screenshots or logs

An error has occurred while executing Python code:

TypeError: 'sqlite3.Cursor' object does not support the context manager protocol
Traceback (most recent call last):
  File "/Users/rastoh/Library/Application Support/QGIS/QGIS3/profiles/Rasto Lutra/python/plugins/Mergin/version_viewer_dialog.py", line 587, in selected_version_changed
    self.show_version_changes(version)
  File "/Users/rastoh/Library/Application Support/QGIS/QGIS3/profiles/Rasto Lutra/python/plugins/Mergin/version_viewer_dialog.py", line 674, in show_version_changes
    layers = make_version_changes_layers(QgsProject.instance().homePath(), version)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rastoh/Library/Application Support/QGIS/QGIS3/profiles/Rasto Lutra/python/plugins/Mergin/diff.py", line 406, in make_version_changes_layers
    features = diff_table_to_features(diff[table_name], db_schema[table_name], fields, cols_to_fields, db_conn)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rastoh/Library/Application Support/QGIS/QGIS3/profiles/Rasto Lutra/python/plugins/Mergin/diff.py", line 237, in diff_table_to_features
    db_row = get_row_from_db(db_conn, schema_table, entry_changes)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rastoh/Library/Application Support/QGIS/QGIS3/profiles/Rasto Lutra/python/plugins/Mergin/diff.py", line 78, in get_row_from_db
    with db_conn.cursor() as c:
         ^^^^^^^^^^^^^^^^
TypeError: 'sqlite3.Cursor' object does not support the context manager protocol


Python version: 3.12.11 (main, Dec 18 2025, 07:47:48) [Clang 16.0.0 (clang-1600.0.26.6)]
QGIS version: 3.44.7-Solothurn Solothurn, 4edb1325

Python Path:
/Applications/QGIS.app/Contents/Resources/qgis/python
/Users/rastoh/Library/Application Support/QGIS/QGIS3/profiles/Rasto Lutra/python
/Users/rastoh/Library/Application Support/QGIS/QGIS3/profiles/Rasto Lutra/python/plugins
/Applications/QGIS.app/Contents/Resources/qgis/python/plugins
/Applications/QGIS.app/Contents/Frameworks/lib/python312.zip
/Applications/QGIS.app/Contents/Frameworks/lib/python3.12
/Applications/QGIS.app/Contents/Frameworks/lib/python3.12/lib-dynload
/Applications/QGIS.app/Contents/Frameworks/lib/python3.12/site-packages
/Users/rastoh/Library/Application Support/QGIS/QGIS3/profiles/Rasto Lutra/python
.
/Users/rastoh/Documents/1_Projects/SSO_plugin_regression/v2push_exploratory

Conclusion
Created by Claude and supervised by a human test analyst.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions