Skip to content

Give the SQLite test fixtures their parent rows - #78

Open
nicoloesch wants to merge 1 commit into
mainfrom
77-sqlite-fixture-foreign-keys
Open

nicoloesch wants to merge 1 commit into
mainfrom
77-sqlite-fixture-foreign-keys

Conversation

@nicoloesch

Copy link
Copy Markdown
Collaborator

Summary

  • The SQLite test fixtures insert child rows without their parents, or before them. SQLite did not check this until oa-configurator 3.0.0 enforces foreign keys (Enforce foreign keys on SQLite connections oa-configurator#65).
  • The session seed flushes each row before the rows that reference it. The models declare no relationships between these tables, so the session does not order the inserts itself.
  • add_concepts and seed_row_parents insert the concepts and persons that a test's rows reference. fresh_cdm_engine is a fresh database with every CDM table and the fixture vocabulary.
  • The concept group, mapping, modifier projection and oncology tests use them, and insert the Maps to relationships next to their reverses in a single statement.
  • The tests pass with foreign key enforcement on and off, so this can merge before oa-configurator 3.0.0.

Checklist

  • Applied exactly one label (breaking, feature, fix, dependencies, or chore)
  • Tests pass locally (uv run pytest -q)
  • Lint passes (uv run ruff check .)

@nicoloesch nicoloesch added the chore Maintenance, refactoring, or housekeeping. Excluded from changelog, no version bump. label Nov 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, refactoring, or housekeeping. Excluded from changelog, no version bump.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make the SQLite test fixtures satisfy foreign keys

1 participant