Add UUID and Enum type processors (v0.3.10)#25
Merged
Conversation
Adds D1UUID and D1Enum type processors so SQLAlchemy uuid.UUID objects and Python enum classes round-trip correctly through D1's TEXT storage. Updates colspecs to map Uuid and Enum to their D1-aware subclasses. Also resolves all pre-existing mypy strict-mode errors across all five source files and adds full type annotations throughout the codebase.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
D1UUIDandD1Enumtype processors souuid.UUIDobjects and Pythonenum.Enumsubclasses round-trip correctly through D1's TEXT storagecolspecsso SQLAlchemy automatically uses the D1-aware subclasses for UUID and Enum columnsvisit_UUID,visit_uuid,visit_enum) mapping to TEXTCloses #24
Closes #18
Test plan
uv run pytest tests/— 20 unit tests passmake integration_tests— 147/148 pass (1 pre-existing flaky timing test)uv run mypy src/sqlalchemy_cloudflare_d1/— 0 errorsuv run ruff check src/ && uv run ruff format src/— clean