Skip to content

Rewrite merge methods on real Core constructs so schema_translate_map applies to loaded data - #39

Open
nicoloesch wants to merge 8 commits into
mainfrom
schema-translate-map
Open

Rewrite merge methods on real Core constructs so schema_translate_map applies to loaded data#39
nicoloesch wants to merge 8 commits into
mainfrom
schema-translate-map

Conversation

@nicoloesch

@nicoloesch nicoloesch commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Depends on AustralianCancerDataNetwork/oa-configurator#37.

Requires pyproject.toml version update for oa-configurator

Root cause

merge_replace/merge_insert/merge_upsert built raw, unqualified text() SQL, so loaded data landed in the wrong schema on any non-default-schema deployment.

Fix

  • Rewritten against real Table objects and dialect-specific Core constructs (sa.delete, insert().from_select(), postgresql.insert().on_conflict_do_nothing(), with a SQLite-specific counterpart), for both backends.
  • Fixes the one remaining raw isolation_level="AUTOCOMMIT" call site
  • adopts oa-configurator's new test infrastructure.
  • STAGING_SCHEMA's reserved-schema registration moved into config.py (the actual omop.config entry point), so it's guaranteed to run whenever this package's config is resolvable at all, instead of depending on some other module happening to be imported first.
  • engine_with_replica_role now uses autocommit_connection()'s Engine branch directly instead of opening a connection first and handing it in, removing a redundant step.
  • Its own Dialect enum is gone; imports the shared one from oa-configurator instead, with no change in dispatch behaviour.

Checklist

  • Applied exactly one label (breaking, feature, fix, dependencies, or chore)
  • Tests pass locally (uv run pytest -q): 199 passed, 1 xfailed
  • Tests pass locally (uv run pytest -q -m postgresql): 30 passed
  • Lint passes (uv run ruff check .)

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.

1 participant