Skip to content

add result_processor to handle UUID conversion; enhance tests for UUI…#6

Merged
h0rn3t merged 4 commits into
mainfrom
uuid-fix
Dec 2, 2025
Merged

add result_processor to handle UUID conversion; enhance tests for UUI…#6
h0rn3t merged 4 commits into
mainfrom
uuid-fix

Conversation

@h0rn3t

@h0rn3t h0rn3t commented Dec 2, 2025

Copy link
Copy Markdown
Owner

This pull request improves the handling of UUID values in the psqlpy_sqlalchemy dialect to ensure that UUID columns are returned as uuid.UUID objects instead of strings. It also adds regression tests to verify this behavior and prevent future issues.

UUID handling improvements:

  • Added a result_processor method to the custom UUID type in psqlpy_sqlalchemy/dialect.py to convert string or bytes UUID values returned by psqlpy into Python uuid.UUID objects when as_uuid=True. This ensures compatibility with SQLAlchemy 2.0+ and correct type handling for UUID columns.

Testing and regression coverage:

  • Added two regression tests in tests/test_uuid_support.py:
    • test_uuid_select_returns_uuid_objects verifies that selecting a UUID column returns a uuid.UUID object, not a string.
    • test_uuid_select_full_row ensures that selecting a full row returns the UUID field as a uuid.UUID object.…D return types

@h0rn3t h0rn3t merged commit 9dfde90 into main Dec 2, 2025
9 checks passed
@h0rn3t h0rn3t deleted the uuid-fix 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