fix: preserve cloud storage URIs in LanceDB vector store config validation#2233
Open
ohharsen wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: preserve cloud storage URIs in LanceDB vector store config validation#2233ohharsen wants to merge 1 commit intomicrosoft:mainfrom
ohharsen wants to merge 1 commit intomicrosoft:mainfrom
Conversation
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.
Description
_validate_vector_store_db_uri()unconditionally callsPath(db_uri).resolve()on the LanceDBdb_uri, which destroys cloud storage URIs. For example,gs://my-bucket/indexes/lancedbgets resolved to/current/working/dir/gs:/my-bucket/indexes/lancedb— stripping the double slash from the scheme and prepending the CWD. This silently breaks LanceDB's native support for GCS, S3, and Azure cloud storage backends.Related Issues
N/A — discovered while using LanceDB with a
gs://URI for Google Cloud Storage.Proposed Changes
graphrag/config/models/graph_rag_config.py: SkipPath(db_uri).resolve()whendb_uristarts with a recognized cloud storage scheme (gs://,s3://,az://,abfs://). Local file paths continue to be resolved as before.def _validate_vector_store_db_uri(self) -> None: """Validate the vector store configuration.""" store = self.vector_store if store.type == VectorStoreType.LanceDB: if not store.db_uri or store.db_uri.strip == "": store.db_uri = graphrag_config_defaults.vector_store.db_uri - store.db_uri = str(Path(store.db_uri).resolve()) + if not store.db_uri.startswith(("gs://", "s3://", "az://", "abfs://")): + store.db_uri = str(Path(store.db_uri).resolve())Checklist
Additional Notes
Reproduction steps:
VectorStoreConfigwith a cloud URI:db_uri="gs://my-bucket/path/to/lancedb"GraphRagConfig(vector_store=...)config.vector_store.db_uriis now a local filesystem path (e.g./cwd/gs:/my-bucket/path/to/lancedb)local_searchanddrift_searchfail withAttributeError: 'LanceDBVectorStore' object has no attribute 'document_collection'becauselancedb.connect()can't find any tables at the mangled pathThis also affects
@validate_callonlocal_search/drift_search, which re-validates the config (creating a Pydantic copy), so even manually overridingdb_uriafter initialization doesn't work.LanceDB has supported cloud storage URIs natively since v0.6+ (docs). This one-line fix enables that integration to work through GraphRAG's config layer.