diff --git a/docs/release.rst b/docs/release.rst index a234caabe7..a6be0fc747 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -20,6 +20,11 @@ Release notes Unreleased ---------- +Fixes +~~~~~ +* Fixed ``SQLiteStore`` with the latest version of ``sqlite3``. + By :user:`David Stansby ` + Deprecations ~~~~~~~~~~~~ diff --git a/pyproject.toml b/pyproject.toml index ed643e496f..5b70120b91 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -130,6 +130,7 @@ filterwarnings = [ "ignore:The loop argument is deprecated since Python 3.8.*:DeprecationWarning", "ignore:The .* is deprecated and will be removed in a Zarr-Python version 3*:FutureWarning", "ignore:The experimental Zarr V3 implementation in this version .*:FutureWarning", + "ignore:unclosed database in =2", diff --git a/zarr/_storage/v3.py b/zarr/_storage/v3.py index 4987f820cf..334788585f 100644 --- a/zarr/_storage/v3.py +++ b/zarr/_storage/v3.py @@ -490,7 +490,7 @@ def rmdir(self, path=None): if path: for base in [meta_root, data_root]: with self.lock: - self.cursor.execute('DELETE FROM zarr WHERE k LIKE (? || "/%")', (base + path,)) + self.cursor.execute("DELETE FROM zarr WHERE k LIKE (? || '/%')", (base + path,)) # remove any associated metadata files sfx = _get_metadata_suffix(self) meta_dir = (meta_root + path).rstrip("/") diff --git a/zarr/storage.py b/zarr/storage.py index 5d48892611..f9f6dbe0a6 100644 --- a/zarr/storage.py +++ b/zarr/storage.py @@ -2779,9 +2779,9 @@ def listdir(self, path=None): sep = "_" if path == "" else "/" keys = self.cursor.execute( f""" - SELECT DISTINCT SUBSTR(m, 0, INSTR(m, "/")) AS l FROM ( - SELECT LTRIM(SUBSTR(k, LENGTH(?) + 1), "/") || "/" AS m - FROM zarr WHERE k LIKE (? || "{sep}%") + SELECT DISTINCT SUBSTR(m, 0, INSTR(m, '/')) AS l FROM ( + SELECT LTRIM(SUBSTR(k, LENGTH(?) + 1), '/') || '/' AS m + FROM zarr WHERE k LIKE (? || '{sep}%') ) ORDER BY l ASC """, (path, path), @@ -2794,8 +2794,8 @@ def getsize(self, path=None): size = self.cursor.execute( """ SELECT COALESCE(SUM(LENGTH(v)), 0) FROM zarr - WHERE k LIKE (? || "%") AND - 0 == INSTR(LTRIM(SUBSTR(k, LENGTH(?) + 1), "/"), "/") + WHERE k LIKE (? || '%') AND + 0 == INSTR(LTRIM(SUBSTR(k, LENGTH(?) + 1), '/'), '/') """, (path, path), ) @@ -2806,7 +2806,7 @@ def rmdir(self, path=None): path = normalize_storage_path(path) if path: with self.lock: - self.cursor.execute('DELETE FROM zarr WHERE k LIKE (? || "/%")', (path,)) + self.cursor.execute("DELETE FROM zarr WHERE k LIKE (? || '/%')", (path,)) else: self.clear()