From ce2f326eba4cfb78623a9e65b4726fe51b65951f Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Fri, 7 Jul 2023 13:57:52 +0200 Subject: [PATCH] docs(batch): fix custom batch processor example --- docs/utilities/batch.md | 2 +- examples/batch_processing/src/custom_partial_processor.py | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/utilities/batch.md b/docs/utilities/batch.md index b20598106c5..1b9894a0256 100644 --- a/docs/utilities/batch.md +++ b/docs/utilities/batch.md @@ -346,7 +346,7 @@ You can create your own partial batch processor from scratch by inheriting the ` You can then use this class as a context manager, or pass it to `batch_processor` to use as a decorator on your Lambda handler function. -```python hl_lines="9-12 20 35 41 48 59 64 68 76" title="Creating a custom batch processor" +```python hl_lines="9-11 19 33 39 46 57 62 66 74" title="Creating a custom batch processor" --8<-- "examples/batch_processing/src/custom_partial_processor.py" ``` diff --git a/examples/batch_processing/src/custom_partial_processor.py b/examples/batch_processing/src/custom_partial_processor.py index 353f612e7cc..f4aaa5733b5 100644 --- a/examples/batch_processing/src/custom_partial_processor.py +++ b/examples/batch_processing/src/custom_partial_processor.py @@ -7,8 +7,7 @@ from aws_lambda_powertools import Logger from aws_lambda_powertools.utilities.batch import ( - BasePartialBatchProcessor, - EventType, + BasePartialProcessor, process_partial_response, ) @@ -17,7 +16,7 @@ logger = Logger() -class MyPartialProcessor(BasePartialBatchProcessor): +class MyPartialProcessor(BasePartialProcessor): """ Process a record and stores successful results at a Amazon DynamoDB Table @@ -29,8 +28,7 @@ class MyPartialProcessor(BasePartialBatchProcessor): def __init__(self, table_name: str): self.table_name = table_name - - super().__init__(event_type=EventType.SQS) + super().__init__() def _prepare(self): # It's called once, *before* processing