diff --git a/pageindex/filesystem/store.py b/pageindex/filesystem/store.py index 1d85810..1cca9ea 100644 --- a/pageindex/filesystem/store.py +++ b/pageindex/filesystem/store.py @@ -160,7 +160,6 @@ class SQLiteFileSystemStore: if not records: return with self.connect() as conn: - conn.execute("PRAGMA synchronous = OFF") conn.execute("PRAGMA temp_store = MEMORY") folder_cache: dict[tuple[str, str], str] = {} file_rows = [] diff --git a/tests/test_filesystem_store.py b/tests/test_filesystem_store.py new file mode 100644 index 0000000..7f42503 --- /dev/null +++ b/tests/test_filesystem_store.py @@ -0,0 +1,45 @@ +import json + + +def test_insert_files_does_not_disable_sqlite_synchronous(tmp_path): + from pageindex.filesystem.store import SQLiteFileSystemStore + + statements = [] + + class RecordingStore(SQLiteFileSystemStore): + def connect(self): + conn = super().connect() + conn.set_trace_callback(statements.append) + return conn + + store = RecordingStore(tmp_path / "workspace") + statements.clear() + + store.insert_files( + [ + { + "file_ref": "ref_report", + "external_id": "doc_report", + "storage_uri": "file:///tmp/report.pdf", + "source_path": "documents/report.pdf", + "folder_path": "/documents", + "title": "Report", + "descriptor": "documents/report.pdf", + "content_type": "application/pdf", + "source_type": "documents", + "fingerprint": "fingerprint", + "text_artifact_path": "artifacts/text/ref_report.txt", + "raw_artifact_path": None, + "metadata": {}, + "metadata_json": json.dumps({}), + "metadata_text": "", + "content": "", + "skip_fts": True, + } + ] + ) + + assert not any( + statement.upper().replace(" ", "") == "PRAGMASYNCHRONOUS=OFF" + for statement in statements + )