aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-09-09 11:36:15 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-09-09 11:45:24 +0300
commit345cf22bb0095622fb0eb948f5da6539df335115 (patch)
tree98dd378bf139eaefea588a181b9b9fe7e14ac65d /contrib
parent1839abf5e82593260abe298e5257de644f3ab7b4 (diff)
downloadydb-345cf22bb0095622fb0eb948f5da6539df335115.tar.gz
Intermediate changes
Diffstat (limited to 'contrib')
-rw-r--r--contrib/python/ydb/py3/.dist-info/METADATA2
-rw-r--r--contrib/python/ydb/py3/ya.make2
-rw-r--r--contrib/python/ydb/py3/ydb/aio/connection.py8
-rw-r--r--contrib/python/ydb/py3/ydb/aio/query/transaction.py19
-rw-r--r--contrib/python/ydb/py3/ydb/convert.py3
-rw-r--r--contrib/python/ydb/py3/ydb/query/transaction.py39
-rw-r--r--contrib/python/ydb/py3/ydb/ydb_version.py2
7 files changed, 40 insertions, 35 deletions
diff --git a/contrib/python/ydb/py3/.dist-info/METADATA b/contrib/python/ydb/py3/.dist-info/METADATA
index b1c2dcdaa2..4397bad877 100644
--- a/contrib/python/ydb/py3/.dist-info/METADATA
+++ b/contrib/python/ydb/py3/.dist-info/METADATA
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: ydb
-Version: 3.16.0
+Version: 3.16.1
Summary: YDB Python SDK
Home-page: http://github.com/ydb-platform/ydb-python-sdk
Author: Yandex LLC
diff --git a/contrib/python/ydb/py3/ya.make b/contrib/python/ydb/py3/ya.make
index bc7c34dd4d..8c6877ee58 100644
--- a/contrib/python/ydb/py3/ya.make
+++ b/contrib/python/ydb/py3/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(3.16.0)
+VERSION(3.16.1)
LICENSE(Apache-2.0)
diff --git a/contrib/python/ydb/py3/ydb/aio/connection.py b/contrib/python/ydb/py3/ydb/aio/connection.py
index 1510d8e10e..21461b4bad 100644
--- a/contrib/python/ydb/py3/ydb/aio/connection.py
+++ b/contrib/python/ydb/py3/ydb/aio/connection.py
@@ -226,7 +226,7 @@ class Connection:
await asyncio.wait_for(self._channel.channel_ready(), timeout=ready_timeout)
- async def close(self, grace: float = None):
+ async def close(self, grace: float = 30):
"""
Closes the underlying gRPC channel
:param: grace: If a grace period is specified, this method wait until all active
@@ -238,12 +238,12 @@ class Connection:
self.closing = True
- if self.calls:
- await asyncio.wait(self.calls.values(), timeout=grace)
-
for callback in self._cleanup_callbacks:
callback(self)
+ if self.calls:
+ await asyncio.wait(self.calls.values(), timeout=grace)
+
await self.destroy()
async def __aenter__(self):
diff --git a/contrib/python/ydb/py3/ydb/aio/query/transaction.py b/contrib/python/ydb/py3/ydb/aio/query/transaction.py
index e9993fccc2..429ba125c8 100644
--- a/contrib/python/ydb/py3/ydb/aio/query/transaction.py
+++ b/contrib/python/ydb/py3/ydb/aio/query/transaction.py
@@ -5,6 +5,7 @@ from typing import (
from .base import AsyncResponseContextIterator
from ... import issues
+from ...settings import BaseRequestSettings
from ...query import base
from ...query.transaction import (
BaseQueryTxContext,
@@ -46,25 +47,25 @@ class QueryTxContextAsync(BaseQueryTxContext):
pass
self._prev_stream = None
- async def begin(self, settings: Optional[base.QueryClientSettings] = None) -> "QueryTxContextAsync":
+ async def begin(self, settings: Optional[BaseRequestSettings] = None) -> "QueryTxContextAsync":
"""WARNING: This API is experimental and could be changed.
Explicitly begins a transaction
- :param settings: A request settings
+ :param settings: An additional request settings BaseRequestSettings;
:return: None or exception if begin is failed
"""
await self._begin_call(settings)
return self
- async def commit(self, settings: Optional[base.QueryClientSettings] = None) -> None:
+ async def commit(self, settings: Optional[BaseRequestSettings] = None) -> None:
"""WARNING: This API is experimental and could be changed.
Calls commit on a transaction if it is open otherwise is no-op. If transaction execution
failed then this method raises PreconditionFailed.
- :param settings: A request settings
+ :param settings: An additional request settings BaseRequestSettings;
:return: A committed transaction or exception if commit is failed
"""
@@ -79,13 +80,13 @@ class QueryTxContextAsync(BaseQueryTxContext):
await self._commit_call(settings)
- async def rollback(self, settings: Optional[base.QueryClientSettings] = None) -> None:
+ async def rollback(self, settings: Optional[BaseRequestSettings] = None) -> None:
"""WARNING: This API is experimental and could be changed.
Calls rollback on a transaction if it is open otherwise is no-op. If transaction execution
failed then this method raises PreconditionFailed.
- :param settings: A request settings
+ :param settings: An additional request settings BaseRequestSettings;
:return: A committed transaction or exception if commit is failed
"""
@@ -108,7 +109,7 @@ class QueryTxContextAsync(BaseQueryTxContext):
syntax: Optional[base.QuerySyntax] = None,
exec_mode: Optional[base.QueryExecMode] = None,
concurrent_result_sets: Optional[bool] = False,
- settings: Optional[base.QueryClientSettings] = None,
+ settings: Optional[BaseRequestSettings] = None,
) -> AsyncResponseContextIterator:
"""WARNING: This API is experimental and could be changed.
@@ -137,9 +138,9 @@ class QueryTxContextAsync(BaseQueryTxContext):
exec_mode=exec_mode,
parameters=parameters,
concurrent_result_sets=concurrent_result_sets,
+ settings=settings,
)
- settings = settings if settings is not None else self.session._settings
self._prev_stream = AsyncResponseContextIterator(
stream_it,
lambda resp: base.wrap_execute_query_response(
@@ -147,7 +148,7 @@ class QueryTxContextAsync(BaseQueryTxContext):
response_pb=resp,
tx=self,
commit_tx=commit_tx,
- settings=settings,
+ settings=self.session._settings,
),
)
return self._prev_stream
diff --git a/contrib/python/ydb/py3/ydb/convert.py b/contrib/python/ydb/py3/ydb/convert.py
index 63a5dbe4e3..f48e024aba 100644
--- a/contrib/python/ydb/py3/ydb/convert.py
+++ b/contrib/python/ydb/py3/ydb/convert.py
@@ -304,9 +304,10 @@ def query_parameters_to_pb(parameters):
_from_python_type_map = {
int: types.PrimitiveType.Int64,
- float: types.PrimitiveType.Float,
+ float: types.PrimitiveType.Double,
bool: types.PrimitiveType.Bool,
str: types.PrimitiveType.Utf8,
+ bytes: types.PrimitiveType.String,
}
diff --git a/contrib/python/ydb/py3/ydb/query/transaction.py b/contrib/python/ydb/py3/ydb/query/transaction.py
index 750a94b0b5..be7396b1a5 100644
--- a/contrib/python/ydb/py3/ydb/query/transaction.py
+++ b/contrib/python/ydb/py3/ydb/query/transaction.py
@@ -15,6 +15,7 @@ from .._grpc.grpcwrapper import ydb_query as _ydb_query
from ..connection import _RpcState as RpcState
from . import base
+from ..settings import BaseRequestSettings
logger = logging.getLogger(__name__)
@@ -214,7 +215,7 @@ class BaseQueryTxContext:
"""
return self._tx_state.tx_id
- def _begin_call(self, settings: Optional[base.QueryClientSettings]) -> "BaseQueryTxContext":
+ def _begin_call(self, settings: Optional[BaseRequestSettings]) -> "BaseQueryTxContext":
self._tx_state._check_invalid_transition(QueryTxStateEnum.BEGINED)
return self._driver(
@@ -226,7 +227,7 @@ class BaseQueryTxContext:
(self._session_state, self._tx_state, self),
)
- def _commit_call(self, settings: Optional[base.QueryClientSettings]) -> "BaseQueryTxContext":
+ def _commit_call(self, settings: Optional[BaseRequestSettings]) -> "BaseQueryTxContext":
self._tx_state._check_invalid_transition(QueryTxStateEnum.COMMITTED)
return self._driver(
@@ -238,7 +239,7 @@ class BaseQueryTxContext:
(self._session_state, self._tx_state, self),
)
- def _rollback_call(self, settings: Optional[base.QueryClientSettings]) -> "BaseQueryTxContext":
+ def _rollback_call(self, settings: Optional[BaseRequestSettings]) -> "BaseQueryTxContext":
self._tx_state._check_invalid_transition(QueryTxStateEnum.ROLLBACKED)
return self._driver(
@@ -253,11 +254,12 @@ class BaseQueryTxContext:
def _execute_call(
self,
query: str,
- commit_tx: bool = False,
- syntax: base.QuerySyntax = None,
- exec_mode: base.QueryExecMode = None,
- parameters: dict = None,
- concurrent_result_sets: bool = False,
+ commit_tx: Optional[bool],
+ syntax: Optional[base.QuerySyntax],
+ exec_mode: Optional[base.QueryExecMode],
+ parameters: Optional[dict],
+ concurrent_result_sets: Optional[bool],
+ settings: Optional[BaseRequestSettings],
) -> Iterable[_apis.ydb_query.ExecuteQueryResponsePart]:
self._tx_state._check_tx_ready_to_use()
@@ -277,6 +279,7 @@ class BaseQueryTxContext:
request.to_proto(),
_apis.QueryService.Stub,
_apis.QueryService.ExecuteQuery,
+ settings=settings,
)
def _move_to_beginned(self, tx_id: str) -> None:
@@ -323,12 +326,12 @@ class QueryTxContextSync(BaseQueryTxContext):
pass
self._prev_stream = None
- def begin(self, settings: Optional[base.QueryClientSettings] = None) -> "QueryTxContextSync":
+ def begin(self, settings: Optional[BaseRequestSettings] = None) -> "QueryTxContextSync":
"""WARNING: This API is experimental and could be changed.
Explicitly begins a transaction
- :param settings: A request settings
+ :param settings: An additional request settings BaseRequestSettings;
:return: Transaction object or exception if begin is failed
"""
@@ -336,13 +339,13 @@ class QueryTxContextSync(BaseQueryTxContext):
return self
- def commit(self, settings: Optional[base.QueryClientSettings] = None) -> None:
+ def commit(self, settings: Optional[BaseRequestSettings] = None) -> None:
"""WARNING: This API is experimental and could be changed.
Calls commit on a transaction if it is open otherwise is no-op. If transaction execution
failed then this method raises PreconditionFailed.
- :param settings: A request settings
+ :param settings: An additional request settings BaseRequestSettings;
:return: A committed transaction or exception if commit is failed
"""
@@ -357,13 +360,13 @@ class QueryTxContextSync(BaseQueryTxContext):
self._commit_call(settings)
- def rollback(self, settings: Optional[base.QueryClientSettings] = None) -> None:
+ def rollback(self, settings: Optional[BaseRequestSettings] = None) -> None:
"""WARNING: This API is experimental and could be changed.
Calls rollback on a transaction if it is open otherwise is no-op. If transaction execution
failed then this method raises PreconditionFailed.
- :param settings: A request settings
+ :param settings: An additional request settings BaseRequestSettings;
:return: A committed transaction or exception if commit is failed
"""
@@ -386,7 +389,7 @@ class QueryTxContextSync(BaseQueryTxContext):
syntax: Optional[base.QuerySyntax] = None,
exec_mode: Optional[base.QueryExecMode] = None,
concurrent_result_sets: Optional[bool] = False,
- settings: Optional[base.QueryClientSettings] = None,
+ settings: Optional[BaseRequestSettings] = None,
) -> base.SyncResponseContextIterator:
"""WARNING: This API is experimental and could be changed.
@@ -403,7 +406,7 @@ class QueryTxContextSync(BaseQueryTxContext):
3) QueryExecMode.VALIDATE;
4) QueryExecMode.PARSE.
:param concurrent_result_sets: A flag to allow YDB mix parts of different result sets. Default is False;
- :param settings: An additional request settings QueryClientSettings;
+ :param settings: An additional request settings BaseRequestSettings;
:return: Iterator with result sets
"""
@@ -416,9 +419,9 @@ class QueryTxContextSync(BaseQueryTxContext):
exec_mode=exec_mode,
parameters=parameters,
concurrent_result_sets=concurrent_result_sets,
+ settings=settings,
)
- settings = settings if settings is not None else self.session._settings
self._prev_stream = base.SyncResponseContextIterator(
stream_it,
lambda resp: base.wrap_execute_query_response(
@@ -426,7 +429,7 @@ class QueryTxContextSync(BaseQueryTxContext):
response_pb=resp,
tx=self,
commit_tx=commit_tx,
- settings=settings,
+ settings=self.session._settings,
),
)
return self._prev_stream
diff --git a/contrib/python/ydb/py3/ydb/ydb_version.py b/contrib/python/ydb/py3/ydb/ydb_version.py
index 76caab7b48..96a1189198 100644
--- a/contrib/python/ydb/py3/ydb/ydb_version.py
+++ b/contrib/python/ydb/py3/ydb/ydb_version.py
@@ -1 +1 @@
-VERSION = "3.16.0"
+VERSION = "3.16.1"