Closed
Description
Expected Behaviour
The properties for offset
and partition
are the correct int
type on the KafkaEventRecord
class.
Current Behaviour
The properties for offset
and partition
on the KafkaEventRecord
are currently defined as str
type.
Code snippet
class KafkaEventRecord(DictWrapper):
@property
def topic(self) -> str:
"""The Kafka topic."""
return self["topic"]
@property
def partition(self) -> str:
"""The Kafka record parition."""
return self["partition"]
@property
def offset(self) -> str:
"""The Kafka record offset."""
return self["offset"]
Possible Solution
Change the type to int
for the partition
and offset
properties on the KafkaEventRecord
class.
Steps to Reproduce
from aws_lambda_powertools.utilities.data_classes import event_source, KafkaEvent
@event_source(data_class=KafkaEvent)
def lambda_handler(event: KafkaEvent, context):
assert isinstance(event.record.offset, int)
assert isinstance(event.record.partition, int)
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.11
Packaging format used
Lambda Layers
Debugging logs
No response
Metadata
Metadata
Assignees
Type
Projects
Status
Shipped