Repository navigation
feat(observability): add wire-level sqlcommenter, zero-RTT Oracle trace piggybacking, and DuckDB statement profiling - #851
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #851 +/- ##
==========================================
- Coverage 81.36% 81.35% -0.02%
==========================================
Files 527 527
Lines 87836 88239 +403
Branches 16370 16435 +65
==========================================
+ Hits 71471 71783 +312
- Misses 12001 12062 +61
- Partials 4364 4394 +30
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
feat/observability-and-profiling
branch
4 times, most recently
from
October 22, 2026 03:57
67dfe90 to
73b8965
Compare
…ce piggybacking, and DuckDB statement profiling
cofin
force-pushed
the
feat/observability-and-profiling
branch
from
October 22, 2026 05:21
73b8965 to
a734092
Compare
cofin
added a commit
that referenced
this pull request
Oct 22, 2026
## Summary Prepares the `v0.68.0` release of SQLSpec, updates the changelog with comprehensive release notes covering Oracle enterprise topology and 26ai capabilities, PostgreSQL pooler modes, Google ADK v2 parity, wire-level SQLCommenter injection, and DuckDB statement profiling, upgrades pre-commit tools and lockfile dependencies, and resolves DuckDB Arrow result typing. ## Key Changes ### Documentation (`docs/`) - Add comprehensive `v0.68.0` release notes in `docs/changelog.rst` documenting new features, changes, and fixes across PRs #840, #849, #850, #851, and #852. ### Package & Tooling (`pyproject.toml`, `.pre-commit-config.yaml`, `uv.lock`) - Bump package `version` and bumpversion `current_version` to `0.68.0` in `pyproject.toml`. - Bump `ruff-pre-commit` hook from `v0.16.10` to `v0.17.0` in `.pre-commit-config.yaml`. - Update `uv.lock` with bumped `sqlspec` package version and refreshed dependencies. ### Database Adapters (`sqlspec/adapters/duckdb/`) - Ensure `DuckDBDriver.select_to_arrow` verifies `cursor.to_arrow_table()` is not `None` before passing to `build_arrow_result_from_table`, satisfying strict type checking under updated DuckDB stubs.
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
Decouples wire-level
sqlcommenterinjection from statement AST transformers so compilation caching remains active, adds zero-RTT Oracle session trace piggybacking (MODULE,ACTION,CLIENT_IDENTIFIER, andECID), and adds opt-in DuckDB statement profiling and per-statementexecute_scriptobservability events acrossduckdbandadbc.Closes #848
Closes #810
Key Changes
Wire-Level SQLCommenter & Correlation Context (
sqlspec/core/,sqlspec/driver/,sqlspec/adapters/psqlpy/)append_wire_sqlcomment(...)insqlspec/core/sqlcommenter.pybridgingCorrelationContext.get()as a fallback forcorrelation_idand mergingSQLCommenterContext.get()attributes without mutating theSQLobject or enabling_has_transformers, preserving_stmt_cache_enabled = Truewhenenable_sqlcommenter=True._wire_sqlcomment_enabled(...)and_format_wire_sql(...)inCommonDriverAttributesMixin(sqlspec/driver/_common.py) and apply wire-level comment appending inSyncDriverAdapterBase._prepare_driver_statementandAsyncDriverAdapterBase._prepare_driver_statement._dml_count_query(clean_sql)before appending dynamic wire comments inPsqlpyDriver(sqlspec/adapters/psqlpy/driver.py) so@lru_cache(maxsize=512)hits remain stable across dynamic trace contexts.Zero-RTT Oracle Session Tracing (
sqlspec/adapters/oracledb/)enable_session_tracingindriver_featuresandapply_oracle_session_tracing(...)insqlspec/adapters/oracledb/core.pyto stageconnection.module,connection.action,connection.client_identifier, andconnection.econtext_id(ECID, when supported by thepython-oracledbmode) directly on the connection object before the next cursor execution round-trip with dirty-state deduplication via_sqlspec_trace_state.DuckDB Statement Profiling & Script Observability (
sqlspec/observability/,sqlspec/builder/,sqlspec/adapters/{duckdb,adbc}/)StatementEvent(__slots__) andObservabilityRuntimewithprofile: dict[str, Any] | None,script_ordinal: int | None, andscript_statement_count: int | None.build_duckdb_explain(...)(sqlspec/builder/_explain.py) to emit parenthesizedEXPLAIN (ANALYZE, FORMAT JSON) <sql>options.enable_statement_profiling(PRAGMA enable_profiling = 'json',PRAGMA profiling_output = '<temp_file>') and per-statementStatementEventemission (script_ordinal,script_statement_count, and parsed JSON profile payload) indispatch_execute_scriptacrossDuckDBConfig/DuckDBDriverand DuckDB-backedAdbcConfig/AdbcDriver.