get_transaction()#
relationalai.api
#get_transaction(transaction_id STRING)
A procedure that retrieves the details for the transaction with the specified transaction_id
.
Returns a table with the same columns as the api.transactions
view.
Requires the eng_user
application role.
Parameters#
Name | Type | Description |
---|---|---|
transaction_id | STRING | The ID of the transaction to retrieve. |
Returns#
A table with the following columns:
Name | Type | Description |
---|---|---|
ID | STRING | The unique identifier of the transaction. |
DATABASE_NAME | STRING | The name of the RAI Python model from which the transaction was sent. |
STATE | STRING | The current state of the transaction. May be one of:
|
ABORT_REASON | STRING | The reason the transaction was aborted, if applicable. |
READ_ONLY | BOOLEAN | Whether the transaction is read-only. |
CREATED_BY | STRING | The user who created the transaction. |
DURATION | STRING | The duration of the transaction in milliseconds. |
CREATED_ON | TIMESTAMP | The timestamp when the transaction was created. |
FINISHED_AT | TIMESTAMP | The timestamp when the transaction was completed. |
ENGINE_NAME | STRING | The name of the engine that processed the transaction. |
Transaction States#
Transactions can have the following states:
State | Description |
---|---|
CREATED | The transaction has been accepted but is not yet in the engine queue. If it remains in this state, the engine’s resources are at capacity. Consider increasing the engine size or cancelling the transaction and running it on a different engine. |
QUEUED | The transaction is in the engine’s queue. If it remains in this state, the engine’s concurrency limit has been reached. Wait for the transaction to leave the queue or cancel it and rerun on a different engine. |
RUNNING | The transaction is being processed by the engine. |
CANCELING | The transaction is being cancelled. |
COMPLETED | The transaction has been successfully processed. |
ABORTED | The transaction was cancelled or aborted due to an error. Check the ABORT_REASON field for more details. |
Example#
Use the api.get_transaction()
procedure to retrieve the details of a transaction:
#-- Retrieve the details for the transaction with ID '02c8fa31-1234-5678-90ab-abcdef123456'.
SELECT * FROM relationalai.api.get_transaction('02c8fa31-1234-5678-90ab-abcdef123456');
/*+--------------------------------------+---------------+-----------+--------------+-----------+--------------------------+----------+-------------------------------+-------------------------------+--------------+
| ID | DATABASE_NAME | STATE | ABORT_REASON | READ_ONLY | CREATED_BY | DURATION | CREATED_ON | FINISHED_AT | ENGINE_NAME |
|--------------------------------------+---------------+-----------+--------------+-----------+--------------------------+----------+-------------------------------+-------------------------------+--------------|
| 02c8fa31-1234-5678-90ab-abcdef123456 | MyModel | COMPLETED | NULL | TRUE | john.doe@company.com | 7643 | 2024-10-28 08:00:12.123 -0700 | 2024-10-28 08:00:19.766 -0700 | john_doe |
+--------------------------------------+---------------+-----------+--------------+-----------+--------------------------+----------+-------------------------------+-------------------------------+--------------+ */
Transaction IDs can be found in the ID
column of the api.transactions
view.
IDs are also reported by the RAI debugger.
See Compute Resources for more information on managing transactions.