Skip to content

Commit

Permalink
Remove experimental warn from query service
Browse files Browse the repository at this point in the history
  • Loading branch information
vgvoleg committed Sep 19, 2024
1 parent 67dfc17 commit b6c02ea
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 78 deletions.
21 changes: 5 additions & 16 deletions ydb/aio/query/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def __init__(self, driver: common_utils.SupportedDriverType, size: int = 100):
:param size: Size of session pool
"""

logger.warning("QuerySessionPool is an experimental API, which could be changed.")
self._driver = driver
self._size = size
self._should_stop = asyncio.Event()
Expand All @@ -44,9 +43,7 @@ async def _create_new_session(self):
return session

async def acquire(self) -> QuerySession:
"""WARNING: This API is experimental and could be changed.
Acquire a session from Session Pool.
"""Acquire a session from Session Pool.
:return A QuerySession object.
"""
Expand Down Expand Up @@ -86,28 +83,22 @@ async def acquire(self) -> QuerySession:
return session

async def release(self, session: QuerySession) -> None:
"""WARNING: This API is experimental and could be changed.
Release a session back to Session Pool.
"""Release a session back to Session Pool.
"""

self._queue.put_nowait(session)
logger.debug("Session returned to queue: %s", session._state.session_id)

def checkout(self) -> "SimpleQuerySessionCheckoutAsync":
"""WARNING: This API is experimental and could be changed.
Return a Session context manager, that acquires session on enter and releases session on exit.
"""Return a Session context manager, that acquires session on enter and releases session on exit.
"""

return SimpleQuerySessionCheckoutAsync(self)

async def retry_operation_async(
self, callee: Callable, retry_settings: Optional[RetrySettings] = None, *args, **kwargs
):
"""WARNING: This API is experimental and could be changed.
Special interface to execute a bunch of commands with session in a safe, retriable way.
"""Special interface to execute a bunch of commands with session in a safe, retriable way.
:param callee: A function, that works with session.
:param retry_settings: RetrySettings object.
Expand All @@ -131,9 +122,7 @@ async def execute_with_retries(
*args,
**kwargs,
) -> List[convert.ResultSet]:
"""WARNING: This API is experimental and could be changed.
Special interface to execute a one-shot queries in a safe, retriable way.
"""Special interface to execute a one-shot queries in a safe, retriable way.
Note: this method loads all data from stream before return, do not use this
method with huge read queries.
Expand Down
12 changes: 3 additions & 9 deletions ydb/aio/query/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ async def _check_session_status_loop(self) -> None:
self._state._change_state(QuerySessionStateEnum.CLOSED)

async def delete(self, settings: Optional[BaseRequestSettings] = None) -> None:
"""WARNING: This API is experimental and could be changed.
Deletes a Session of Query Service on server side and releases resources.
"""Deletes a Session of Query Service on server side and releases resources.
:return: None
"""
Expand All @@ -78,9 +76,7 @@ async def delete(self, settings: Optional[BaseRequestSettings] = None) -> None:
self._stream.cancel()

async def create(self, settings: Optional[BaseRequestSettings] = None) -> "QuerySession":
"""WARNING: This API is experimental and could be changed.
Creates a Session of Query Service on server side and attaches it.
"""Creates a Session of Query Service on server side and attaches it.
:return: QuerySession object.
"""
Expand Down Expand Up @@ -113,9 +109,7 @@ async def execute(
concurrent_result_sets: bool = False,
settings: Optional[BaseRequestSettings] = None,
) -> AsyncResponseContextIterator:
"""WARNING: This API is experimental and could be changed.
Sends a query to Query Service
"""Sends a query to Query Service
:param query: (YQL or SQL text) to be executed.
:param syntax: Syntax of the query, which is a one from the following choises:
Expand Down
16 changes: 4 additions & 12 deletions ydb/aio/query/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ async def _ensure_prev_stream_finished(self) -> None:
self._prev_stream = None

async def begin(self, settings: Optional[BaseRequestSettings] = None) -> "QueryTxContext":
"""WARNING: This API is experimental and could be changed.
Explicitly begins a transaction
"""Explicitly begins a transaction
:param settings: An additional request settings BaseRequestSettings;
Expand All @@ -60,9 +58,7 @@ async def begin(self, settings: Optional[BaseRequestSettings] = None) -> "QueryT
return self

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
"""Calls commit on a transaction if it is open otherwise is no-op. If transaction execution
failed then this method raises PreconditionFailed.
:param settings: An additional request settings BaseRequestSettings;
Expand All @@ -81,9 +77,7 @@ async def commit(self, settings: Optional[BaseRequestSettings] = None) -> None:
await self._commit_call(settings)

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
"""Calls rollback on a transaction if it is open otherwise is no-op. If transaction execution
failed then this method raises PreconditionFailed.
:param settings: An additional request settings BaseRequestSettings;
Expand Down Expand Up @@ -111,9 +105,7 @@ async def execute(
concurrent_result_sets: Optional[bool] = False,
settings: Optional[BaseRequestSettings] = None,
) -> AsyncResponseContextIterator:
"""WARNING: This API is experimental and could be changed.
Sends a query to Query Service
"""Sends a query to Query Service
:param query: (YQL or SQL text) to be executed.
:param parameters: dict with parameters and YDB types;
Expand Down
1 change: 0 additions & 1 deletion ydb/query/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

class QueryClientSync:
def __init__(self, driver: common_utils.SupportedDriverType, query_client_settings: QueryClientSettings = None):
logger.warning("QueryClientSync is an experimental API, which could be changed.")
self._driver = driver
self._settings = query_client_settings

Expand Down
21 changes: 5 additions & 16 deletions ydb/query/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def __init__(self, driver: common_utils.SupportedDriverType, size: int = 100):
:param size: Max size of Session Pool.
"""

logger.warning("QuerySessionPool is an experimental API, which could be changed.")
self._driver = driver
self._queue = queue.Queue()
self._current_size = 0
Expand All @@ -48,9 +47,7 @@ def _create_new_session(self, timeout: Optional[float]):
return session

def acquire(self, timeout: Optional[float] = None) -> QuerySession:
"""WARNING: This API is experimental and could be changed.
Acquire a session from Session Pool.
"""Acquire a session from Session Pool.
:param timeout: A timeout to wait in seconds.
Expand Down Expand Up @@ -102,28 +99,22 @@ def acquire(self, timeout: Optional[float] = None) -> QuerySession:
self._lock.release()

def release(self, session: QuerySession) -> None:
"""WARNING: This API is experimental and could be changed.
Release a session back to Session Pool.
"""Release a session back to Session Pool.
"""

self._queue.put_nowait(session)
logger.debug("Session returned to queue: %s", session._state.session_id)

def checkout(self, timeout: Optional[float] = None) -> "SimpleQuerySessionCheckout":
"""WARNING: This API is experimental and could be changed.
Return a Session context manager, that acquires session on enter and releases session on exit.
"""Return a Session context manager, that acquires session on enter and releases session on exit.
:param timeout: A timeout to wait in seconds.
"""

return SimpleQuerySessionCheckout(self, timeout)

def retry_operation_sync(self, callee: Callable, retry_settings: Optional[RetrySettings] = None, *args, **kwargs):
"""WARNING: This API is experimental and could be changed.
Special interface to execute a bunch of commands with session in a safe, retriable way.
"""Special interface to execute a bunch of commands with session in a safe, retriable way.
:param callee: A function, that works with session.
:param retry_settings: RetrySettings object.
Expand All @@ -147,9 +138,7 @@ def execute_with_retries(
*args,
**kwargs,
) -> List[convert.ResultSet]:
"""WARNING: This API is experimental and could be changed.
Special interface to execute a one-shot queries in a safe, retriable way.
"""Special interface to execute a one-shot queries in a safe, retriable way.
Note: this method loads all data from stream before return, do not use this
method with huge read queries.
Expand Down
16 changes: 4 additions & 12 deletions ydb/query/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,7 @@ def _check_session_status_loop(self, status_stream: _utilities.SyncResponseItera
self._state._change_state(QuerySessionStateEnum.CLOSED)

def delete(self, settings: Optional[BaseRequestSettings] = None) -> None:
"""WARNING: This API is experimental and could be changed.
Deletes a Session of Query Service on server side and releases resources.
"""Deletes a Session of Query Service on server side and releases resources.
:return: None
"""
Expand All @@ -249,9 +247,7 @@ def delete(self, settings: Optional[BaseRequestSettings] = None) -> None:
self._stream.cancel()

def create(self, settings: Optional[BaseRequestSettings] = None) -> "QuerySession":
"""WARNING: This API is experimental and could be changed.
Creates a Session of Query Service on server side and attaches it.
"""Creates a Session of Query Service on server side and attaches it.
:return: QuerySession object.
"""
Expand All @@ -266,9 +262,7 @@ def create(self, settings: Optional[BaseRequestSettings] = None) -> "QuerySessio
return self

def transaction(self, tx_mode: Optional[base.BaseQueryTxMode] = None) -> QueryTxContext:
"""WARNING: This API is experimental and could be changed.
Creates a transaction context manager with specified transaction mode.
"""Creates a transaction context manager with specified transaction mode.
:param tx_mode: Transaction mode, which is a one from the following choises:
1) QuerySerializableReadWrite() which is default mode;
Expand Down Expand Up @@ -299,9 +293,7 @@ def execute(
concurrent_result_sets: bool = False,
settings: Optional[BaseRequestSettings] = None,
) -> base.SyncResponseContextIterator:
"""WARNING: This API is experimental and could be changed.
Sends a query to Query Service
"""Sends a query to Query Service
:param query: (YQL or SQL text) to be executed.
:param syntax: Syntax of the query, which is a one from the following choises:
Expand Down
16 changes: 4 additions & 12 deletions ydb/query/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,7 @@ def _ensure_prev_stream_finished(self) -> None:
self._prev_stream = None

def begin(self, settings: Optional[BaseRequestSettings] = None) -> "QueryTxContext":
"""WARNING: This API is experimental and could be changed.
Explicitly begins a transaction
"""Explicitly begins a transaction
:param settings: An additional request settings BaseRequestSettings;
Expand All @@ -340,9 +338,7 @@ def begin(self, settings: Optional[BaseRequestSettings] = None) -> "QueryTxConte
return self

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
"""Calls commit on a transaction if it is open otherwise is no-op. If transaction execution
failed then this method raises PreconditionFailed.
:param settings: An additional request settings BaseRequestSettings;
Expand All @@ -361,9 +357,7 @@ def commit(self, settings: Optional[BaseRequestSettings] = None) -> None:
self._commit_call(settings)

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
"""Calls rollback on a transaction if it is open otherwise is no-op. If transaction execution
failed then this method raises PreconditionFailed.
:param settings: An additional request settings BaseRequestSettings;
Expand Down Expand Up @@ -391,9 +385,7 @@ def execute(
concurrent_result_sets: Optional[bool] = False,
settings: Optional[BaseRequestSettings] = None,
) -> base.SyncResponseContextIterator:
"""WARNING: This API is experimental and could be changed.
Sends a query to Query Service
"""Sends a query to Query Service
:param query: (YQL or SQL text) to be executed.
:param parameters: dict with parameters and YDB types;
Expand Down

0 comments on commit b6c02ea

Please sign in to comment.