Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(batch): fix custom batch processor example #2714

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/utilities/batch.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
```

Expand Down
8 changes: 3 additions & 5 deletions examples/batch_processing/src/custom_partial_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

from aws_lambda_powertools import Logger
from aws_lambda_powertools.utilities.batch import (
BasePartialBatchProcessor,
EventType,
BasePartialProcessor,
process_partial_response,
)

Expand All @@ -17,7 +16,7 @@
logger = Logger()


class MyPartialProcessor(BasePartialBatchProcessor):
class MyPartialProcessor(BasePartialProcessor):
"""
Process a record and stores successful results at a Amazon DynamoDB Table

Expand All @@ -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
Expand Down