Skip to content

feat(data-dictionary): co-locate dialect packages and consolidate domain SQL - #688

Merged
cofin merged 3 commits into
mainfrom
feat/data-dictionary-sql-consolidation
Aug 9, 2026
Merged

feat(data-dictionary): co-locate dialect packages and consolidate domain SQL#688
cofin merged 3 commits into
mainfrom
feat/data-dictionary-sql-consolidation

Conversation

@cofin

@cofin cofin commented Aug 8, 2026

Copy link
Copy Markdown
Member

Description

Refactors the data dictionary subsystem in sqlspec/data_dictionary/ to co-locate Python dialect modules and SQL query files into package directories per database engine.

Changes Included

  1. Co-located Dialect Packages: Converts sqlspec/data_dictionary/dialects/<dialect>.py into package directories sqlspec/data_dictionary/dialects/<dialect>/ containing config.py (defines <DIALECT>_CONFIG) and __init__.py (re-exports config & helpers).
  2. Domain SQL Subdirectories: Places domain .sql query files (columns.sql, tables.sql, indexes.sql, etc.) inside sqlspec/data_dictionary/dialects/<dialect>/sql/.
  3. Loader Refactoring: Updates DataDictionaryLoader in _loader.py to lazy-load domain .sql files via importlib.resources.files(f"sqlspec.data_dictionary.dialects.{dialect}.sql").joinpath(f"{domain}.sql").
  4. Directory Cleanup: Removes the legacy sqlspec/data_dictionary/sql/ directory tree.

Quality Gates

  • make lint passed (ruff lint, format, mypy, pyright, slotscheck, codespell, zizmor).
  • uv run pytest tests/unit/data_dictionary/ passed (125/125 unit tests green).

@codecov-commenter

codecov-commenter commented Aug 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.32026% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.39%. Comparing base (908004c) to head (7e3e991).

Files with missing lines Patch % Lines
sqlspec/adapters/adbc/data_dictionary.py 44.82% 15 Missing and 1 partial ⚠️
sqlspec/data_dictionary/_loader.py 57.69% 8 Missing and 3 partials ⚠️
sqlspec/adapters/arrow_odbc/data_dictionary.py 50.00% 8 Missing and 1 partial ⚠️
sqlspec/driver/_common.py 60.00% 3 Missing and 1 partial ⚠️
sqlspec/adapters/bigquery/data_dictionary.py 40.00% 3 Missing ⚠️
sqlspec/adapters/mysqlconnector/data_dictionary.py 71.42% 2 Missing ⚠️
sqlspec/adapters/aiomysql/data_dictionary.py 66.66% 1 Missing ⚠️
sqlspec/adapters/aiosqlite/data_dictionary.py 66.66% 1 Missing ⚠️
sqlspec/adapters/asyncmy/data_dictionary.py 66.66% 1 Missing ⚠️
sqlspec/adapters/spanner/data_dictionary.py 0.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #688      +/-   ##
==========================================
- Coverage   77.41%   77.39%   -0.03%     
==========================================
  Files         476      486      +10     
  Lines       68266    68278      +12     
  Branches     9403     9405       +2     
==========================================
- Hits        52849    52844       -5     
- Misses      12013    12024      +11     
- Partials     3404     3410       +6     
Flag Coverage Δ
integration 60.86% <52.94%> (-0.04%) ⬇️
py3.10 75.70% <67.32%> (-0.02%) ⬇️
py3.11 75.72% <67.32%> (-0.02%) ⬇️
py3.12 75.72% <67.32%> (-0.02%) ⬇️
py3.13 75.72% <67.32%> (-0.02%) ⬇️
py3.14 76.60% <67.32%> (-0.03%) ⬇️
unit 65.02% <58.82%> (-0.02%) ⬇️

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

Files with missing lines Coverage Δ
sqlspec/adapters/asyncpg/data_dictionary.py 70.25% <100.00%> (ø)
...spec/adapters/cockroach_asyncpg/data_dictionary.py 42.02% <100.00%> (ø)
...spec/adapters/cockroach_psycopg/data_dictionary.py 37.19% <100.00%> (ø)
sqlspec/adapters/duckdb/data_dictionary.py 62.72% <100.00%> (ø)
sqlspec/adapters/mssql_python/data_dictionary.py 74.64% <100.00%> (ø)
sqlspec/adapters/oracledb/data_dictionary.py 71.79% <100.00%> (ø)
sqlspec/adapters/psqlpy/data_dictionary.py 70.80% <100.00%> (ø)
sqlspec/adapters/psycopg/data_dictionary.py 68.97% <100.00%> (ø)
sqlspec/adapters/pymssql/data_dictionary.py 65.49% <100.00%> (ø)
sqlspec/adapters/pymysql/data_dictionary.py 60.68% <100.00%> (ø)
... and 30 more

... 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 force-pushed the feat/data-dictionary-sql-consolidation branch 2 times, most recently from e4b20c8 to 650738a Compare August 8, 2026 23:39
@cofin
cofin force-pushed the feat/data-dictionary-sql-consolidation branch from 650738a to 0eaf874 Compare August 9, 2026 15:16
@cofin
cofin merged commit cfdfc1f into main Aug 9, 2026
33 of 38 checks passed
@cofin
cofin deleted the feat/data-dictionary-sql-consolidation branch August 9, 2026 19:20
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