Skip to content

Commit

Permalink
- Added YDB convert support EmptyDict, EmptyList types
Browse files Browse the repository at this point in the history
- Added EXTERNAL_ERROR status code and issue ExternalError
  • Loading branch information
rekby committed Nov 23, 2023
1 parent 87e590a commit caf0468
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* Added YDB convert support EmptyDict, EmptyList types
* Added EXTERNAL_ERROR status code and issue ExternalError

## 2.13.4 ##
* Fixed set keep_in_cache algorithm

Expand Down
1 change: 1 addition & 0 deletions ydb/_tx_ctx_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def execute_request_factory(

if keep_in_cache:
request.query_cache_policy.keep_in_cache = True

request.query.MergeFrom(query_pb)
tx_control = _apis.ydb_table.TransactionControl()
tx_control.commit_tx = commit_tx
Expand Down
2 changes: 2 additions & 0 deletions ydb/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ def _pb_to_void(type_pb, value_pb, table_client_settings):
"dict_type": _pb_to_dict,
"struct_type": _pb_to_struct,
"void_type": _pb_to_void,
"empty_list_type": _pb_to_list,
"empty_dict_type": _pb_to_dict,
}


Expand Down
6 changes: 6 additions & 0 deletions ydb/issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class StatusCode(enum.IntEnum):
UNDETERMINED = _apis.StatusIds.UNDETERMINED
UNSUPPORTED = _apis.StatusIds.UNSUPPORTED
SESSION_BUSY = _apis.StatusIds.SESSION_BUSY
EXTERNAL_ERROR = _apis.StatusIds.EXTERNAL_ERROR

CONNECTION_LOST = _TRANSPORT_STATUSES_FIRST + 10
CONNECTION_FAILURE = _TRANSPORT_STATUSES_FIRST + 20
Expand Down Expand Up @@ -152,6 +153,10 @@ class SessionBusy(Error):
status = StatusCode.SESSION_BUSY


class ExternalError(Error):
status = StatusCode.EXTERNAL_ERROR


class SessionPoolEmpty(Error, queue.Empty):
status = StatusCode.SESSION_POOL_EMPTY

Expand Down Expand Up @@ -191,6 +196,7 @@ def _format_response(response):
StatusCode.UNDETERMINED: Undetermined,
StatusCode.UNSUPPORTED: Unsupported,
StatusCode.SESSION_BUSY: SessionBusy,
StatusCode.EXTERNAL_ERROR: ExternalError,
}


Expand Down

0 comments on commit caf0468

Please sign in to comment.