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#

NameTypeDescription
transaction_idSTRINGThe ID of the transaction to retrieve.

Returns#

A table with the following columns:

NameTypeDescription
IDSTRINGThe unique identifier of the transaction.
DATABASE_NAMESTRINGThe name of the RAI Python model from which the transaction was sent.
STATESTRINGThe current state of the transaction. May be one of:
  • CREATED
  • QUEUED
  • RUNNING
  • CANCELING
  • COMPLETED
  • ABORTED
ABORT_REASONSTRINGThe reason the transaction was aborted, if applicable.
READ_ONLYBOOLEANWhether the transaction is read-only.
CREATED_BYSTRINGThe user who created the transaction.
DURATIONSTRINGThe duration of the transaction in milliseconds.
CREATED_ONTIMESTAMPThe timestamp when the transaction was created.
FINISHED_ATTIMESTAMPThe timestamp when the transaction was completed.
ENGINE_NAMESTRINGThe name of the engine that processed the transaction.

Transaction States#

Transactions can have the following states:

StateDescription
CREATEDThe 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.
QUEUEDThe 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.
RUNNINGThe transaction is being processed by the engine.
CANCELINGThe transaction is being cancelled.
COMPLETEDThe transaction has been successfully processed.
ABORTEDThe 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.

See Also#