Skip to content

Commit 3ddde63

Browse files
committed
Fix sqlite store
1 parent fb01742 commit 3ddde63

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

zarr/_storage/v3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ def rmdir(self, path=None):
490490
if path:
491491
for base in [meta_root, data_root]:
492492
with self.lock:
493-
self.cursor.execute('DELETE FROM zarr WHERE k LIKE (? || "/%")', (base + path,))
493+
self.cursor.execute("DELETE FROM zarr WHERE k LIKE (? || '/%')", (base + path,))
494494
# remove any associated metadata files
495495
sfx = _get_metadata_suffix(self)
496496
meta_dir = (meta_root + path).rstrip("/")

zarr/storage.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2779,9 +2779,9 @@ def listdir(self, path=None):
27792779
sep = "_" if path == "" else "/"
27802780
keys = self.cursor.execute(
27812781
f"""
2782-
SELECT DISTINCT SUBSTR(m, 0, INSTR(m, "/")) AS l FROM (
2783-
SELECT LTRIM(SUBSTR(k, LENGTH(?) + 1), "/") || "/" AS m
2784-
FROM zarr WHERE k LIKE (? || "{sep}%")
2782+
SELECT DISTINCT SUBSTR(m, 0, INSTR(m, '/')) AS l FROM (
2783+
SELECT LTRIM(SUBSTR(k, LENGTH(?) + 1), '/') || '/' AS m
2784+
FROM zarr WHERE k LIKE (? || '{sep}%')
27852785
) ORDER BY l ASC
27862786
""",
27872787
(path, path),
@@ -2794,8 +2794,8 @@ def getsize(self, path=None):
27942794
size = self.cursor.execute(
27952795
"""
27962796
SELECT COALESCE(SUM(LENGTH(v)), 0) FROM zarr
2797-
WHERE k LIKE (? || "%") AND
2798-
0 == INSTR(LTRIM(SUBSTR(k, LENGTH(?) + 1), "/"), "/")
2797+
WHERE k LIKE (? || '%') AND
2798+
0 == INSTR(LTRIM(SUBSTR(k, LENGTH(?) + 1), '/'), '/')
27992799
""",
28002800
(path, path),
28012801
)
@@ -2806,7 +2806,7 @@ def rmdir(self, path=None):
28062806
path = normalize_storage_path(path)
28072807
if path:
28082808
with self.lock:
2809-
self.cursor.execute('DELETE FROM zarr WHERE k LIKE (? || "/%")', (path,))
2809+
self.cursor.execute("DELETE FROM zarr WHERE k LIKE (? || '/%')", (path,))
28102810
else:
28112811
self.clear()
28122812

0 commit comments

Comments
 (0)