Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions things/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import plistlib
import re
import sqlite3
import weakref
from textwrap import dedent
from typing import Optional, Union

Expand Down Expand Up @@ -186,6 +187,8 @@ def __init__(self, filepath=None, print_sql=False):
# See: https://sqlite.org/uri.html#recognized_query_parameters
uri = f"file:{self.filepath}?mode=ro"
self.connection = sqlite3.connect(uri, uri=True) # pylint: disable=E1101
# Close the underlying SQLite connection when this Database object is garbage collected
weakref.finalize(self, sqlite3.Connection.close, self.connection)

# Test for migrated database in Things 3.15.16+
# --------------------------------
Expand Down