Skip to content

Commit 784cb87

Browse files
Version bump 0.3.26 → 0.3.27, ATP readonly classifier: add CHECKPOINT to write keywords, regex-based whole-word matching, test coverage
1 parent 479b602 commit 784cb87

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "kuzualchemy"
7-
version = "0.3.26"
7+
version = "0.3.27"
88
description = "SQLAlchemy-like ORM for Kuzu graph database"
99
readme = "README.md"
1010
license = { file = "LICENSE" }

src/kuzualchemy/atp_integration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,11 @@ def _is_readonly_query(self, query: str) -> bool:
228228
# Write clause keywords that indicate a non-readonly query
229229
write_keywords = (
230230
'CREATE', 'DELETE', 'DETACH', 'SET', 'REMOVE', 'MERGE',
231-
'DROP', 'ALTER', 'COPY', 'CALL', 'BEGIN', 'COMMIT', 'ROLLBACK'
231+
'DROP', 'ALTER', 'COPY', 'CALL', 'BEGIN', 'COMMIT', 'ROLLBACK',
232+
'CHECKPOINT'
232233
)
233234
for kw in write_keywords:
234-
# Check for keyword as whole word (not substring)
235-
if f' {kw} ' in f' {q} ' or q.startswith(f'{kw} ') or f' {kw}(' in f' {q} ':
235+
if re.search(rf"(^|\s){kw}(\s|\(|;|$)", q):
236236
return False
237237
return True
238238

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from __future__ import annotations
2+
3+
from kuzualchemy.atp_integration import ATPIntegration
4+
5+
6+
def test_checkpoint_is_not_classified_as_readonly() -> None:
7+
integration = object.__new__(ATPIntegration)
8+
9+
assert integration._is_readonly_query("CHECKPOINT;") is False
10+
assert integration._is_readonly_query("MATCH (n) RETURN n") is True

0 commit comments

Comments
 (0)