fix(sqlserver): fix ruff formatting and mypy errors in async vector store methods - #793
Merged
Facundo Santiago (santiagxf) merged 8 commits intoJun 30, 2026
Conversation
Adds an async surface to `SQLServer_VectorStore` so callers running inside an asyncio event loop don't block it on synchronous ODBC I/O. New methods mirror the sync API one-for-one: - `aadd_texts`, `aadd_documents` - `afrom_texts`, `afrom_documents` (classmethods) - `asimilarity_search`, `asimilarity_search_by_vector`, `asimilarity_search_with_score`, `asimilarity_search_by_vector_with_score` - `aget_by_ids`, `adelete` The async path uses SQLAlchemy's `create_async_engine` with the `mssql+aioodbc` driver. The async engine is built lazily on first use (and cached) so synchronous-only callers do not pay any aioodbc cost. Entra ID authentication uses the same connection-event token provider as the sync engine, so connection-string conventions stay identical. If the embedding function exposes `aembed_documents` / `aembed_query`, the async path uses those; otherwise it falls back to the sync embedding API so existing `Embeddings` implementations keep working. Adds `aioodbc~=0.5` as a project dependency. Closes #16
Copilot
AI
changed the title
[WIP] Fix failing GitHub Actions job for SQL Server linting
fix(sqlserver): fix ruff formatting and mypy errors in async vector store methods
Jun 30, 2026
Facundo Santiago (santiagxf)
marked this pull request as ready for review
June 30, 2026 19:19
Facundo Santiago (santiagxf)
deleted the
copilot/fix-ci-cd-libs-sqlserver-make-lint
branch
June 30, 2026 19:26
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.
CI (
make lint) was failing on PR #633's async additions toSQLServer_VectorStoredue to two issues inlangchain_sqlserver/vectorstores.py.Changes
Ruff formatting: collapsed three overly-split expressions to single lines (within ruff's line-length budget):
connection_string.replace("mssql+pyodbc", "mssql+aioodbc", 1)return await self.aadd_texts(texts, metadatas=metadatas, ids=ids, **kwargs)await session.execute(insert(self._embedding_store).values(documents))Mypy
attr-definederrors inadelete: SQLAlchemy's type stubs declareAsyncSession.execute()as returningResult[Any], which lacksrowcount. The DML result variable is annotated asAnyto allow.rowcountaccess without fighting the stubs.