SessionClient Reference

class pyqldb.communication.session_client.SessionClient(ledger_name, token, client, session_id)[source]

A class representing an independent session to a QLDB ledger that handles endpoint requests. This class is used in pyqldb.driver.base_qldb_driver.BaseQldbDriver and pyqldb.session.qldb_session.QldbSession. This class is not meant to be used directly by developers.

Parameters
  • ledger_name (str) – The QLDB ledger name.

  • token (str) – The initial session token representing the session connection.

Param

The low level service client.

Param

The session ID.

abort_transaction()[source]

Send request to abort the currently active transaction.

Return type

dict

Returns

The abort transaction result response from the endpoint.

property client

The read-only low level service client.

close()[source]

Close this session.

commit_transaction(transaction_id, commit_digest)[source]

Send request to commit the currently active transaction.

Parameters
  • transaction_id (str) – The ID of the transaction.

  • commit_digest (str) – The digest hash of the transaction to commit.

Return type

dict

Returns

The commit transaction result response from the endpoint.

end_session()[source]

Send request to end the independent session represented by the instance of this class.

Return type

dict

Returns

The end session result response from the endpoint.

execute_statement(transaction_id, statement, parameters)[source]

Send an execute request with parameters to QLDB.

Parameters
  • transaction_id (str) – The ID of the transaction.

  • statement (str) – The statement to execute.

  • parameters (list) – List of Ion values to fill in parameters of the statement.

Return type

dict

Returns

The statement result response from the endpoint.

fetch_page(transaction_id, next_page_token)[source]

Send fetch result request to QLDB, retrieving the next chunk of data for the result.

Parameters
  • transaction_id (str) – The ID of the transaction.

  • next_page_token (str) – The next page token.

Return type

dict

Returns

The fetch result response from the endpoint.

property id

The read-only ID of this session.

property ledger_name

The read-only ledger name.

static start_session(ledger_name, client)[source]

Factory method for constructing a new pyqldb.communication.session_client.SessionClient, creating a new session to QLDB on construction.

Parameters
  • ledger_name (str) – The ledger name to create session.

  • client (botocore.client.BaseClient) – The low level service client.

Return type

pyqldb.communication.session_client.SessionClient

Returns

A new SessionClient object.

start_transaction()[source]

Send request to start a transaction.

Return type

dict

Returns

The start transaction response.

property token

The read-only token.