QldbSession Reference

class pyqldb.session.qldb_session.QldbSession(session, read_ahead, executor)[source]

The QldbSession is meant for internal use only. A class representing a session to a QLDB ledger for interacting with QLDB. A QldbSession is linked to the specified ledger in the parent driver of the instance of the QldbSession. In any given QldbSession, only one transaction can be active at a time. This object can have only one underlying session to QLDB, and therefore the lifespan of a QldbSession is tied to the underlying session, which is not indefinite, and on expiry this QldbSession will become invalid, and a new QldbSession needs to be created from the parent driver in order to continue usage.

When a QldbSession is no longer needed, pyqldb.session.qldb_session.QldbSession._end_session() should be invoked in order to clean up any resources.

See pyqldb.driver.qldb_driver.QldbDriver for an example of session lifecycle management, allowing the re-use of sessions when possible. There should only be one thread interacting with a session at any given time.

  • session (pyqldb.communication.session_client.SessionClient) – The session object representing a communication channel with QLDB.

  • read_ahead (int) – The number of pages to read-ahead and buffer when retrieving results.

  • executor (concurrent.futures.thread.ThreadPoolExecutor) – The executor to be used by the retrieval thread.

property ledger_name

The read-only ledger name.

property session_id

The read-only session ID.

property session_token

The read-only session token.