Skip to content

Single vocab table loading#31

Merged
nicoloesch merged 2 commits into
mainfrom
30-single-vocab
Jul 20, 2026
Merged

Single vocab table loading#31
nicoloesch merged 2 commits into
mainfrom
30-single-vocab

Conversation

@nicoloesch

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes Allow to load a singular vocabulary table #30

  • load_vocab_source() gains an optional tables: list[str] | None = None parameter

    • When provided, only models whose __tablename__ is in the list are loaded
    • the all-required-files preflight check is skipped
    • an absent CSV for a named table is an error rather than a silent skip.
  • Unknown table names are validated eagerly against the full vocabulary table set before any DB work begins.

  • load-vocab-source CLI command gains a repeatable --table <name> option that maps directly to the new parameter. No --table flags = existing all-tables behaviour, unchanged.

Test plan

  • load-vocab-source --table concept loads only concept
  • load-vocab-source --table concept --table vocabulary loads exactly those two
  • load-vocab-source --table not_a_table raises ValueError before any DB connection
  • load-vocab-source (no flag) behaves identically to the previous version
  • Missing CSV for an explicitly named table produces a clear RuntimeError
  • --table with a sparse source dir skips the all-required-files preflight correctly
  • CLI fake_load_vocab_source stub updated to accept tables kwarg (regression guard)

@nicoloesch
nicoloesch requested a review from gkennos July 8, 2026 05:33
Comment thread omop_alchemy/maintenance/cli_vocab.py Outdated
Comment thread omop_alchemy/maintenance/cli_vocab.py Outdated
@gkennos
gkennos self-requested a review July 19, 2026 14:42
@nicoloesch nicoloesch added the fix Bug fix, backwards-compatible. PATCH: x.y.z+1 label Jul 20, 2026
@nicoloesch
nicoloesch merged commit 6c3e2e3 into main Jul 20, 2026
3 checks passed
@nicoloesch
nicoloesch deleted the 30-single-vocab branch July 20, 2026 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix, backwards-compatible. PATCH: x.y.z+1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to load a singular vocabulary table

2 participants