@@ -370,22 +370,22 @@ You can use `@batch_resolver` or `@async_batch_resolver` decorators to receive t
370
370
371
371
In this mode, you must return results in the same order of your batch items, so AppSync can associate the results back to the client.
372
372
373
- === "getting_started_with_batch_resolver .py"
373
+ === "advanced_batch_resolver .py"
374
374
```python hl_lines="5 9 23"
375
- --8<-- "examples/event_handler_graphql/src/getting_started_with_batch_resolver .py"
375
+ --8<-- "examples/event_handler_graphql/src/advanced_batch_resolver .py"
376
376
```
377
377
378
378
1. The entire batch is sent to the resolver. You need to iterate through it to process all records.
379
379
2. We use `post_id` as our unique identifier of the GraphQL request.
380
380
381
- === "getting_started_with_batch_resolver_payload .json"
381
+ === "advanced_batch_resolver_payload .json"
382
382
```json hl_lines="6 16 25 35 44 54"
383
- --8<-- "examples/event_handler_graphql/src/getting_started_with_batch_resolver_payload .json"
383
+ --8<-- "examples/event_handler_graphql/src/advanced_batch_resolver_payload .json"
384
384
```
385
385
386
- === "getting_started_with_batch_query .graphql"
386
+ === "advanced_batch_query .graphql"
387
387
```typescript hl_lines="3 6"
388
- --8<-- "examples/event_handler_graphql/src/getting_started_with_batch_query .graphql"
388
+ --8<-- "examples/event_handler_graphql/src/advanced_batch_query .graphql"
389
389
```
390
390
391
391
##### Processing items individually
@@ -445,22 +445,22 @@ In this mode, we will:
445
445
2 . Gracefully handle errors by adding ` None ` in the final response for each batch item that failed processing
446
446
* You can customize ` nul ` or error responses back to the client in the [ AppSync resolver mapping templates] ( https://docs.aws.amazon.com/appsync/latest/devguide/tutorial-lambda-resolvers.html#returning-individual-errors ) {target="_ blank"}
447
447
448
- === "getting_started_with_batch_resolver_individual .py"
448
+ === "advanced_batch_resolver_individual .py"
449
449
```python hl_lines="5 9 19"
450
- --8<-- "examples/event_handler_graphql/src/getting_started_with_batch_resolver_individual .py"
450
+ --8<-- "examples/event_handler_graphql/src/advanced_batch_resolver_individual .py"
451
451
```
452
452
453
453
1. You need to disable the aggregated event by using `aggregate` flag.
454
454
The resolver receives and processes each record one at a time.
455
455
456
- === "getting_started_with_batch_resolver_payload .json"
456
+ === "advanced_batch_resolver_payload .json"
457
457
```json hl_lines="6 16 25 35 44 54"
458
- --8<-- "examples/event_handler_graphql/src/getting_started_with_batch_resolver_payload .json"
458
+ --8<-- "examples/event_handler_graphql/src/advanced_batch_resolver_payload .json"
459
459
```
460
460
461
- === "getting_started_with_batch_query .graphql"
461
+ === "advanced_batch_query .graphql"
462
462
```typescript hl_lines="3 6"
463
- --8<-- "examples/event_handler_graphql/src/getting_started_with_batch_query .graphql"
463
+ --8<-- "examples/event_handler_graphql/src/advanced_batch_query .graphql"
464
464
```
465
465
466
466
##### Raise on error
@@ -519,42 +519,42 @@ You can toggle `raise_on_error` parameter in `@batch_resolver` to propagate any
519
519
520
520
This is useful when you want to stop processing immediately in the event of an unhandled or unrecoverable exception.
521
521
522
- === "getting_started_with_batch_resolver_handling_error .py"
522
+ === "advanced_batch_resolver_handling_error .py"
523
523
```python hl_lines="5 9 19"
524
- --8<-- "examples/event_handler_graphql/src/getting_started_with_batch_resolver_handling_error .py"
524
+ --8<-- "examples/event_handler_graphql/src/advanced_batch_resolver_handling_error .py"
525
525
```
526
526
527
527
1. You can enable enable the error handling by using `raise_on_error` flag.
528
528
529
- === "getting_started_with_batch_resolver_payload .json"
529
+ === "advanced_batch_resolver_payload .json"
530
530
```json hl_lines="6 16 25 35 44 54"
531
- --8<-- "examples/event_handler_graphql/src/getting_started_with_batch_resolver_payload .json"
531
+ --8<-- "examples/event_handler_graphql/src/advanced_batch_resolver_payload .json"
532
532
```
533
533
534
- === "getting_started_with_batch_query .graphql"
534
+ === "advanced_batch_query .graphql"
535
535
```typescript hl_lines="3 6"
536
- --8<-- "examples/event_handler_graphql/src/getting_started_with_batch_query .graphql"
536
+ --8<-- "examples/event_handler_graphql/src/advanced_batch_query .graphql"
537
537
```
538
538
539
539
#### Async batch resolver
540
540
541
541
Similar to ` @batch_resolver ` explained in [ batch resolvers] ( #batch-resolvers ) , you can use ` async_batch_resolver ` to handle async functions.
542
542
543
- === "getting_started_with_batch_async_resolver .py"
543
+ === "advanced_batch_async_resolver .py"
544
544
```python hl_lines="5 9 23"
545
- --8<-- "examples/event_handler_graphql/src/getting_started_with_batch_async_resolver .py"
545
+ --8<-- "examples/event_handler_graphql/src/advanced_batch_async_resolver .py"
546
546
```
547
547
548
548
1. `async_batch_resolver` takes care of running and waiting for coroutine completion.
549
549
550
- === "getting_started_with_batch_resolver_payload .json"
550
+ === "advanced_batch_resolver_payload .json"
551
551
```json hl_lines="6 16 25 35 44 54"
552
- --8<-- "examples/event_handler_graphql/src/getting_started_with_batch_resolver_payload .json"
552
+ --8<-- "examples/event_handler_graphql/src/advanced_batch_resolver_payload .json"
553
553
```
554
554
555
- === "getting_started_with_batch_query .graphql"
555
+ === "advanced_batch_query .graphql"
556
556
```typescript hl_lines="3 6"
557
- --8<-- "examples/event_handler_graphql/src/getting_started_with_batch_query .graphql"
557
+ --8<-- "examples/event_handler_graphql/src/advanced_batch_query .graphql"
558
558
```
559
559
560
560
## Testing your code
0 commit comments