Skip to content

feat: add native metadata statistics#522

Open
cofin wants to merge 5 commits into
mainfrom
codex/adapter-feature-driver-metadata-statistics
Open

feat: add native metadata statistics#522
cofin wants to merge 5 commits into
mainfrom
codex/adapter-feature-driver-metadata-statistics

Conversation

@cofin

@cofin cofin commented Jun 13, 2026

Copy link
Copy Markdown
Member

Summary

Adds ADBC and Arrow ODBC metadata coverage while keeping the SQLSpec central dialect data-dictionary SQL as the canonical fallback. ADBC native metadata is used as an overlay when driver output can be normalized to the existing public metadata types, and ADBC statistics remain adapter-local because there is no shared portable statistics contract.

Changes

  • Adds TableStatisticsMetadata and exports it from the data dictionary package.
  • Uses ADBC GetObjects/GetTableSchema as an optional native overlay for tables, columns, and foreign keys, with central dialect SQL fallback when native metadata is unsupported or incomplete.
  • Keeps index metadata on the existing SQL introspection paths because ADBC has no portable index representation.
  • Adds ADBC-only get_statistics() backed by GetStatistics, with OperationalError for unsupported drivers.
  • Adds Arrow ODBC schema probing support for table columns.
  • Expands adapter contract metadata assertions and adapter-specific unit/integration coverage.
  • Updates ADBC and Arrow ODBC reference docs, including central fallback behavior and precision limits.
  • Reorders AdbcDataDictionary so public data-dictionary methods appear before private implementation helpers.

@codecov-commenter

codecov-commenter commented Jun 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.56790% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.94%. Comparing base (a876f40) to head (088f05a).

Files with missing lines Patch % Lines
sqlspec/adapters/adbc/data_dictionary.py 89.27% 17 Missing and 11 partials ⚠️
sqlspec/adapters/arrow_odbc/data_dictionary.py 59.25% 15 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #522      +/-   ##
==========================================
+ Coverage   74.87%   74.94%   +0.07%     
==========================================
  Files         441      441              
  Lines       55085    55349     +264     
  Branches     8689     8756      +67     
==========================================
+ Hits        41245    41484     +239     
- Misses      11156    11163       +7     
- Partials     2684     2702      +18     
Flag Coverage Δ
integration 58.64% <59.56%> (-0.02%) ⬇️
py3.10 71.85% <84.56%> (+0.09%) ⬆️
py3.11 71.87% <84.56%> (+0.09%) ⬆️
py3.12 71.86% <84.56%> (+0.09%) ⬆️
py3.13 71.86% <84.56%> (+0.09%) ⬆️
py3.14 74.08% <84.17%> (+0.08%) ⬆️
unit 62.02% <81.17%> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sqlspec/data_dictionary/__init__.py 76.92% <ø> (ø)
sqlspec/data_dictionary/_types.py 99.25% <100.00%> (+0.05%) ⬆️
sqlspec/adapters/arrow_odbc/data_dictionary.py 46.42% <59.25%> (+18.16%) ⬆️
sqlspec/adapters/adbc/data_dictionary.py 71.93% <89.27%> (+17.80%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cofin cofin marked this pull request as ready for review June 13, 2026 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants