KinesisClient.put_record
rboto-kinesis==0.4.0 · Service index · Types
Model summary (excerpt): Writes a single data record into an Amazon Kinesis data stream. Call PutRecord to send data into the stream for real-time ingestion and subsequent processing, one record at a time. Each shard can support writes up to 1,000 records per second, up to a maximum data write total of 10 MiB per second. When invoking this API, you must use either the StreamARN or the StreamName parameter, or both. It...
Install and imports
Signature
async def put_record(
*,
data: bytes,
stream_name: str | None = None,
partition_key: str | None = None,
explicit_hash_key: str | None = None,
sequence_number_for_ordering: str | None = None,
stream_arn: str | None = None,
stream_id: str | None = None,
dry_run: bool | None = None,
) -> PutRecordOutput: ...
Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.
Arguments
| Argument | Required | Model notes (excerpt) |
|---|---|---|
data |
Yes | The data blob to put into the record, which is base64-encoded when the blob is serialized. When the data blob (the payload before base64-encoding) is added to the partition key size, the total size must not exceed the maximum record size (10 MiB). |
stream_name |
No | The name of the stream to put the data record into. |
partition_key |
No | Determines which shard in the stream the data record is assigned to. Partition keys are Unicode strings with a maximum length limit of 256 characters for each key. Amazon Kinesis Data Streams uses the partition key as input to a hash function that maps the partition key and associated data to a specific shard. Specifically, an MD5 hash function is used to map partition keys to 128-bit integer... |
explicit_hash_key |
No | The hash value used to explicitly determine the shard the data record is assigned to by overriding the partition key hash. |
sequence_number_for_ordering |
No | Guarantees strictly increasing sequence numbers, for puts from the same client and to the same partition key. Usage: set the SequenceNumberForOrdering of record n to the sequence number of record n-1 (as returned in the result when putting record n-1 ). If this parameter is not set, records are coarsely ordered based on arrival time. |
stream_arn |
No | The ARN of the stream. |
stream_id |
No | Not Implemented. Reserved for future use. |
dry_run |
No | Checks if your request will succeed. DryRun is an optional parameter. |
Output
PutRecordOutput.
Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.
| Field | Type | Presence | References |
|---|---|---|---|
shard_id |
str |
Always present | — |
sequence_number |
str |
Always present | — |
encryption_type |
EncryptionTypeOutput | None |
Always present | EncryptionTypeOutput |
| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.
Related types
Follow these links for nested inputs and outputs; recursive types link back to the same type page.
Pagination and streaming
No generated paginator for this operation.
No output stream.
Errors
Import from rboto_kinesis.exceptions:
AccessDeniedError, DryRunOperationError, InternalFailureError, InvalidArgumentError, KMSAccessDeniedError, KMSDisabledError, KMSInvalidStateError, KMSNotFoundError, KMSOptInRequiredError, KMSThrottlingError, ProvisionedThroughputExceededError, ResourceNotFoundError.
Other service failures use the service base error; credential, transport and timeout failures use shared errors.
Example
Complete, type-checked service example. Replace its placeholders and configure credentials before running it.
import asyncio
import os
from rboto import KinesisClient
async def main() -> None:
async with KinesisClient(region="eu-west-2") as client:
result = await client.put_record(
stream_name=os.environ["KINESIS_STREAM_NAME"],
partition_key="order-123",
data=b'{"order_id": "123", "status": "created"}',
)
print(result.shard_id, result.sequence_number)
if __name__ == "__main__":
asyncio.run(main())