Skip to content

feat: fail-fast on missing source_schema at GraphLoader write-API boundary #112

Description

@deanban

Problem
GraphLoader writes that participate in study-scoped MERGE keys (Entity, Property, Alias, ValueSet, Term-ValueSet, Term-Hierarchy, JoinPath, JoinPath-Uses, JoinPath-EntityLinks) require source_schema to isolate per-study graphs. Today most APIs accept source_schema=None and let Neo4j surface a downstream null-property error, which is hard to diagnose. Two of the join-path methods already raise; the rest are inconsistent.

Proposed solution
Add a _require_source_schema helper used by every loader method (and corresponding loader_utils batch function) that participates in a study-scoped MERGE, raising ValueError with a message that names the method and explains why source_schema is mandatory. Empty batches stay a no-op.

Alternatives considered

  • Default source_schema to a sentinel — silently masks the bug.
  • Type-system enforcement (drop the | None) — large blast radius across callsites and would still need runtime validation for the dynamic call paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions