DynamoDBStreams / Client / describe_stream
describe_stream#
- DynamoDBStreams.Client.describe_stream(**kwargs)#
Returns information about a stream, including the current status of the stream, its Amazon Resource Name (ARN), the composition of its shards, and its corresponding DynamoDB table.
Note
You can call
DescribeStream
at a maximum rate of 10 times per second.Each shard in the stream has a
SequenceNumberRange
associated with it. If theSequenceNumberRange
has aStartingSequenceNumber
but noEndingSequenceNumber
, then the shard is still open (able to receive more stream records). If bothStartingSequenceNumber
andEndingSequenceNumber
are present, then that shard is closed and can no longer receive more data.See also: AWS API Documentation
Request Syntax
response = client.describe_stream( StreamArn='string', Limit=123, ExclusiveStartShardId='string' )
- Parameters:
StreamArn (string) –
[REQUIRED]
The Amazon Resource Name (ARN) for the stream.
Limit (integer) – The maximum number of shard objects to return. The upper limit is 100.
ExclusiveStartShardId (string) – The shard ID of the first item that this operation will evaluate. Use the value that was returned for
LastEvaluatedShardId
in the previous operation.
- Return type:
dict
- Returns:
Response Syntax
{ 'StreamDescription': { 'StreamArn': 'string', 'StreamLabel': 'string', 'StreamStatus': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED', 'StreamViewType': 'NEW_IMAGE'|'OLD_IMAGE'|'NEW_AND_OLD_IMAGES'|'KEYS_ONLY', 'CreationRequestDateTime': datetime(2015, 1, 1), 'TableName': 'string', 'KeySchema': [ { 'AttributeName': 'string', 'KeyType': 'HASH'|'RANGE' }, ], 'Shards': [ { 'ShardId': 'string', 'SequenceNumberRange': { 'StartingSequenceNumber': 'string', 'EndingSequenceNumber': 'string' }, 'ParentShardId': 'string' }, ], 'LastEvaluatedShardId': 'string' } }
Response Structure
(dict) –
Represents the output of a
DescribeStream
operation.StreamDescription (dict) –
A complete description of the stream, including its creation date and time, the DynamoDB table associated with the stream, the shard IDs within the stream, and the beginning and ending sequence numbers of stream records within the shards.
StreamArn (string) –
The Amazon Resource Name (ARN) for the stream.
StreamLabel (string) –
A timestamp, in ISO 8601 format, for this stream.
Note that
LatestStreamLabel
is not a unique identifier for the stream, because it is possible that a stream from another table might have the same timestamp. However, the combination of the following three elements is guaranteed to be unique:the Amazon Web Services customer ID.
the table name
the
StreamLabel
StreamStatus (string) –
Indicates the current status of the stream:
ENABLING
- Streams is currently being enabled on the DynamoDB table.ENABLED
- the stream is enabled.DISABLING
- Streams is currently being disabled on the DynamoDB table.DISABLED
- the stream is disabled.
StreamViewType (string) –
Indicates the format of the records within this stream:
KEYS_ONLY
- only the key attributes of items that were modified in the DynamoDB table.NEW_IMAGE
- entire items from the table, as they appeared after they were modified.OLD_IMAGE
- entire items from the table, as they appeared before they were modified.NEW_AND_OLD_IMAGES
- both the new and the old images of the items from the table.
CreationRequestDateTime (datetime) –
The date and time when the request to create this stream was issued.
TableName (string) –
The DynamoDB table with which the stream is associated.
KeySchema (list) –
The key attribute(s) of the stream’s DynamoDB table.
(dict) –
Represents a single element of a key schema. A key schema specifies the attributes that make up the primary key of a table, or the key attributes of an index.
A
KeySchemaElement
represents exactly one attribute of the primary key. For example, a simple primary key would be represented by oneKeySchemaElement
(for the partition key). A composite primary key would require oneKeySchemaElement
for the partition key, and anotherKeySchemaElement
for the sort key.A
KeySchemaElement
must be a scalar, top-level attribute (not a nested attribute). The data type must be one of String, Number, or Binary. The attribute cannot be nested within a List or a Map.AttributeName (string) –
The name of a key attribute.
KeyType (string) –
The role that this key attribute will assume:
HASH
- partition keyRANGE
- sort key
Note
The partition key of an item is also known as its hash attribute. The term “hash attribute” derives from DynamoDB’s usage of an internal hash function to evenly distribute data items across partitions, based on their partition key values.
The sort key of an item is also known as its range attribute. The term “range attribute” derives from the way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.
Shards (list) –
The shards that comprise the stream.
(dict) –
A uniquely identified group of stream records within a stream.
ShardId (string) –
The system-generated identifier for this shard.
SequenceNumberRange (dict) –
The range of possible sequence numbers for the shard.
StartingSequenceNumber (string) –
The first sequence number for the stream records contained within a shard. String contains numeric characters only.
EndingSequenceNumber (string) –
The last sequence number for the stream records contained within a shard. String contains numeric characters only.
ParentShardId (string) –
The shard ID of the current shard’s parent.
LastEvaluatedShardId (string) –
The shard ID of the item where the operation stopped, inclusive of the previous result set. Use this value to start a new operation, excluding this value in the new request.
If
LastEvaluatedShardId
is empty, then the “last page” of results has been processed and there is currently no more data to be retrieved.If
LastEvaluatedShardId
is not empty, it does not necessarily mean that there is more data in the result set. The only way to know when you have reached the end of the result set is whenLastEvaluatedShardId
is empty.
Exceptions
Examples
The following example describes a stream with a given stream ARN.
response = client.describe_stream( StreamArn='arn:aws:dynamodb:us-west-2:111122223333:table/Forum/stream/2015-05-20T20:51:10.252', ) print(response)
Expected Output:
{ 'StreamDescription': { 'CreationRequestDateTime': datetime(2015, 5, 20, 13, 51, 10, 2, 140, -1), 'KeySchema': [ { 'AttributeName': 'ForumName', 'KeyType': 'HASH', }, { 'AttributeName': 'Subject', 'KeyType': 'RANGE', }, ], 'Shards': [ { 'SequenceNumberRange': { 'EndingSequenceNumber': '20500000000000000910398', 'StartingSequenceNumber': '20500000000000000910398', }, 'ShardId': 'shardId-00000001414562045508-2bac9cd2', }, { 'ParentShardId': 'shardId-00000001414562045508-2bac9cd2', 'SequenceNumberRange': { 'EndingSequenceNumber': '820400000000000001192334', 'StartingSequenceNumber': '820400000000000001192334', }, 'ShardId': 'shardId-00000001414576573621-f55eea83', }, { 'ParentShardId': 'shardId-00000001414576573621-f55eea83', 'SequenceNumberRange': { 'EndingSequenceNumber': '1683700000000000001135967', 'StartingSequenceNumber': '1683700000000000001135967', }, 'ShardId': 'shardId-00000001414592258131-674fd923', }, { 'ParentShardId': 'shardId-00000001414592258131-674fd923', 'SequenceNumberRange': { 'StartingSequenceNumber': '2574600000000000000935255', }, 'ShardId': 'shardId-00000001414608446368-3a1afbaf', }, ], 'StreamArn': 'arn:aws:dynamodb:us-west-2:111122223333:table/Forum/stream/2015-05-20T20:51:10.252', 'StreamLabel': '2015-05-20T20:51:10.252', 'StreamStatus': 'ENABLED', 'StreamViewType': 'NEW_AND_OLD_IMAGES', 'TableName': 'Forum', }, 'ResponseMetadata': { '...': '...', }, }