21 lines
525 B
Python
21 lines
525 B
Python
import boto3
|
|
from aws_lambda_powertools.utilities.data_classes import (
|
|
EventBridgeEvent,
|
|
event_source,
|
|
)
|
|
from aws_lambda_powertools.utilities.typing import LambdaContext
|
|
|
|
from csv_utils import byte_ranges
|
|
|
|
CHUNK_SIZE = 50
|
|
s3_client = boto3.client('s3')
|
|
|
|
|
|
@event_source(data_class=EventBridgeEvent)
|
|
def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
|
new_image = event.detail['new_image']
|
|
csvfile = new_image['csv_s3uri']
|
|
pairs = byte_ranges(csvfile, CHUNK_SIZE)
|
|
|
|
return True
|