Fix LanceDB flat schema metadata extraction and column width limits - #40
Merged
Merged
Conversation
Fixes metadata display for LanceDB databases with flat schemas (e.g., Contextus) where metadata is stored as individual columns rather than nested in a 'metadata' column. ## Changes ### LanceDB Connection - Extract metadata from PyArrow schema first (all non-reserved columns) - Support flat schema format in get_all_items() - build metadata dicts from column values - Detect and exclude content column from metadata to prevent duplication - Maintain backward compatibility with nested 'metadata' column format - Fix count detection when schema extraction succeeds but count is unavailable ### UI - Add 600px max-width constraint to table columns to prevent excessive width - Prevent 'document' column from appearing twice (once as content, once as metadata) ### Tests - Add comprehensive flat schema metadata extraction tests - Update existing tests to reflect content column exclusion from metadata - Verify backward compatibility with nested metadata format Closes #XX
❌ 10 Tests Failed:
View the top 1 failed test(s) by shortest run time
View the full list of 9 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
- Enable CI test workflow on all PRs to master/main - Add new lint workflow with ruff (check + format) - Linting is advisory-only (won't block merges) until codebase is cleaned up - Tests remain blocking as expected
- Update RELEASE_REASON.md to v0.8.4 (matches CHANGELOG and pyproject.toml) - Add permissions blocks to CI workflows per GitHub security recommendation
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.
Problem
Contextus databases (and other LanceDB databases with flat schemas) were showing empty metadata in Vector Inspector. The issue was that LanceDB connection only looked for a nested
metadatacolumn, but Contextus stores metadata as individual top-level columns likeproject,filename,heading,type, etc.Additionally:
documentcolumn appeared twice (as both content and metadata)Solution
LanceDB Connection (
lancedb_connection.py)get_all_items(), extract all non-reserved columns as metadata dictsUI (
metadata_table.py)Tests
Testing
Tested with:
project,filename,heading, etc.)Result
✅ Contextus databases now show all metadata columns
✅ No duplicate "document" column
✅ Reasonable column widths (max 600px)
✅ Backward compatible with traditional nested metadata format
Screenshots
Before: Empty metadata columns
After: All Contextus metadata fields visible (
project,filename,heading,type,chunk_index)