Support YDB native UUID type - #86
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
Adds support for YDB's native UUID type by introducing a custom SQLAlchemy type, mapping it in the compiler and dialect, and exercising it via new tests.
- Introduce
YqlUUIDto handle binding ofuuid.UUIDand string values into a native UUID column. - Extend the SQL generation and YDB type mapping to recognize
UUIDand map it toydb.PrimitiveType.UUID. - Update the dialect’s type map and add tests for both native and string-based UUID columns.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ydb_sqlalchemy/sqlalchemy/types.py | Added YqlUUID subclass with bind processor and stub result processor |
| ydb_sqlalchemy/sqlalchemy/compiler/sa20.py | Added visit_UUID and mapping logic in YqlTypeCompiler |
| ydb_sqlalchemy/sqlalchemy/init.py | Mapped YDB’s PrimitiveType.UUID to sa.UUID and registered YqlUUID |
| test/test_core.py | Imported uuid, defined test_uuid_types table and new tests for UUIDs |
Comments suppressed due to low confidence (2)
test/test_core.py:322
- Add a test case for passing an invalid UUID string into the
uuid_nativecolumn to verify that aValueErroris raised by the bind processor.
def test_uuid_types(self, connection):
ydb_sqlalchemy/sqlalchemy/types.py:17
- [nitpick] Add a docstring for
YqlUUIDto describe its purpose and behavior for binding and result processing of native UUID values.
class YqlUUID(types.UUID):
LuckySting
suggested changes
Jul 21, 2025
|
Hi @vgvoleg! |
vgvoleg
force-pushed
the
uuid_support
branch
from
September 11, 2026 12:31
ecd2723 to
6356238
Compare
vgvoleg
force-pushed
the
uuid_support
branch
from
September 14, 2026 09:47
6356238 to
c0545ea
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The integration test table name should be unique per run to avoid collisions.
Review details
Suppressed comments (1)
tests/integration/test_core.py:259
- This integration table has a fixed name, so concurrent or repeated dialect runs against the shared YDB database can collide with an existing
test_uuid_typestable (and its fixed primary-key values). Please give the table a per-run unique suffix, following the unique-name convention used by the integration suite.
"test_uuid_types",
- Files reviewed: 9/9 changed files
- Comments generated: 0 new
- Review effort level: Lite
vgvoleg
force-pushed
the
uuid_support
branch
from
September 14, 2026 10:30
c0545ea to
1539bfd
Compare
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.
Closes: #84