MCPcopy Create free account
hub / github.com/ExtendDB/extenddb / batch_operations

Function batch_operations

samples/sample_app.py:380–398  ·  view source on GitHub ↗

Demonstrate BatchGetItem.

(client)

Source from the content-addressed store, hash-verified

378# ---------------------------------------------------------------------------
379
380def batch_operations(client) -> None:
381 """Demonstrate BatchGetItem."""
382 section("Step 6: Batch Operations (BatchGetItem)")
383
384 resp = client.batch_get_item(
385 RequestItems={
386 USERS_TABLE: {
387 "Keys": [
388 {"userId": {"S": "user-001"}},
389 {"userId": {"S": "user-002"}},
390 {"userId": {"S": "user-003"}},
391 ],
392 },
393 },
394 )
395 users = resp["Responses"][USERS_TABLE]
396 print(f" ✓ BatchGetItem returned {len(users)} users:")
397 for u in sorted(users, key=lambda x: x["userId"]["S"]):
398 print(f" {u['userId']['S']}: {u['name']['S']} ({u['email']['S']})")
399# ---------------------------------------------------------------------------
400# Step 7: Transactions
401# ---------------------------------------------------------------------------

Callers 1

mainFunction · 0.85

Calls 1

sectionFunction · 0.85

Tested by

no test coverage detected