Skip to content

Commit 7fdb54a

Browse files
committed
Add implicit bytes->ydb.PrimitiveType.String
1 parent a6b58ca commit 7fdb54a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

tests/query/test_query_parameters.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ def test_select_implicit_str(pool: ydb.QuerySessionPool):
3333
assert expected_value == actual_value
3434

3535

36+
def test_select_implicit_bytes(pool: ydb.QuerySessionPool):
37+
expected_value = b"text"
38+
res = pool.execute_with_retries(query, parameters={"$a": expected_value})
39+
actual_value = res[0].rows[0]["value"]
40+
assert expected_value == actual_value
41+
42+
3643
def test_select_implicit_list(pool: ydb.QuerySessionPool):
3744
expected_value = [1, 2, 3]
3845
res = pool.execute_with_retries(query, parameters={"$a": expected_value})

ydb/convert.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ def query_parameters_to_pb(parameters):
307307
float: types.PrimitiveType.Double,
308308
bool: types.PrimitiveType.Bool,
309309
str: types.PrimitiveType.Utf8,
310+
bytes: types.PrimitiveType.String,
310311
}
311312

312313

0 commit comments

Comments
 (0)