Repository navigation
fix(core,adapters): improve driver lifecycle, query compilation, and adapter consistency - #837
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #837 +/- ##
==========================================
- Coverage 81.71% 81.40% -0.32%
==========================================
Files 522 527 +5
Lines 80378 85274 +4896
Branches 11626 15789 +4163
==========================================
+ Hits 65684 69420 +3736
- Misses 10929 11731 +802
- Partials 3765 4123 +358
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
cofin
force-pushed
the
chore/review-code-comprehensively
branch
3 times, most recently
from
October 12, 2026 22:03
28542e0 to
38b043a
Compare
…adapter consistency
cofin
force-pushed
the
chore/review-code-comprehensively
branch
from
October 12, 2026 23:37
38b043a to
7e34399
Compare
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.
Summary
Improves statement caching, driver execution lifecycles, dialect transpilation, schema introspection, storage backends, and adapter consistency across core modules, framework extensions, and database adapters.
Key Changes
Core Modules
sqlspec(Root)__getattr__and__dir__) across top-level package barrels to keep import times minimal.__all__exports and class member ordering.sqlspec.coreSQLProcessorcompilation cache keys.ParameterConverter.OrderedDictLRU eviction in statement and compilation caches.sqlspec.driverSlotPooledStatementinstances when attaching toSQLResult.statementbefore returning pooled statements to_STATEMENT_POOL.select_with_totalwindow-count extraction and cursor row-mapping dispatch.sqlspec.builderQueryBuilder.to_statement()throughself.build()so optimizer settings apply consistently.MappingSchemainstances whenschema=Nonefor compatibility withsqlglot >= 30.22.0column qualification.MERGEstring column reference detection to qualified table/source aliases.PARTITION BYclauses accurately inCreateTable.partition_by().sqlspec.dialectsSpanner,Spangres,DB2,PGVector, andParadeDBparser and generator transforms to their respective dialects and refreshsqlglot[c]generator dispatch tables.sqlspec.data_dictionarytables.sqltopological dependency queries across all dialects.ordinal_positionto prevent duplicate column pairs.sqlspec.migrationsMigrationSquasher.stampand avoid redundant commits on autocommit drivers inAsyncMigrationTracker..pyand.sqlmigrations.sqlspec.storage&sqlspec.utilsfile:///D:/...URIs acrossLocalStore,ObStoreBackend, andFSSpecBackend.StopIterationacross worker thread futures inAsyncThreadedBytesIterator.PortalProvider.OrderedDictLRU eviction inStorageRegistry.sqlspec.service&sqlspec.observabilitybegin_transaction()calls with nested savepoints inSQLSpecSyncServiceandSQLSpecAsyncService.LimitOffsetFilterandCursorFilterarguments inpaginate()and skip redundant count queries on short first pages.RedactionConfigparameter masking to scalar and sequence parameters and skip SQL comments during literal masking.SpanManagerand use boundeddequebuffers for duration percentile calculations.sqlspec.extensionsshow-current-revisionand session store key cleanup.Database Adapters
PostgreSQL & CockroachDB (
asyncpg,psycopg,psqlpy,cockroach_asyncpg,cockroach_psycopg)self.connection.transaction(readonly=True)beforeSET TRANSACTION AS OF SYSTEM TIMEfor follower reads incockroach_asyncpg.bytespayloads forpsqlpyLitestar session stores and release pooled connections if initial setup fails.psycopgnull-pool sizing andasyncpgper-query timeouts andpgbouncer_modesettings.SQLite (
sqlite,aiosqlite)autocommit is True) for Python 3.12+ PEP 249 autocommit detection.aiosqlitefor Python 3.14 thread-check compatibility.load_from_arrow.MySQL (
asyncmy,aiomysql,pymysql,mysqlconnector)SHOWandDESCRIBEstatements through row-returning execution across all MySQL adapters.aiomysqlandasyncmypool connections on close timeout and roll back dirty transactions onPyMySQLConnectionPoolrelease.SQL Server (
mssql_python,pymssql)mssql_pythonload_from_arrowwithout materializing full tables in memory.Cloud, Enterprise & Analytics (
spanner,bigquery,oracledb,db2,duckdb,adbc,arrow_odbc)Abortedexceptions insiderun_in_transactionretries, clear mutation buffers on rollback, and await two-stage asyncupdate_ddloperations inspanner.try / finallyblocks and route interactive queries viaquery_and_wait.db2.duckdb, pass Arrow streams directly toadbc_ingestinadbc, and tokenize T-SQL pagination parameters lexically inarrow_odbc.driver_featurestype-system coverage across all 20 adapters and expand MyPyC compilation to adaptercore,type_converter,pool, and_typingmodules.Verification
uv run pytest tests/unit -quv run ruff check sqlspec tests&uv run ruff format --check sqlspec testsuv run mypy sqlspec&uv run pyright sqlspecuv run slotscheck sqlspecuv run python tools/scripts/mypyc_inventory.py --check&uv run python tools/scripts/mypyc_smoke.pyuv run sphinx-build -M html docs docs/_build/ -j auto -W --keep-going