Skip to content

Commit

Permalink
dont stomp on original transaction id
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-rogers committed Nov 21, 2024
1 parent 520dc0f commit d6150ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion python/tests/api/writer/test_whylabs_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,9 @@ def test_transaction_aborted():
transaction_id = writer.start_transaction()
status, id = writer.write(result)
assert status
writer._whylabs_client.abort_transaction(transaction_id)
writer.abort_transaction()
status, id = writer.write(result)
assert transaction_id == writer._whylabs_client._transaction_id
with pytest.raises(TransactionAbortedException) as e:
writer.commit_transaction()
assert str(e) == "Transaction has been aborted"
Expand Down
2 changes: 1 addition & 1 deletion python/whylogs/api/writer/whylabs_transaction_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(
transaction_id: Optional[str] = None,
):
super().__init__(org_id, api_key, dataset_id, api_client, ssl_ca_cert, _timeout_seconds, whylabs_client)
transaction_id = transaction_id or self._whylabs_client.get_transaction_id() # type: ignore
transaction_id = transaction_id or self._whylabs_client._transaction_id or self._whylabs_client.get_transaction_id() # type: ignore
self._whylabs_client._transaction_id = transaction_id # type: ignore
self._aborted: bool = False

Expand Down

0 comments on commit d6150ba

Please sign in to comment.