The ydb.DataQuery is cached within a session scope using a hash of sql text as key. This lead to issues if a query is executed with different types (optional/required). For example, this code snipped reproduces the error:
with connection_no_trans.begin() as transaction:
connection_no_trans.execute(sa.insert(table).values([{"id": 1, "text": "foo"}]))
connection_no_trans.execute(sa.insert(table).values([{"id": 2, "text": None}]))
The "text" parameter in the first execution has type Utf8 and Optional<Utf8> in the second, which leads to error.
Proposal
There is an ability to construct a cache key manually on the caller side, so it is possible to include types of parameters to it.
Problem
The
ydb.DataQuery
is cached within a session scope using a hash of sql text as key. This lead to issues if a query is executed with different types (optional/required). For example, this code snipped reproduces the error:The "text" parameter in the first execution has type
Utf8
andOptional<Utf8>
in the second, which leads to error.Proposal
There is an ability to construct a cache key manually on the caller side, so it is possible to include types of parameters to it.
Result
The example query is executed without an error.