Skip to content

Phase 2a — data layer: PynamoDB → pydantic + boto3#90

Closed
chrisbc wants to merge 1 commit into
migrate/strawberry-p1from
migrate/strawberry-p2-data
Closed

Phase 2a — data layer: PynamoDB → pydantic + boto3#90
chrisbc wants to merge 1 commit into
migrate/strawberry-p1from
migrate/strawberry-p2-data

Conversation

@chrisbc

@chrisbc chrisbc commented Jun 24, 2026

Copy link
Copy Markdown
Member

Stacked migration — PR 3 of N. Base = migrate/strawberry-p1 (Phase 1, #89). Retarget down the stack as each lands.
Epic: GNS-Science/nshm-toshi-api#359 · Tracking: #86 · Log: docs/MIGRATION_LOG.md

The headline §A4 risk, done as its own reviewable unit. Converts the only PynamoDB usage; the next PR ports the schema.

Changes

  • BinaryLargeObjectModel(pynamodb.Model) → a pydantic.BaseModel (BinaryLargeObjectItem) + thin boto3 DynamoDB CRUD.
  • BinaryLargeObject wrapper API is unchangedcli and composite_solution.cached (the resolver path) are untouched. tables / migrate() / drop_tables() preserved (create_table(wait=True) → boto3 table_exists waiter).
  • object_meta stored as a JSON string to reproduce PynamoDB's JSONAttribute exactly (values round-trip as ints, not Decimals — keeps to_json() byte-equal).
  • Kept the TODO-flagged get() shape as-is — no contract "improvements" mid-migration.
  • pynamodb dependency removed; uv re-locked.

Verification

  • moto contract data_store/test/test_model.py 4/4 (create/exists/delete table, save+get blob, no-blob path)
  • full suite 77 passed / 10 skipped; ruff + mypy clean
  • no lingering pynamodb imports; container entry/Dockerfile untouched (Phase 1 build proof still holds)

…r API)

- BinaryLargeObjectModel(pynamodb.Model) -> pydantic BaseModel + thin boto3
  DynamoDB CRUD; public BinaryLargeObject wrapper API unchanged so cli +
  composite_solution.cached are untouched
- object_meta stored as a JSON string (JSONAttribute parity; ints not Decimals)
- migrate()/drop_tables()/tables preserved (create_table wait -> boto3 waiter)
- drop pynamodb dependency; uv re-locked (164 pkgs)
- verified: moto contract 4/4, full suite 77 passed, ruff + mypy clean

Refs #86
@chrisbc

chrisbc commented Jun 24, 2026

Copy link
Copy Markdown
Member Author

Landed via the combined PR #95 (one merge → one test-stage deploy, per runbook G7). Per-phase detail preserved here.

@chrisbc chrisbc closed this Jun 24, 2026
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.

1 participant