Skip to content

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

Open
cofin wants to merge 2 commits into
mainfrom
feat/data-dictionary-sql-consolidation
Open

feat(data-dictionary): co-locate dialect packages and consolidate domain SQL#688
cofin wants to merge 2 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 70.88608% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.35%. Comparing base (0adde96) to head (650738a).

Files with missing lines Patch % Lines
sqlspec/data_dictionary/_loader.py 61.01% 15 Missing and 8 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #688      +/-   ##
==========================================
- Coverage   77.38%   77.35%   -0.03%     
==========================================
  Files         476      486      +10     
  Lines       68211    68265      +54     
  Branches     9385     9396      +11     
==========================================
+ Hits        52782    52809      +27     
- Misses      12022    12042      +20     
- Partials     3407     3414       +7     
Flag Coverage Δ
integration 60.86% <55.69%> (-0.05%) ⬇️
py3.10 75.67% <70.88%> (-0.02%) ⬇️
py3.11 75.69% <70.88%> (-0.02%) ⬇️
py3.12 75.69% <70.88%> (-0.02%) ⬇️
py3.13 75.69% <70.88%> (-0.02%) ⬇️
py3.14 76.57% <70.88%> (-0.02%) ⬇️
unit 64.94% <70.88%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
...spec/data_dictionary/dialects/bigquery/__init__.py 100.00% <100.00%> (ø)
...qlspec/data_dictionary/dialects/bigquery/config.py 100.00% <ø> (ø)
...c/data_dictionary/dialects/cockroachdb/__init__.py 100.00% <100.00%> (ø)
...pec/data_dictionary/dialects/cockroachdb/config.py 100.00% <ø> (ø)
...qlspec/data_dictionary/dialects/duckdb/__init__.py 100.00% <100.00%> (ø)
sqlspec/data_dictionary/dialects/duckdb/config.py 100.00% <ø> (ø)
...lspec/data_dictionary/dialects/mariadb/__init__.py 100.00% <100.00%> (ø)
sqlspec/data_dictionary/dialects/mssql/__init__.py 100.00% <100.00%> (ø)
sqlspec/data_dictionary/dialects/mssql/config.py 65.79% <ø> (ø)
sqlspec/data_dictionary/dialects/mysql/__init__.py 100.00% <100.00%> (ø)
... and 10 more

... and 1 file 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 from 2a0d8b7 to e4b20c8 Compare August 8, 2026 20:43
@cofin
cofin force-pushed the feat/data-dictionary-sql-consolidation branch from e4b20c8 to 650738a Compare August 8, 2026 23:39
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