File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ import uuid
2
+ from symbol import parameters
3
+
1
4
import pytest
2
5
import ydb
3
6
@@ -152,3 +155,25 @@ class CustomClass:
152
155
typed_value = ydb .TypedValue (expected_value )
153
156
with pytest .raises (ValueError ):
154
157
pool .execute_with_retries (query , parameters = {"$a" : typed_value })
158
+
159
+ def test_uuid_send (pool : ydb .QuerySessionPool ):
160
+ val = uuid .UUID ("52F84CBA-B15A-4BF2-9696-161ECA74CB5D" )
161
+ query = """
162
+ DECLARE $val AS UUID;
163
+
164
+ SELECT CAST($val AS Utf8) AS value
165
+ """
166
+ res = pool .execute_with_retries (query , parameters = {"$val" : ydb .TypedValue (val , ydb .PrimitiveType .UUID )})
167
+ actual_value = res [0 ].rows [0 ]["value" ]
168
+ assert actual_value .upper () == str (val ).upper ()
169
+
170
+ def test_uuid_read (pool : ydb .QuerySessionPool ):
171
+ val = uuid .UUID ("52F84CBA-B15A-4BF2-9696-161ECA74CB5D" )
172
+ query = """
173
+ DECLARE $val AS Utf8;
174
+
175
+ SELECT CAST($val AS UUID) AS value
176
+ """
177
+ res = pool .execute_with_retries (query , parameters = {"$val" : ydb .TypedValue (str (val ), ydb .PrimitiveType .Utf8 )})
178
+ actual_value = res [0 ].rows [0 ]["value" ]
179
+ assert actual_value .hex .upper () == val .hex .upper ()
You can’t perform that action at this time.
0 commit comments