Skip to content

add UUID support in dialect; enhance tests for Mapped[uuid.UUID] beha…#7

Merged
h0rn3t merged 1 commit into
mainfrom
uuid-fix-2
Dec 2, 2025
Merged

add UUID support in dialect; enhance tests for Mapped[uuid.UUID] beha…#7
h0rn3t merged 1 commit into
mainfrom
uuid-fix-2

Conversation

@h0rn3t

@h0rn3t h0rn3t commented Dec 2, 2025

Copy link
Copy Markdown
Owner

This pull request improves support for the UUID type in the psqlpy-sqlalchemy dialect, ensuring that SQLAlchemy models annotated with Mapped[uuid.UUID] are handled correctly and that the dialect returns Python uuid.UUID objects instead of strings. It also bumps the package version to 0.1.1b2 and adds a targeted test to verify this behavior.

UUID type support improvements:

  • Added explicit mapping for sqltypes.Uuid to the internal _PGUUID handler in the PSQLPyAsyncDialect class, ensuring that columns annotated as Mapped[uuid.UUID] are returned as uuid.UUID objects.
  • Added a new test (test_uuid_mapped_annotation_without_explicit_as_uuid) to verify that the dialect returns uuid.UUID objects for models using the Mapped[uuid.UUID] annotation pattern, without needing explicit UUID(as_uuid=True).
  • Updated test imports in tests/test_uuid_support.py to include Mapped and mapped_column, supporting the new test case.

Version bump:

  • Updated the package version to 0.1.1b2 in both pyproject.toml and psqlpy_sqlalchemy/__init__.py. [1] [2]…vior

@h0rn3t h0rn3t merged commit 9e8ff99 into main Dec 2, 2025
9 checks passed
@h0rn3t h0rn3t deleted the uuid-fix-2 branch December 11, 2025 15:14
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