send_command

send_command(**kwargs)

Sends a command to an Amazon QLDB ledger.

Note

Instead of interacting directly with this API, we recommend using the QLDB driver or the QLDB shell to execute data transactions on a ledger.

  • If you are working with an AWS SDK, use the QLDB driver. The driver provides a high-level abstraction layer above this QLDB Session data plane and manages SendCommand API calls for you. For information and a list of supported programming languages, see Getting started with the driver in the Amazon QLDB Developer Guide .
  • If you are working with the AWS Command Line Interface (AWS CLI), use the QLDB shell. The shell is a command line interface that uses the QLDB driver to interact with a ledger. For information, see Accessing Amazon QLDB using the QLDB shell.

See also: AWS API Documentation

Request Syntax

response = client.send_command(
    SessionToken='string',
    StartSession={
        'LedgerName': 'string'
    },
    StartTransaction={}
    ,
    EndSession={}
    ,
    CommitTransaction={
        'TransactionId': 'string',
        'CommitDigest': b'bytes'
    },
    AbortTransaction={}
    ,
    ExecuteStatement={
        'TransactionId': 'string',
        'Statement': 'string',
        'Parameters': [
            {
                'IonBinary': b'bytes',
                'IonText': 'string'
            },
        ]
    },
    FetchPage={
        'TransactionId': 'string',
        'NextPageToken': 'string'
    }
)
Parameters
  • SessionToken (string) --

    Specifies the session token for the current command. A session token is constant throughout the life of the session.

    To obtain a session token, run the StartSession command. This SessionToken is required for every subsequent command that is issued during the current session.

  • StartSession (dict) --

    Command to start a new session. A session token is obtained as part of the response.

    • LedgerName (string) -- [REQUIRED]

      The name of the ledger to start a new session against.

  • StartTransaction (dict) -- Command to start a new transaction.
  • EndSession (dict) -- Command to end the current session.
  • CommitTransaction (dict) --

    Command to commit the specified transaction.

    • TransactionId (string) -- [REQUIRED]

      Specifies the transaction ID of the transaction to commit.

    • CommitDigest (bytes) -- [REQUIRED]

      Specifies the commit digest for the transaction to commit. For every active transaction, the commit digest must be passed. QLDB validates CommitDigest and rejects the commit with an error if the digest computed on the client does not match the digest computed by QLDB.

      The purpose of the CommitDigest parameter is to ensure that QLDB commits a transaction if and only if the server has processed the exact set of statements sent by the client, in the same order that client sent them, and with no duplicates.

  • AbortTransaction (dict) -- Command to abort the current transaction.
  • ExecuteStatement (dict) --

    Command to execute a statement in the specified transaction.

    • TransactionId (string) -- [REQUIRED]

      Specifies the transaction ID of the request.

    • Statement (string) -- [REQUIRED]

      Specifies the statement of the request.

    • Parameters (list) --

      Specifies the parameters for the parameterized statement in the request.

      • (dict) --

        A structure that can contain a value in multiple encoding formats.

        • IonBinary (bytes) --

          An Amazon Ion binary value contained in a ValueHolder structure.

        • IonText (string) --

          An Amazon Ion plaintext value contained in a ValueHolder structure.

  • FetchPage (dict) --

    Command to fetch a page.

    • TransactionId (string) -- [REQUIRED]

      Specifies the transaction ID of the page to be fetched.

    • NextPageToken (string) -- [REQUIRED]

      Specifies the next page token of the page to be fetched.

Return type

dict

Returns

Response Syntax

{
    'StartSession': {
        'SessionToken': 'string',
        'TimingInformation': {
            'ProcessingTimeMilliseconds': 123
        }
    },
    'StartTransaction': {
        'TransactionId': 'string',
        'TimingInformation': {
            'ProcessingTimeMilliseconds': 123
        }
    },
    'EndSession': {
        'TimingInformation': {
            'ProcessingTimeMilliseconds': 123
        }
    },
    'CommitTransaction': {
        'TransactionId': 'string',
        'CommitDigest': b'bytes',
        'TimingInformation': {
            'ProcessingTimeMilliseconds': 123
        },
        'ConsumedIOs': {
            'ReadIOs': 123,
            'WriteIOs': 123
        }
    },
    'AbortTransaction': {
        'TimingInformation': {
            'ProcessingTimeMilliseconds': 123
        }
    },
    'ExecuteStatement': {
        'FirstPage': {
            'Values': [
                {
                    'IonBinary': b'bytes',
                    'IonText': 'string'
                },
            ],
            'NextPageToken': 'string'
        },
        'TimingInformation': {
            'ProcessingTimeMilliseconds': 123
        },
        'ConsumedIOs': {
            'ReadIOs': 123,
            'WriteIOs': 123
        }
    },
    'FetchPage': {
        'Page': {
            'Values': [
                {
                    'IonBinary': b'bytes',
                    'IonText': 'string'
                },
            ],
            'NextPageToken': 'string'
        },
        'TimingInformation': {
            'ProcessingTimeMilliseconds': 123
        },
        'ConsumedIOs': {
            'ReadIOs': 123,
            'WriteIOs': 123
        }
    }
}

Response Structure

  • (dict) --

    • StartSession (dict) --

      Contains the details of the started session that includes a session token. This SessionToken is required for every subsequent command that is issued during the current session.

      • SessionToken (string) --

        Session token of the started session. This SessionToken is required for every subsequent command that is issued during the current session.

      • TimingInformation (dict) --

        Contains server-side performance information for the command.

        • ProcessingTimeMilliseconds (integer) --

          The amount of time that QLDB spent on processing the command, measured in milliseconds.

    • StartTransaction (dict) --

      Contains the details of the started transaction.

      • TransactionId (string) --

        The transaction ID of the started transaction.

      • TimingInformation (dict) --

        Contains server-side performance information for the command.

        • ProcessingTimeMilliseconds (integer) --

          The amount of time that QLDB spent on processing the command, measured in milliseconds.

    • EndSession (dict) --

      Contains the details of the ended session.

      • TimingInformation (dict) --

        Contains server-side performance information for the command.

        • ProcessingTimeMilliseconds (integer) --

          The amount of time that QLDB spent on processing the command, measured in milliseconds.

    • CommitTransaction (dict) --

      Contains the details of the committed transaction.

      • TransactionId (string) --

        The transaction ID of the committed transaction.

      • CommitDigest (bytes) --

        The commit digest of the committed transaction.

      • TimingInformation (dict) --

        Contains server-side performance information for the command.

        • ProcessingTimeMilliseconds (integer) --

          The amount of time that QLDB spent on processing the command, measured in milliseconds.

      • ConsumedIOs (dict) --

        Contains metrics about the number of I/O requests that were consumed.

        • ReadIOs (integer) --

          The number of read I/O requests that the command made.

        • WriteIOs (integer) --

          The number of write I/O requests that the command made.

    • AbortTransaction (dict) --

      Contains the details of the aborted transaction.

      • TimingInformation (dict) --

        Contains server-side performance information for the command.

        • ProcessingTimeMilliseconds (integer) --

          The amount of time that QLDB spent on processing the command, measured in milliseconds.

    • ExecuteStatement (dict) --

      Contains the details of the executed statement.

      • FirstPage (dict) --

        Contains the details of the first fetched page.

        • Values (list) --

          A structure that contains values in multiple encoding formats.

          • (dict) --

            A structure that can contain a value in multiple encoding formats.

            • IonBinary (bytes) --

              An Amazon Ion binary value contained in a ValueHolder structure.

            • IonText (string) --

              An Amazon Ion plaintext value contained in a ValueHolder structure.

        • NextPageToken (string) --

          The token of the next page.

      • TimingInformation (dict) --

        Contains server-side performance information for the command.

        • ProcessingTimeMilliseconds (integer) --

          The amount of time that QLDB spent on processing the command, measured in milliseconds.

      • ConsumedIOs (dict) --

        Contains metrics about the number of I/O requests that were consumed.

        • ReadIOs (integer) --

          The number of read I/O requests that the command made.

        • WriteIOs (integer) --

          The number of write I/O requests that the command made.

    • FetchPage (dict) --

      Contains the details of the fetched page.

      • Page (dict) --

        Contains details of the fetched page.

        • Values (list) --

          A structure that contains values in multiple encoding formats.

          • (dict) --

            A structure that can contain a value in multiple encoding formats.

            • IonBinary (bytes) --

              An Amazon Ion binary value contained in a ValueHolder structure.

            • IonText (string) --

              An Amazon Ion plaintext value contained in a ValueHolder structure.

        • NextPageToken (string) --

          The token of the next page.

      • TimingInformation (dict) --

        Contains server-side performance information for the command.

        • ProcessingTimeMilliseconds (integer) --

          The amount of time that QLDB spent on processing the command, measured in milliseconds.

      • ConsumedIOs (dict) --

        Contains metrics about the number of I/O requests that were consumed.

        • ReadIOs (integer) --

          The number of read I/O requests that the command made.

        • WriteIOs (integer) --

          The number of write I/O requests that the command made.

Exceptions

  • QLDBSession.Client.exceptions.BadRequestException
  • QLDBSession.Client.exceptions.InvalidSessionException
  • QLDBSession.Client.exceptions.OccConflictException
  • QLDBSession.Client.exceptions.RateExceededException
  • QLDBSession.Client.exceptions.LimitExceededException
  • QLDBSession.Client.exceptions.CapacityExceededException