Skip to content

Commit 59cfcba

Browse files
authored
Merge pull request #121 from ydb-platform/fix-pass-set-params
fix passing set to execute params
2 parents 3382b84 + d81656c commit 59cfcba

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

tests/aio/test_types.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
('{"foo":"bar"}', "JsonDocument"),
3030
(uuid4(), "Uuid"),
3131
([1, 2, 3], "List<Int8>"),
32-
# ({1, 2, 3}, "Set<Int8>"), # FIXME: AttributeError: 'set' object has no attribute 'items'
32+
({1: None, 2: None, 3: None}, "Set<Int8>"),
3333
([b"a", b"b", b"c"], "List<String>"),
3434
({"a": 1001, "b": 1002}, "Dict<Utf8, Int32>"),
3535
(("a", 1001), "Tuple<Utf8, Int32>"),
@@ -47,7 +47,6 @@ async def test_types(driver, database, value, ydb_type):
4747
prepared = await session.prepare(
4848
f"DECLARE $param as {ydb_type}; SELECT $param as value"
4949
)
50-
5150
result = await session.transaction().execute(
5251
prepared, {"$param": value}, commit_tx=True
5352
)

ydb/convert.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,10 @@ def _dict_to_pb(type_pb, value):
214214
for key, payload in value.items():
215215
kv_pair = value_pb.pairs.add()
216216
kv_pair.key.MergeFrom(_from_native_value(type_pb.dict_type.key, key))
217-
kv_pair.payload.MergeFrom(
218-
_from_native_value(type_pb.dict_type.payload, payload)
219-
)
217+
if payload:
218+
kv_pair.payload.MergeFrom(
219+
_from_native_value(type_pb.dict_type.payload, payload)
220+
)
220221
return value_pb
221222

222223

0 commit comments

Comments
 (0)