Repository navigation
Skip schema validation when building a dataset from documents - #370
Merged
Merged
Conversation
Mirrors NDI-matlab#1240 (VH-Lab/NDI-matlab PR 1242). downloadDataset builds the local dataset through ndi_dataset_dir(..., documents=...), which added every document through DID's add_docs with schema validation on. That is slow for large datasets and unnecessary: the documents were validated when they were first added. - ndi_database.add / add_many and SQLiteDriver.add take a keyword-only validate=True, passed to did add_docs. Mirrors MATLAB's new 'Validate' name/value pair on ndi.database/add. - ndi_dataset_dir's documents= form adds with validate=False, in the batch add and the per-document fallback. - Bridge contracts updated for add, add_many and ndi_dataset_dir. - tests/test_add_validate.py covers the option and the dataset path. INTERFACE UPDATE: bridge contracts for ndi_database.add, add_many and ndi_dataset_dir now record the validate option. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011v7R5tNtwQ7Vkn99T1o7uM
Both entries now record the NDI-matlab commit whose 'Validate' change (VH-Lab/NDI-matlab#1240) this branch ports, so the drift check no longer flags them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011v7R5tNtwQ7Vkn99T1o7uM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Python counterpart of VH-Lab/NDI-matlab#1242 (fixes VH-Lab/NDI-matlab#1240).
Problem
downloadDatasetbuilds the local dataset throughndi_dataset_dir(..., documents=...), which added every document via DID'sadd_docswith schema validation on. That is slow for large datasets and unnecessary: the documents were validated when they were first added.Changes
ndi_database.add,ndi_database.add_manyandSQLiteDriver.addtake a keyword-onlyvalidate=True, passed to DID-python'sadd_docs(validate=...). Mirrors MATLAB's new'Validate'name/value pair onndi.database/add.ndi_dataset_dir'sdocuments=form adds withvalidate=False, both in the batch add and in the per-document fallback.ndi_database.add,add_manyandndi_dataset_dirrecord the option.tests/test_add_validate.py: default still validates,validate=Falseskips it,add_manyforwards the flag, and building a dataset from documents never callsvalidate_docson them (this test fails without the dataset change).Testing
black --checkandruff checkpass.test_matlab_bridge_hashes.pyerroring on a shallow NDI-matlab checkout; with full history it passes against NDI-matlabmain.Follow-up after the MATLAB PR merges
Against the MATLAB PR branch,
test_matlab_bridge_hashes.pyflagsdatabase(+ndi/database.m) anddir(+ndi/+dataset/dir.m) as moved. Once VH-Lab/NDI-matlab#1242 merges, theirmatlab_last_sync_hashneeds bumping to the merge commit; I'll add that to this PR then.Generated by Claude Code